MAN page from Rawhide wicked-0.6.43-0.0.8.73.fc29.x86_64.rpm
Section: Network configuration (5)
Updated: May 2014Index
ifroute - configure the interface static routing tables
file are parsed together with the/etc/sysconfig/network/ifcfg-
>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.
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:
- The route entry describes real paths to the destinations covered by the routeprefix.
- The destinations are assigned to this host. The packets are looped back anddelivered locally.
- The destinations are broadcast addresses. The packets are sent as linkbroadcasts.
- A special type used for multicast routing. It is not present in normal routingtables.
- 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.
- These destinations are unreachable. Packets are discarded and and the ICMPmessage host unreachable is generated. The local senders get an EHOSTUNREACH error.
- These destinations are unreachable. Packets are discarded and the ICMP messagecommunication administratively prohibitedis generated. The local senders get an EACCES error.
- These destinations are unreachable. Packets are discarded silently. The localsenders get an EINVAL error.
- 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.
An example with common network interfaces and some static routes:
# --- IPv4 routes in CIDR prefix notation:# Destination [Gateway] - Interface#127.0.0.0/8 - - lo18.104.22.168/24 - - eth0default 22.214.171.124 - eth0126.96.36.199/32 188.8.131.52 - eth1192.168.0.0/16 184.108.40.206 - eth1# --- IPv4 routes in deprecared netmask notation:# Destination [Dummy/Gateway] Netmask Interface#127.0.0.0 0.0.0.0 255.255.255.0 lo220.127.116.11 0.0.0.0 255.255.255.0 eth0default 18.104.22.168 0.0.0.0 eth022.214.171.124 126.96.36.199 255.255.255.255 eth1192.168.0.0 188.8.131.52 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
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 184.108.40.206/24and 2001:DB8:100::42/64, the following routes are created automatically:
220.127.116.11/24 - - eth0 2001:DB8:100::/64 - - eth0 fe80::/64 - - eth0
and should be omitted.
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
This document was created byman2html,using the manual pages.