Configuring Static Routes - Red Hat ENTERPRISE LINUX 5 - DEPLOYMENT Deployment Manual

Hide thumbs Also See for ENTERPRISE LINUX 5 - DEPLOYMENT:
Table of Contents

Advertisement

Chapter 14. Network Interfaces
Here, <action> can be either start, stop, or restart.
To view a list of configured devices and currently active network interfaces, use the following
command:
/sbin/service network status

14.4. Configuring Static Routes

Routing will be configured on routing devices, therefore it should not be necessary to configure static
routes on Red Hat Enterprise Linux servers or clients. However, if static routes are required they can
be configured for each interface. This can be useful if you have multiple interfaces in different subnets.
Use the route command to display the IP routing table.
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.
IP Command Arguments Format
Define a default gateway on the first line. This is only required if the default gateway is not set via
DHCP:
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
164

Advertisement

Table of Contents
loading

Table of Contents