Difference between revisions of "IPv4 route configuration"
m |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Network related configuration|Network configuration]] > [[Network interface 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/ | 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 | ||
Line 20: | Line 19: | ||
This way we can add as many static routes as we want. These routes would remain even after '<tt>service network restart</tt>' or machine reboot. | This way we can add as many static routes as we want. These routes would remain even after '<tt>service network restart</tt>' or machine reboot. | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Network related configuration|Network configuration]] > [[Network interface configuration]] > [[IPv4 route configuration]] |
Latest revision as of 12:45, 14 July 2022
Home > CentOS > CentOS 6.x > Network configuration > Network interface 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 '/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.
Home > CentOS > CentOS 6.x > Network configuration > Network interface configuration > IPv4 route configuration