summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-04 21:29:31 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-04 21:45:41 +0100
commit5b69a581831ba431d6b56077ad6340925a73a371 (patch)
tree16ae30066edf862ee1c5ad1759028c8c08c19e31
parentd8808f46955fdaed1d2e86ec10b078db66e4639e (diff)
downloadvyos-1x-5b69a581831ba431d6b56077ad6340925a73a371.tar.gz
vyos-1x-5b69a581831ba431d6b56077ad6340925a73a371.zip
vrf: T31: adding unreachable routes to the routing tables
-rwxr-xr-xsrc/conf_mode/vrf.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index 8036703f1..242fc7ccb 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -186,6 +186,11 @@ def apply(vrf_config):
_cmd(f'ip link add {name} type vrf table {table}')
# Start VRf
_cmd(f'ip link set dev {name} up')
+ # The kernel Documentation/networking/vrf.txt also recommends
+ # adding unreachable routes to the VRF routing tables so that routes
+ # afterwards are taken.
+ _cmd(f'ip -4 route add vrf {name} unreachable default metric 4278198272')
+ _cmd(f'ip -6 route add vrf {name} unreachable default metric 4278198272')
# set VRF description for e.g. SNMP monitoring
with open(f'/sys/class/net/{name}/ifalias', 'w') as f: