IPv4 route configuration

From Notes_Wiki
Revision as of 12:45, 9 November 2012 by Saurabh (talk | contribs) (Created page with "=IPv4 route configuration= To add routes whenever a network gets started automatically we need to create a per-interface route file. For examples if we can reach network '10....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

IPv4 route configuration

To add routes whenever a network gets started automatically we need to create a per-interface route file. For examples if we can reach network '10.10.0.0/16' via IP '10.3.3.2' connected to interface 'eth1' then we can create file named '/etc/sysconfig/network-scripts/ifcfg-eth1' with following lines:

GATEWAY0=10.3.3.2
NETMASK0=255.255.0.0
ADDRESS0=10.10.0.0

If we want to add additional routes, for example to network '10.11.0.0/16' via '10.3.3.3' then we can use

GATEWAY1=10.3.3.3
NETMASK1=255.255.0.0
ADDRESS1=10.11.0.0
GATEWAY0=10.3.3.2
NETMASK0=255.255.0.0
ADDRESS0=10.10.0.0

This way we can add as many static routes as we want. These routes would remain even after 'service network restart' or machine reboot.