subnet. The example machine has an eth0 interface in the 192.168.0.0/24 subnet, and an eth1
interface (10.10.10.1) in the 10.10.10.0/24 subnet:
10.10.10.0/24 via 10.10.10.1 dev eth1
Duplicate Default Gateways
If the default gateway is already assigned from DHCP, the IP command arguments format
can cause one of two errors during start-up, or when bringing up an interface from the
down state using the ifup command: "RTNETLINK answers: File exists" or 'Error: either
"to" is a duplicate, or "X.X.X.X" is a garbage.', where X.X.X.X is the gateway, or a
different IP address. These errors can also occur if you have another route to another
network using the default gateway. Both of these errors are safe to ignore.
Network/Netmask Directives Format
You can also use the network/netmask directives format for route-interface files. The following is
a template for the network/netmask format, with instructions following afterwards:
ADDRESS0=X.X.X.X
NETMASK0=X.X.X.X
GATEWAY0=X.X.X.X
• ADDRESS0=X.X.X.X is the network number for the static route.
• NETMASK0=X.X.X.X is the netmask for the network number defined with ADDRESS0=X.X.X.X.
• GATEWAY0=X.X.X.X is the default gateway, or an IP address that can be used to reach
ADDRESS0=X.X.X.X
The following is a sample route-eth0 file using the network/netmask directives format. The
default gateway is 192.168.0.1, interface eth0. The two static routes are for the 10.10.10.0/24 and
172.16.1.0/24 networks. However, as mentioned before, this example is not necessary as the
10.10.10.0/24 and 172.16.1.0/24 networks would use the default gateway anyway:
ADDRESS0=10.10.10.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.0.1
ADDRESS1=172.16.1.0
NETMASK1=255.255.255.0
GATEWAY1=192.168.0.1
Subsequent static routes must be numbered sequentially, and must not skip any values. For example,
ADDRESS0, ADDRESS1, ADDRESS2, and so on.
Below is an example of setting static routes to a different subnet, on a machine in the 192.168.0.0/24
subnet. The example machine has an eth0 interface in the 192.168.0.0/24 subnet, and an eth1
interface (10.10.10.1) in the 10.10.10.0/24 subnet:
Configuring Static Routes
165
Need help?
Do you have a question about the ENTERPRISE LINUX 5 - DEPLOYMENT and is the answer not in the manual?
Questions and answers