Difference between revisions of "IPv4 route configuration"
From Notes_Wiki
(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....") |
m |
||
Line 1: | Line 1: | ||
<yambe:breadcrumb>Network interface configuration|Interface configuration</yambe:breadcrumb> | |||
=IPv4 route configuration= | =IPv4 route configuration= | ||
Revision as of 11:53, 2 December 2012
<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/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.