...
The page body will show the "static route tab" as in
Xref |
---|
AnchorName | static_route_tab |
---|
|
Configure the static network route with the following parameters:
- Destination ip address (CIDR notation) or "default"
- Default gateway
- Choose Network Interface on which the traffic must be routed
After inserting all the parameters click on create and new static route will be created and listed in Static Network Route List as shown in Xref |
---|
AnchorName | static route created |
---|
|
.
To edit or delete a static route choose from Static Network Route List an entry to be edited or deleted as shown in
Xref |
---|
AnchorName | static route edit delete |
---|
|
Warning |
---|
The static routes configuration is an advanced topic. It has to be done only if strictly necessary and can lead to serious communication issues if not perfectly understood. |
Subtitle |
---|
Prefix | figure |
---|
SubtitleText | static route tab |
---|
AnchorName | static_route_tab |
---|
|
|
Subtitle |
---|
Prefix | figure |
---|
SubtitleText | static route create |
---|
AnchorName | static route create |
---|
|
|
Subtitle |
---|
Prefix | figure |
---|
SubtitleText | static route created |
---|
AnchorName | static route created |
---|
|
|
Subtitle |
---|
Prefix | figure |
---|
SubtitleText | static route list |
---|
AnchorName | static route list |
---|
|
|
Subtitle |
---|
Prefix | figure |
---|
SubtitleText | static route edit delete |
---|
AnchorName | static route edit delete |
---|
|
|
Static route configuration is stored in a /etc/sysconfig/network-scripts/route-interface
file. For example, static routes for the eth0 interface would be stored in the /etc/sysconfig/network-scripts/route-eth0
file. The route-interface
file has two formats: IP command arguments and network/netmask directives. We will refer just to the first case.
Define a default gateway on the first line. This is only required if the default gateway you set above is not good for this NIC
default X.X.X.X
dev interface
X.X.X.X
is the IP address of the default gateway. The interface
is the interface that is connected to, or can reach, the default gateway.
Define a static route. Each line is parsed as an individual route:
X.X.X.X/X
via X.X.X.X
dev interface
X.X.X.X/X
is the network number and netmask for the static route. X.X.X.X
and interface
are the IP address and interface for the default gateway respectively. The X.X.X.X
address does not have to be the default gateway IP address. In most cases, X.X.X.X
will be an IP address in a different subnet, and interface
will be the interface that is connected to, or can reach, that subnet. Add as many static routes as required.
The following is a sample route-eth0
file using the IP command arguments 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:
default 192.168.0.1 dev eth0
10.10.10.0/24 via 192.168.0.1 dev eth0
172.16.1.0/24 via 192.168.0.1 dev eth0
Static routes should only be configured for other subnets. The above example is not necessary, since packets going to the 10.10.10.0/24 and 172.16.1.0/24 networks will use the default gateway anyway. Below is an example of setting static routes to a different subnet, on a machine in a 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:
10.10.10.0/24 via 10.10.10.1 dev eth1
Warning |
---|
title | 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. |