IFROUTE(5)
β¨ IFROUTE(5) β the static routing tables glow-up β¨
okay bestie, buckle up, because this is the page about making your interface's static routes actually happen π
and it lives in ifroute(5), the Network configuration manual. no cap, it's lowkey iconic.
π¦ NAME π¦
ifroute β configure the interface static routing tables. that's it, that's the whole vibe. β¨
πΈ SYNOPSIS πΈ
/etc/sysconfig/network/ifroute-<interface>
/etc/sysconfig/network/routes
two files, main character energy, doing the routing thing. π
π DESCRIPTION π
so here's the tea: /etc/sysconfig/network/ifroute-<interface> and /etc/sysconfig/network/routes get parsed together with /etc/sysconfig/network/ifcfg-<interface> to set up static routes for a particular interface. they're literally a trio, besties. π«Ά
/etc/sysconfig/network/ifroute-<interface>β holds the routes for that particular interface (very "this is MY lane" of it)/etc/sysconfig/network/routesβ can hold routes for all interfaces, the social butterfly of the two π¦
wanna see the routes that are currently assigned? just run:
/sbin/ip -4 route show ; /sbin/ip -6 route show
and that gives you the current (main) routing tables. cute, right? π
π Syntax π
both files use the exact same syntax, the only difference is how the interface field in the 4th column gets interpreted. iykyk.
lines starting with # and blank lines are ignored (snubbed, honestly). there are 5 columns with special meaning. if you want to omit an entry for a field, write a dash -. and if all the following fields in the line are empty too, you can even skip the dash entirely β slay, efficiency. β¨
the columns are: Destination Gateway Netmask Interface Options
1st β Destination column: gives the destination / prefix, written either 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. no gateway? no problem, just be explicit about it. π§
2nd β Gateway column: defines the gateway. write the regular IP-address of a host which routes the packets to a remote host or remote network. you can omit this info for rejecting or device routes using a dash -. π
3rd β Netmask column: bestie, this one is deprecated π it 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 -.
4th β Interface column: contains the name of the interface (lo, eth0, eth1, ib0, ...). classic.
now if you leave this field empty (using a dash -), the result depends on which file you're in β plot twist:
- in
/etc/sysconfig/network/routes, the field is interpreted as no interface information available, and the gateway is examined to see if it belongs to the same network as anIPADDRin 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. π so watch out for that. - in the latter case you may want to use
/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. self-aware king. π
5th β Options column: can be used to specify further options for the route like preference (metric), mtu, or the type of a route. the types, in all their glory:
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 anENETUNREACHerror. πunreachableβ these destinations are unreachable. packets are discarded and and the ICMP message host unreachable is generated. the local senders get anEHOSTUNREACHerror.prohibitβ these destinations are unreachable. packets are discarded and the ICMP message communication administratively prohibited is generated. the local senders get anEACCESerror.blackholeβ these destinations are unreachable. packets are discarded silently. the local senders get anEINVALerror. the silent treatment, literally.natβ a special NAT route, not supported any longer since Linux 2.6. rip, she's retired. πͺ¦
all options (except of to, via and dev used in columns 1-4) of the ip route add command shall be supported. fancy. β¨
columns which are not needed should contain a dash sign ( - ) to ensure that the parser correctly interprets the command. do it for the parser, she's trying her best. π«Ά
π 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 a directly connected network are created automatically (Linux kernel 2.4 and later) as soon as the IP address is assigned to the interface. the kernel is doing the most, honestly.
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 those should be omitted. don't double up, bestie. π
π FILES π
/etc/sysconfig/network/ifroute-<interface>/etc/sysconfig/network/routes
(the two icons of this whole page, fr fr π )
π 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 the ip-route man page by Michail Litvak and others were also used. stan the contributors. π«Άβ¨
π BUGS π
please report bugs as described at <https://bugs.opensuse.org> β help the maintainers help you, bestie. π
β SEE ALSO β
ngl, if you got this far you're basically a routing legend now. go assign some routes, you icon. ππ
this was sysconfig, May 2014 β the IFROUTE(5) era of the Network configuration manual. mwah. πβοΈ
π¦ where this page comes from
- opensuse-leap 16.0: wicked 0.6.80-bp160.2.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: wicked 0.6.80-bp160.2.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: wicked 0.6.80-bp160.2.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: wicked 0.6.80-bp160.2.1 Β· GPL-2.0-or-later
- Copyright (c) 2002-2014 SUSE LINUX Products GmbH, Nuernberg, Germany
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms