IFROUTE
NAMESYNOPSIS
DESCRIPTION
Syntax
EXAMPLES
FILES
AUTHOR
SEE ALSO
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 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:
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.
SEE ALSO
ifcfg(5), ip-route(8)
More Linux Commands
manpages/aio_suspend.3.html
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
manpages/unload.n.html
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
manpages/filefuncs.3am.html
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
manpages/Tk_PostscriptFontName.3.html
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
manpages/Tk_InitConsoleChannels.3.html
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
manpages/snapperd.8.html
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 <aschnell@suse.de> SEE ALSO snapper(
manpages/sshd_config.5.html
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
manpages/tk.n.html
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
manpages/terminfo.5.html
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
manpages/set_menu_format.3menu.html
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
manpages/auto_mkindex.n.html
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
manpages/IO::ScalarArray.3pm.html
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
