Permanently Add Static Route in Linux (RHEL or CentOS)

Move to the below directory with CD

cd /etc/sysconfig/network-scripts/

Create a new file called route-eth# with nano or your preferred text editor (Replace # with your network interface number)

And copy paste the below configuration and edit it to suit your needs.

ADDRESS0=192.168.2.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.10.1

ADDRESS1=192.168.103.0
NETMASK1=255.255.255.0
GATEWAY1=192.168.10.1

ADDRESS2=192.168.101.0
NETMASK2=255.255.255.0
GATEWAY2=192.168.10.1

If you’re using nano then Ctrl+O to write out and Ctrl+X to exit, and do a

service network restart

You can verify your static route by

route -n

Leave a Reply

Your email address will not be published. Required fields are marked *