ifroute − configure the interface static routing tables




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.


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. 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 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 colums 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:

The route entry describes real paths to the destinations covered by the route prefix.


The destinations are assigned to this host. The packets are looped back and delivered locally.


The destinations are broadcast addresses. The packets are sent as link broadcasts.


A special type used for multicast routing. It is not present in normal routing tables.


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.


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


These destinations are unreachable. Packets are discarded and the ICMP message communication administratively prohibited is generated. The local senders get an EACCES error.


These destinations are unreachable. Packets are discarded silently. The local senders 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 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.


An example with common network interfaces and some static routes:

# --- IPv4 routes in CIDR prefix notation:
# Destination [Gateway] - Interface
# - - lo - - eth0
default - eth0 - eth1 - eth1

# --- IPv4 routes in deprecared netmask notation:
# Destination [Dummy/Gateway] Netmask Interface
# lo eth0
default eth0 eth1 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

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 and 2001:DB8:100::42/64, the following routes are created automatically: - - eth0

2001:DB8:100::/64 - - eth0

fe80::/64 - - eth0

and should be omitted.




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.


ifcfg(5), ip-route(8)

More Linux Commands

aio_suspend(3) - wait for asynchronous I/O operation or time
The aio_suspend() function suspends the calling thread until one of the following occurs: * One or more of the asynchronous I/O requests in the list aiocb_list

unload(n) - Unload machine code (Local - Linux man page)....
This command tries to unload shared libraries previously loaded with load from the applications address space. fileName is the name of the file containing the l

filefuncs(3am) provide some file related functionality to ga
The filefuncs extension adds several functions that provide access to file-related facilities. chdir() The chdir() function is a direct hook to the chdir(2) sys

Tk_PostscriptFontName(3) - accessor functions for fonts.....
Given a tkfont, Tk_FontId returns the token that should be selected into an XGCValues structure in order to construct a graphics context that can be used to dra

Tk_InitConsoleChannels(3) - Install the console channels as
Tk_InitConsoleChannels is invoked to create a set of console channels and install them as the standard channels. All I/O on these channels will be discarded unt

snapperd(8) DBus daemon for snapper - Linux manual page.....
Snapperd is a DBus daemon for snapper and not for direct use by the user. HOMEPAGE http://snapper.io/ AUTHORS Arvin Schnell &lt;aschnell@suse.de&gt; SEE ALSO snapper(

sshd_config(5) - OpenSSH SSH daemon configuration file......
sshd(8) reads configuration data from /etc/ssh/sshd_config (or the file specified with -f on the command line). The file contains keyword-argument pairs, one pe

tk(n) - Manipulate Tk internal state - Linux manual page....
The tk command provides access to miscellaneous elements of Tks internal state. Most of the information manipulated by this command pertains to the application

terminfo(5) - terminal capability data base - Linux man page
Terminfo is a data base describing terminals, used by screen-oriented programs such as nvi(1), rogue(1) and libraries such as ncurses(3NCURSES). Terminfo descri

set_menu_format(3menu) - set and get menu sizes (Man Page)
The function set_menu_format sets the maximum display size of the given menu. If this size is too small to display all menu items, the menu will be made scrolla

auto_mkindex(n) - standard library of Tcl procedures........
Tcl includes a library of Tcl procedures for commonly-needed functions. The procedures defined in the Tcl library are generic ones suitable for use by many diff

IO::ScalarArray(3pm) - IO:: interface for reading/writing an
This class is part of the IO::Stringy distribution; see IO::Stringy for change log and general information. The IO::ScalarArray class implements objects which b

We can't live, work or learn in freedom unless the software we use is free.