To add a persistent static route, you will need to create a route-ethX file.
/etc/sysconfig/network-scripts/route-ethXX here refers to your interface number.
Every entry or a route has three lines as follows:
GATEWAY=xxx.xxx.xxx.xxx
NETMASK=yyy.yyy.yyy.yyy
ADDRESS=zzz.zzz.zzz.zzz
As the names implies, they are the gateway IP, Netmask and the IP/Network Address.
Note the number next to each of the three entities. This number defines the route entry number and should be the same on all the entities.
Example:
[root@vm network-scripts]# cat route-eth1
GATEWAY0=10.1.117.1
NETMASK0=255.255.255.0
ADDRESS0=10.1.117.0
#route add -net 192.125.169.45 netmask 255.255.255.255 gw 195.232.168.1 eth1
# cd /etc/sysconfig/network-scripts/
# vi route-eth1
GATEWAY0=195.232.168.1
NETMASK0=255.255.255.255
ADDRESS0=192.125.169.45
Default route is at path:
/etc/sysconfig/network
/etc/sysconfig/network-scripts/route-ethXX here refers to your interface number.
Every entry or a route has three lines as follows:
GATEWAY=xxx.xxx.xxx.xxx
NETMASK=yyy.yyy.yyy.yyy
ADDRESS=zzz.zzz.zzz.zzz
As the names implies, they are the gateway IP, Netmask and the IP/Network Address.
Note the number next to each of the three entities. This number defines the route entry number and should be the same on all the entities.
Example:
[root@vm network-scripts]# cat route-eth1
GATEWAY0=10.1.117.1
NETMASK0=255.255.255.0
ADDRESS0=10.1.117.0
#route add -net 192.125.169.45 netmask 255.255.255.255 gw 195.232.168.1 eth1
# cd /etc/sysconfig/network-scripts/
# vi route-eth1
GATEWAY0=195.232.168.1
NETMASK0=255.255.255.255
ADDRESS0=192.125.169.45
Default route is at path:
/etc/sysconfig/network
No comments:
Post a Comment