Hello all! I’m wanna ask about add permanent route to system. In Ubuntu/Debian i can use if-up directory or netplan in Ubuntu distro. After reboot this route saves and working with my case. How repeat this in Fedora/RHEL,? I trying nmcli, route added but not working with my service. Maybe Fedora has best way for this. Thanks.
A long time ago, when I last had to use static routing, I used something like ip route add {DESTINATION_NETWORK}/{DESTINATION_MASK} dev {INTERFACE} via {GATEWAY}
.
I am not sure if this is still the way to do it.
I rather think these days it’s done using the capabilities of systemd-networkd.
You define the route in /etc/systemd/network/10_routing.network
[Route]
Gateway=192.168.0.1
Destination=10.0.0.0/24
Then sudo systemctl restart systemd-networkd
.
Please share details of your network set up.
What did you configure with nmcli?
Please use nmcli to list that config.
What is the output of ip addr
and ip route
?
Added networking, systemd-networkd
Sure. I’m using Cloak + OpenVPN setup for bypass restrictions. OpenVPN server don’t send route automatically in this case, maybe my fault, but this working and this great. In Debian and Ubuntu i’m use this manual Debian Permanent Static Routes - MyBlueLinux.com for create permanent route which saved after reboot. How can i repeat this for Fedora, because nmcli with command +ipv4.routes “ip gateway” add route, and Cloak see local OpenVPN connection but internet not working.
You did not provide the factual information from the commands.
I do not know what you have configure or what its effect on your system was becuase of that lack.
Fedora has not been configure that ways for years. That guide is of no use to you.
With NetworkManager, take a look at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configuring_static_routes_using_nmcli
Or do a search for “networkmanager route add”.
I know this and ask how i can find alternative way in Fedora for this.
sudo nmcli dev modify enp1s0 +ipv4.routes “x.x.x.x gateway”. This is command for add route. His added, saved after restart. Also i’m configure Cloak service, when i’m starting OpenVPN, Cloak create connection. But internet not working.
P.S. ip route add ip via gateway working, but not permanent. What i’m doing wrong?
Yes, thanks. I know about it, but this didn’t work, idk why. Wrote about this in my replay for Barry.
I’m trying this configuration in AlmaLinux and … all working. Perfect. This is not first time error with Fedora which working in Alma or Oracle. Early i’m trying set up firewalld rules in Fedora(Post here) and no changes after apply command. But this commands in Alma working very well. After reinstall Fedora in past try all working, but now again problem…
You did not provide the information that would have allow us to help you…
My guess is that DHCP is over-writing your route table? See Flo’s comment above on how to make it permanent. (I’ve also seen DHCP eventually override manual routes added with ip route add
on AlmaLinux.)
You can alternatively use nmtui-edit
. For what it’s worth, you don’t have to use systemd-networkd. I just check on my Fedora 39 machine and I have NetworkManager enabled and not systemd-networkd.