To set up a default route going through the eth0 interface, edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file and put the destination address (here 192.168.1.1) into the GATEWAY variable:
GATEWAY=192.168.1.1
Restart the network service:
# service network restart
Check the configuration:
# route -n
To add a static route going through the eth0 interface to 192.168.0.0/24 via 192.168.2.1, create the /etc/sysconfig/network-scripts/route-eth0 file and add the following lines:
ADDRESS0=192.168.0.0 NETMASK0=255.255.255.0 GATEWAY0=192.168.2.1
Restart the network service:
# service network restart
Check the configuration:
# route -n
Leave a Reply
You must be logged in to post a comment.