Fix IPV6 forced-mgmt-route not work issue#17299
Conversation
|
This PR depends on #17281 merge first. |
|
I will finish test and update PR description for review soon |
|
@prsunny Could you help review? #Closed |
|
/azpw run Azure.sonic-buildimage |
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| 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 | ||
| pre-down ip -4 rule delete pref 32764 to 11.11.11.11 table 5000 | ||
| pre-down ip -4 rule delete pref 32764 to 22.22.22.0/23 table 5000 |
There was a problem hiding this comment.
the title is about ipv6, but new test cases are all ipv4, am i missing something here?
There was a problem hiding this comment.
I will add new test case for IPV6.
For IPV4 address, following 2 commands are exactly same:
up ip rule add pref 32764 to 11.11.11.11 table 5000
up ip -4 rule add pref 32764 to 11.11.11.11 table 5000
But for IPV6 address, we always need add '-6' parameter:
up ip -6 rule add pref 32764 to 2603:10e2:0:2902::8 table 5000
|
/azpw ms_conflict |
|
depends PR not cherry pick to 202205/202311/202211 branch, so cherry-pick conflict. |
ix IPV6 forced-mgmt-route not work issue Why I did it IPV6 forced-mgmt-route not work When add a IPV6 route, should use 'ip -6 rule add pref 32764 address' command, but currently in the template the '-6' parameter are missing, so the IPV6 route been add to IPV4 route table. Also this PR depends on sonic-net#17281 , which will fix the IPV6 'default' route table missing in IPV6 route lookup issue. Microsoft ADO (number only):24719238
|
Cherry-pick PR to 202305: #18058 |
ix IPV6 forced-mgmt-route not work issue Why I did it IPV6 forced-mgmt-route not work When add a IPV6 route, should use 'ip -6 rule add pref 32764 address' command, but currently in the template the '-6' parameter are missing, so the IPV6 route been add to IPV4 route table. Also this PR depends on sonic-net#17281 , which will fix the IPV6 'default' route table missing in IPV6 route lookup issue. Microsoft ADO (number only):24719238
|
Cherry-pick PR to 202311: #18045 |
ix IPV6 forced-mgmt-route not work issue Why I did it IPV6 forced-mgmt-route not work When add a IPV6 route, should use 'ip -6 rule add pref 32764 address' command, but currently in the template the '-6' parameter are missing, so the IPV6 route been add to IPV4 route table. Also this PR depends on #17281 , which will fix the IPV6 'default' route table missing in IPV6 route lookup issue. Microsoft ADO (number only):24719238
Fix IPV6 forced-mgmt-route not work issue Why I did it IPV6 forced-mgmt-route not work When add a IPV6 route, should use 'ip -6 rule add pref 32764 address' command, but currently in the template the '-6' parameter are missing, so the IPV6 route been add to IPV4 route table. Also this PR depends on #17281 , which will fix the IPV6 'default' route table missing in IPV6 route lookup issue. Microsoft ADO (number only):24719238
Fix IPV6 forced-mgmt-route not work issue
Why I did it
IPV6 forced-mgmt-route not work
When add a IPV6 route, should use 'ip -6 rule add pref 32764 address' command, but currently in the template the '-6' parameter are missing, so the IPV6 route been add to IPV4 route table.
Also this PR depends on #17281 , which will fix the IPV6 'default' route table missing in IPV6 route lookup issue.
Work item tracking
How I did it
Add IPV6 route with 'ip -6' command
How to verify it
Pass all UT
Manually verify:
// setup forced mgmt routes
admin@vlab-01:
$ sonic-db-cli CONFIG_DB HSET "MGMT_INTERFACE|eth0|fec0::ffff:afa:1/64" forced_mgmt_routes@ "1110::ffff:afa:1/64"$ sudo config save -y1
admin@vlab-01:
Running command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config_db.json
admin@vlab-01:~$ sudo config reload -y
Disabling container monitoring ...
Stopping SONiC target ...
// check interface config update correctly
admin@vlab-01:~$ cat /etc/network/interfaces
...
iface eth0 inet6 static
address fec0::ffff:afa:1
netmask 64
network fec0::
broadcast fec0::ffff:ffff:ffff:ffff
########## management network policy routing rules
# management port up rules
up ip -6 route add default via fec0::1 dev eth0 table default metric 201
up ip -6 route add fec0::/64 dev eth0 table default
up ip -6 rule add pref 32765 from fec0::ffff:afa:1/128 table default
up ip -6 rule add pref 32764 to 1110::ffff:afa:1/64 table default <== force mgmt route added correctly with 'ip -6'
// check route tables:
admin@vlab-01:
$ ip -6 rule list$1001: from all lookup local
32764: from all to 1110::ffff:afa:1/64 lookup default
32765: from fec0::ffff:afa:1 lookup default <== force mgmt route been add to IPV6 table
32766: from all lookup main
admin@vlab-01:
// traceroute command can find route
admin@vlab-01:~$ traceroute 1110::ffff:afa:1
traceroute to 1110::ffff:afa:1 (1110::ffff:afa:1), 30 hops max, 80 byte packets
1 * * *
2 * * *
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Fix IPV6 forced-mgmt-route not work issue
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)