Difference between revisions of "IPv4 route configuration"

From Notes_Wiki
m
m
Line 2: Line 2:
=IPv4 route configuration=
=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 '<tt>/etc/sysconfig/network-scripts/ifcfg-eth1</tt>' with following lines:
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 '<tt>/etc/sysconfig/network-scripts/route-eth1</tt>' with following lines:
<pre>
<pre>
GATEWAY0=10.3.3.2
GATEWAY0=10.3.3.2

Revision as of 13:54, 25 February 2013

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