Adding static routes to RedHat 8 and 9
To add a static route to modern RedHat distributions you need to do the following:
Assuming you want to add a route to the 192.168.1.0/24
network via the eth0
network interface to the gateway at 172.16.254
you would create a file called /etc/sysconfig/network-scripts/route-eth0
and in that file put the route:
192.168.1.0/24 via 172.16.1.254
Either ifdown
and ifup
the interfaces or reboot to see the changes.
Of course you could just add the route manually until the next boot:
route add -net 192.168.1.0 netmask 255.255.255.0 gw 172.16.1.254 dev eth1
Subscribe via RSS