]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip rule: add route suppression options
authorStefan Tomanek <stefan.tomanek@wertarbyte.de>
Sat, 3 Aug 2013 12:23:16 +0000 (14:23 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Sun, 4 Aug 2013 18:54:15 +0000 (11:54 -0700)
commitb1d0525f9cc3ef6fa7670ff3769828404cea31d4
tree0142dc8f247378980109ac799ef6685148e644bb
parent7bfc49cf475192c27d0f7c9fb9befb5b149bf516
ip rule: add route suppression options

When configuring a system with multiple network uplinks and default routes, it
is often convenient to reference a routing table multiple times - but reject
its routing decision if certain constraints are not met by it.

Consider this setup:

$ ip route add table secuplink default via 10.42.23.1

$ ip rule add pref 100            table main suppress_prefixlength 0
$ ip rule add pref 150 fwmark 0xA table secuplink

With this setup, packets marked 0xA will be processed by the additional routing
table "secuplink", but only if no suitable route in the main routing table can
be found. By suppressing entries with a prefixlength of 0 (or less), the
default route (/0) of the table "main" is hidden to packets processed by rule
100; packets traveling to destinations via more specific routes are processed
as usual.

It is also possible to suppress a routing entry if a device belonging to
a specific interface group is to be used:

$ ip rule add pref 150 table main suppress_group 1

Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
ip/iprule.c
man/man8/ip-rule.8