Constant netlink_packet_route::rtnl::constants::RT_TABLE_LOCAL
source · pub const RT_TABLE_LOCAL: u8 = 255;
Expand description
The local table.
This table is populated automatically by the kernel when addresses are configured.
On a machine that has 192.168.44.211/24
configured on wlp58s0
, iproute2
shows the following routes in the local table:
$ ip route show table local
broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
broadcast 192.168.44.0 dev wlp58s0 proto kernel scope link src 192.168.44.211
local 192.168.44.211 dev wlp58s0 proto kernel scope host src 192.168.44.211
broadcast 192.168.44.255 dev wlp58s0 proto kernel scope link src 192.168.44.211
When the IP address 192.168.44.211
was configured on the wlp58s0
interface, the kernel
automatically added the appropriate routes:
- a route for
192.168.44.211
for local unicast delivery to the IP address - a route for
192.168.44.255
for broadcast delivery to the broadcast address - a route for
192.168.44.0
for broadcast delivery to the network address
When 127.0.0.1
was configured on the loopback interface, the same kind of routes were added to
the local table. However, a loopback address receives a special treatment and the kernel also
adds the whole subnet to the local table.
Note that this is similar for IPv6:
$ ip -6 route show table local
local ::1 dev lo proto kernel metric 0 pref medium
local fe80::7de1:4914:99b7:aa28 dev wlp58s0 proto kernel metric 0 pref medium
ff00::/8 dev wlp58s0 metric 256 pref medium
§Source
This documentation is adapted from Vincent Bernat’s excellent blog