5:routes
From Linux Man Pages
routes - configure the routing table
Contents |
SYNOPSIS
/etc/sysconfig/network/routes
/etc/sysconfig/network/ifroute-*
DESCRIPTION
The files /etc/sysconfig/network/routes and /etc/sysconfig/network/ifroute-config are parsed by the script
/etc/sysconfig/network/scripts/ifup-route which sets up routing for an interface/configuration. ifup-route is
used by /sbin/ifup, which is the command line user interface for setting up network interfaces.
/etc/sysconfig/network/routes is used for every interface while /etc/sysconfig/network/ifroute-config is used
only for the network interface configuration stored in /etc/sysconfig/network/ifcfg-config, that means only for a
certain interface. (See a discussion of the notions configuration, interface and device in ifup(8).)
At boot time /etc/init.d/network calls ifup for every existing configuration and uses ifup-route directly to set
up special routes which do not belong to a certain interface.
The current routes can be seen by issuing:
/sbin/ip route list
which will give the current routing table.
Syntax
The files /etc/sysconfig/network/routes and /etc/sysconfig/network/ifroute-config use the same syntax. The only
difference is the interpretation of an empty interface field. See 4th column below.
Lines beginning with # and blank lines are ignored. There are 5 columns with special meaning. Write a dash "-"
if you want to omit an entry for a field. If all following fields in the line are empty too, you can even omit
the dash.
The first column gives the destination, written as the IP-address of a host or a network. The heading default
indicates that the route is the default gateway. Do not use 0.0.0.0 for this purpose. A prefixlen can be used;
e.g., 10.10.0.0/16 is valid.
The second column contains the gateway. Write here the regular IP-address of a host which routes the packages to
a remote host or remote network. You can omit this information for rejecting routes.
The third column gives the netmask for a remote host or remote network behind a gateway. For the default route
or if you were using a prefixlen in the first column, you can omit it.
The fourth column gives the name of the interface of the local networks (lo, eth0, eth0:1, eth1, isdn0, ppp0,
dummy0, ...).
If you leave this field empty the result depends on the file you are using. In /etc/sysconfig/network/routes the
field is interpreted as no interface information available. That is sufficient for the most routes you may set
up, but if you have multiple interfaces this route is set up with every single interface you activate. This may
lead to error messages in the syslog. If you see such an error message which tells you "... this needs NOT to be
AN ERROR" then check if you wrote the wrong ip addresses or if it occurs because it's being set up with the wrong
interface.
In the latter case you may want to use /etc/sysconfig/network/ifroute-config instead. Here an empty interface
field is always replaced with the interface name that is currently being activated. This makes sense because this
file is only used for one configuration (for one interface). This is even necessary if you use several hotplug-
gable devices, because you cannot know the name of the interface that is used with a configuration for a certain
device before.
The fifth column can be used to specify the type of a route:
unicast
The route entry describes real paths to the destinations covered by the route prefix.
local The destinations are assigned to this host. The packets are looped back and delivered locally.
broadcast
The destinations are broadcast addresses. The packets are sent as link broadcasts.
multicast
A special type used for multicast routing. It is not present in normal routing tables.
throw A special control route used together with policy rules. If such a route is selected, lookup in this table
is terminated pretending that no route was found. Without policy routing it is equivalent to the absence
of the route in the routing table. The packets are dropped and the ICMP message net unreachable is gener-
ated. The local senders get an ENETUNREACH error.
unreachable
These destinations are unreachable. Packets are discarded silently. The local senders get an EINVAL error.
prohibit
These destinations are unreachable. Packets are discarded and the ICMP message communication administra-
tively prohibited is generated. The local senders get an EACCES error.
blackhole
These destinations are unreachable. Packets are discarded silently. The local senders get an EINVAL error.
nat A special NAT route. Destinations covered by the prefix are considered to be dummy (or external) addresses
which require translation to real (or internal) ones before forwarding. The addresses to translate to are
selected with attribute 'via'.
Any remaining columns, if given, are appended to the route command. This makes it possible to pass special
options for this route. Columns which are not needed should contain a minus sign ( - ) to ensure that the parser
correctly interprets the command.
EXAMPLES
An example with common network interfaces and some static routes:
# Destination Dummy/Gateway Netmask Device
#
127.0.0.0 0.0.0.0 255.255.255.0 lo
204.127.235.0 0.0.0.0 255.255.255.0 eth0
default 204.127.235.41 0.0.0.0 eth0
207.68.156.51 207.68.145.45 255.255.255.255 eth1
192.168.0.0 207.68.156.51 255.255.0.0 eth1
An example for routing entries for synchronous ppp over a ISDN connection.
# Destination Dummy/Gateway Netmask Device
#
127.0.0.0 0.0.0.0 255.255.255.0 lo
193.102.150.13 0.0.0.0 255.255.255.255 ippp0
default 193.102.150.13 0.0.0.0 ippp0
NOTES
SuSE Linux >= 8.0 uses the ip command from the iproute2 package to setup the network and routes. Please see the
documentation distributed with this package for more information.
FILES
/etc/sysconfig/network/routes
/etc/sysconfig/network/ifroute-config
RELATED
init.d(7), init(8), inittab(5), the documentation for the iproute2 package and the SuSE Linux handbook, chapter The SuSE boot concept.