IPv4 route configuration

From Notes_Wiki
Revision as of 13:54, 25 February 2013 by Saurabh (talk | contribs)

<yambe:breadcrumb>Network interface configuration|Interface configuration</yambe:breadcrumb>

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/route-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.