Routing options can be classified into two categories:
• The ones that are always supported, and that only need to be enabled or configured
by the user, such as via /proc
• The ones whose support may be added or removed by recompiling the kernel
with the right options. The CONFIG_WAN_ROUTER option and the options under the
CONFIG_IP_ROUTE_MULTIPATH_CACHED menu can be compiled as modules; the others
must be compiled into the main kernel.
rtnetlink.h. Its values range from 0 to 255, where 0 (RT_SCOPE_UNIVERSE) represents
the broadest scope.
The scope of a route is saved in the fa_scope field of the fib_alias data structure.Here are the main scopes used by the IPv4 routing code,
in order of increasing scope:
RT_SCOPE_NOWHERE
This value, is treated by the code as illegal.
The literal meaning is that the route does not lead anywhere, which basically
means there is no route to the destination.
RT_SCOPE_HOST
Examples of these routes are the ones created automatically when configuring IP
addresses on the local interfaces (see the section “Adding an IP address”).
RT_SCOPE_LINK
This includes routes to the local network (as defined by the netmask) and to the
subnet broadcast addresses derived from locally configured addresses (see the
section “Adding an IP address”).
RT_SCOPE_UNIVERSE
This is used for all routes that lead to remote destinations not directly connected
(i.e., the ones that require a next-hop gateway).
Remember that for
every route, nh_scope is the next hop’s scope and nh_gw is the next hop’s IP address
Secondary IPv4 addresses are tagged with the IFA_F_SECONDARY flag in their in_ifaddr
data structures
At the highest level, routes are organized into different hash tables based on the
lengths of their netmasks.