How to add static routes under RedHat os

To add static routing in RHEL system we need to edit/create file for chosen interface:

vi /etc/sysconfig/network-scripts/route-bond0

we put in it information to which network we need redirection, mask and gateway eg.: via via

then we refresh routes using command:

/etc/sysconfig/network-scripts/ifup-routes bond0

Other option (which works in most linux-based systems)  is add commands to file /etc/local:

vi /etc/rc.local

route add -net netmask gw dev eth1
route add -net netmask gw dev eth1

Leave a Response