IFROUTE(5)

NAME
ifroute - configure the interface static routing tables

SYNOPSIS
/etc/sysconfig/network/ifroute-<interface>
/etc/sysconfig/network/routes

DESCRIPTION
The /etc/sysconfig/network/ifroute-<interface> and the /etc/sysconfig/network/routes file are parsed together with the /etc/sysconfig/network/ifcfg-<interface> file to set up static routes for a particular interface.

The /etc/sysconfig/network/ifroute-<interface> file contains routes for the particular interface while the /etc/sysconfig/network/routes can contain routes for all interfaces. The currently assigned routes can be seen by issuing:

    /sbin/ip -4 route show ; /sbin/ip -6 route show

which will give the current (main) routing tables.

Syntax
Both files use the same syntax. The only difference is the interpretation the interface field in the 4th column. 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 columns are: Destination Gateway Netmask Interface Options The 1st, Destination column gives the destination / prefix, written as the IP-address of a host or as a network in a prefix-length (CIDR notation), e.g. 10.10.0.0/16 for IPv4 or fc00::/7 for IPv6 routes. The heading default indicates that the route is the default gateway in the same address family (ipv4 or ipv6) as the gateway. For device routes without a gateway use explicit 0.0.0.0/0 or ::/0 destinations. The 2nd, Gateway column defines the gateway. Write here the regular IP-address of a host which routes the packets to a remote host or remote network. You can omit this information for rejecting or device routes using a dash '-'. The 3rd, Netmask column is deprecated and gives the IPv4 netmask of the destination. For IPv6 routes, the default route or if you were using a prefix-length (CIDR notation) in the 1st destination column, you can omit it using a dash '-'. The 4th, Interface column contains the name of the interface (lo, eth0, eth1, ib0, ...). If you leave this field empty (using a dash '-'), the result depends on the file you are using. In /etc/sysconfig/network/routes the field is interpreted as no interface information available and the gateway is examined if it belongs to the same network as a IPADDR in all (currently parsed) ifcfg-<interface> files. The first IP address match is used, so if you have multiple interfaces, such a route may match multiple IP addresses and cause unintended behavior. In the latter case you may want to use the /etc/sysconfig/network/ifroute-<interface> instead. Here an empty interface field is replaced with the interface name that is currently being activated, that is the interface in the file name. The 5th, Options column can be used to specify further options for the route like preference (metric), mtu or 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 generated. The local senders get an ENETUNREACH error.

unreachable
    These destinations are unreachable. Packets are discarded and and the ICMP message host unreachable is generated. The local senders get an EHOSTUNREACH error.

prohibit
    These destinations are unreachable. Packets are discarded and the ICMP message communication administratively 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, not supported any longer since Linux 2.6.

All options (except of to, via and dev used in columns 1-4) of the ip route add command shall be supported. Columns which are not needed should contain a dash sign ( - ) to ensure that the parser correctly interprets the command.

EXAMPLES

An example with common network interfaces and some static routes:

# --- IPv4 routes in CIDR prefix notation:
# Destination     [Gateway]         -                  Interface
#
127.0.0.0/8       -                 -                  lo
204.127.235.0/24  -                 -                  eth0
default           204.127.235.41    -                  eth0
207.68.156.51/32  207.68.145.45     -                  eth1
192.168.0.0/16    207.68.156.51     -                  eth1
# --- IPv4 routes in deprecared netmask notation:
# Destination     [Dummy/Gateway]   Netmask            Interface
#
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
# --- IPv6 routes are always using CIDR notation:
# Destination     [Gateway]                -           Interface
#
2001:DB8:100::/64 -                        -           eth0
2001:DB8:100::/32 fe80::216:3eff:fe6d:c042 -           eth0

Note:
Routes to directly connected network are created automatically (Linux kernel 2.4 and later) as soon as the IP address is assigned to the interface. For example, when the eth0 interface IP addresses are 204.127.235.42/24 and 2001:DB8:100::42/64, the following routes are created automatically:
	204.127.235.0/24  -   -   eth0
	2001:DB8:100::/64 -   -   eth0
	fe80::/64         -   -   eth0
and should be omitted.

FILES
/etc/sysconfig/network/ifroute-<interface>
/etc/sysconfig/network/routes

AUTHOR
Michal Svec
Christian Zoz
Mads Martin Joergensen
Marius Tomaschewski
Thanks to Werner Fink for the old route.conf(5). Parts of the ip reference by Alexey Kuznetsov and ip-route man page by Michail Litvak and others were also used.

BUGS

Please report bugs as described at <https://bugs.opensuse.org>

SEE ALSO
ifcfg(5), ip-route(8)