Here i posted about the static route add and Dynamic route add procedure in linux.
A. Create a file - /etc/sysconfig/network-scripts/route-
To add a persistent static route in Redhat Enterprise Linux create a file called route-
where
B. Every entry or a route has three entities as follows:
GATEWAY
NETMASK
ADDRESS
As the names implies, they are the gateway IP, Netmask and the IP/Network Address
Note the
Example:
GATEWAY0=192.168.1.2
NETMASK0=255.255.255.0
ADDRESS0=10.10.10.0
GATEWAY1=192.168.1.3
NETMASK1=255.255.255.0
ADDRESS1=20.20.20.2
C. Once the file is created, restart the network service as follows:
# service network restart
D.To view the routes type
# route
or
#ip route show
A.To dynamically add a route, try the folowing:
Syntax:
# ip route add
Example:
# ip route add 10.10.10.0/24 via 192.168.1.1 dev eth0
or
Syntax:
# route add [-net|-host]
Example:
# route add -net 10.10.10.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0
1 Comments
Nice work
ReplyDeleteLingeswaran
http://www.unixarena.com