How to Configure Static Routes on CentOS 6.2

Routing is the process of selecting paths in a network along which to send network traffic. It’s not necessary to configure Static Routes on Red Hat Enterprise Linux servers or CentOS servers since routing will be configured on routing devices such as routers, bridges, gateways, firewalls and switches. However, if static routes are required they can be configured for each interface. This can be useful when you have multiple network interfaces in different subnets such as eth0, eth1 and eth2. The following static route commands has been tested on Linux CentOS 6.2 server.

See also  How to Recover the Password for root on CentOS 5.7

Display routing table using the following command :

[root@centos62 ~]# netstat -rn

This command will add the Static Routes on CentOS 6.2 server. For example network available via on device eth1 :

[root@centos62 ~]# ip route add via dev eth1

Alternatively, you can use this command :

[root@centos62 ~]# route add -net netmask gw dev eth1

Note : The drawback of using these two commands is it will forget the static routes when server rebooted.


Leave a Reply

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