MAN page from openSUSE Tumbleweed wicked-0.6.45-1.1.x86_64.rpm
IFROUTE
Section: Network configuration (5)
Updated: May 2014
Index 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/routesfile 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/routescan 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 theinterface 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 followingfields in the line are empty too, you can even omit the dash.
The columns are:Destination Gateway Netmask Interface Options
The1st, Destinationcolumn gives the destination / prefix, written as the IP-address of a hostor as a network in a prefix-length (CIDR notation), e.g.10.10.0.0/16for IPv4 orfc00::/7for IPv6 routes. The headingdefaultindicates that the route is the default gateway in the same address family(ipv4 or ipv6) as the gateway. For device routes without a gateway useexplicit 0.0.0.0/0 or ::/0 destinations.
The2nd, Gatewaycolumn defines the gateway. Write here the regular IP-address of a host whichroutes the packets to a remote host or remote network.You can omit this information for rejecting or device routes using a dash '-'.
The3rd, Netmaskcolumn is deprecated and gives the IPv4 netmask of the destination.For IPv6 routes, the default route or if you were using a prefix-length (CIDRnotation) in the 1st destination column, you can omit it using a dash '-'.
The4th, Interfacecolums contains the name of the interface (lo, eth0, eth1, ib0, ...).
If you leave this field empty (using a dash '-'), the result depends on thefile you are using.
In/etc/sysconfig/network/routesthe field is interpreted as no interface information available and thegateway is examined if it belongs to the same network as a IPADDR in all(currently parsed) ifcfg-<interface> files. The first IP addressmatch is used, so if you have multiple interfaces, such a route may matchmultiple 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 namethat is currently being activated, that is the interface in the file name.
The5th, Optionscolumn can be used to specify further options for the route likepreference (metric), mtu or the type of a route:
- unicast
- The route entry describes real paths to the destinations covered by the routeprefix.
- local
- The destinations are assigned to this host. The packets are looped back anddelivered locally.
- broadcast
- The destinations are broadcast addresses. The packets are sent as linkbroadcasts.
- multicast
- A special type used for multicast routing. It is not present in normal routingtables.
- throw
- A special control route used together with policy rules. If such a route isselected, lookup in this table is terminated pretending that no route wasfound. Without policy routing it is equivalent to the absence of the route inthe routing table. The packets are dropped and the ICMP messagenet unreachableis generated. The local senders get an ENETUNREACH error.
- unreachable
- These destinations are unreachable. Packets are discarded and and the ICMPmessage host unreachable is generated. The local senders get an EHOSTUNREACH error.
- prohibit
- These destinations are unreachable. Packets are discarded and the ICMP messagecommunication administratively prohibitedis generated. The local senders get an EACCES error.
- blackhole
- These destinations are unreachable. Packets are discarded silently. The localsenders 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 theip route addcommand 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 - - lo204.127.235.0/24 - - eth0default 204.127.235.41 - eth0207.68.156.51/32 207.68.145.45 - eth1192.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 lo204.127.235.0 0.0.0.0 255.255.255.0 eth0default 204.127.235.41 0.0.0.0 eth0207.68.156.51 207.68.145.45 255.255.255.255 eth1192.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 - - eth02001: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 assignedto the interface.
For example, when the eth0 interface IP addresses are 204.127.235.42/24and 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 SvecChristian ZozMads Martin JoergensenMarius Tomaschewski
Thanks to Werner Fink for the old route.conf(5).Partsoftheipreference by Alexey Kuznetsov and ip-route man page by Michail Litvakand others were also used.
SEE ALSO
ifcfg(5),
ip-route(8)
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- Syntax
- EXAMPLES
- FILES
- AUTHOR
- SEE ALSO
This document was created byman2html,using the manual pages.