diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 9782dd3566..381c00bd1a 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -79,7 +79,7 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static up cgset -r l3mdev.master-device=mgmt mgmt {% endif %} {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} - up ip rule add to {{ route }} table {{ vrf_table }} + up ip rule add pref 32764 to {{ route }} table {{ vrf_table }} {% endfor %} # management port down rules pre-down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table {{ vrf_table }} @@ -89,7 +89,7 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static down cgdelete -g l3mdev:mgmt {% endif %} {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} - pre-down ip rule delete to {{ route }} table {{ vrf_table }} + pre-down ip rule delete pref 32764 to {{ route }} table {{ vrf_table }} {% endfor %} {# TODO: COPP policy type rules #} {% endfor %} diff --git a/src/sonic-config-engine/tests/sample_output/mvrf_interfaces b/src/sonic-config-engine/tests/sample_output/mvrf_interfaces index 348bfca4d4..b341882fb6 100644 --- a/src/sonic-config-engine/tests/sample_output/mvrf_interfaces +++ b/src/sonic-config-engine/tests/sample_output/mvrf_interfaces @@ -29,11 +29,15 @@ iface eth0 inet static up ip -4 rule add pref 32765 from 10.0.0.100/32 table 5000 up cgcreate -g l3mdev:mgmt up cgset -r l3mdev.master-device=mgmt mgmt + up ip rule add pref 32764 to 11.11.11.11 table 5000 + up ip rule add pref 32764 to 22.22.22.0/23 table 5000 # management port down rules pre-down ip -4 route delete default via 10.0.0.1 dev eth0 table 5000 pre-down ip -4 route delete 10.0.0.0/24 dev eth0 table 5000 pre-down ip -4 rule delete pref 32765 from 10.0.0.100/32 table 5000 down cgdelete -g l3mdev:mgmt + pre-down ip rule delete pref 32764 to 11.11.11.11 table 5000 + pre-down ip rule delete pref 32764 to 22.22.22.0/23 table 5000 iface eth0 inet6 static address 2603:10e2:0:2902::8 netmask 64 diff --git a/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml b/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml index 5162086d93..ee633c18bd 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml @@ -393,6 +393,11 @@ switch-t0 + + ForcedMgmtRoutes + + 11.11.11.11;22.22.22.0/23 + ErspanDestinationIpv4