Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IPV6 forced-mgmt-route not work issue #17299

Merged
merged 12 commits into from Jan 22, 2024

Conversation

liuh-80
Copy link
Contributor

@liuh-80 liuh-80 commented Nov 27, 2023

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
  • Microsoft ADO (number only):24719238

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"
1
admin@vlab-01:
$ sudo config save -y
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)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

  • master-17299.420743-d31987daa

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)

@liuh-80
Copy link
Contributor Author

liuh-80 commented Nov 27, 2023

This PR depends on #17281 merge first.

@liuh-80
Copy link
Contributor Author

liuh-80 commented Dec 1, 2023

I will finish test and update PR description for review soon

@liuh-80 liuh-80 marked this pull request as ready for review December 1, 2023 03:26
@liuh-80 liuh-80 requested a review from lguohan as a code owner December 1, 2023 03:26
@liuh-80 liuh-80 changed the title [POC] Fix IPV6 forced-mgmt-route not work issue Fix IPV6 forced-mgmt-route not work issue Dec 1, 2023
@qiluo-msft qiluo-msft marked this pull request as draft December 2, 2023 00:54
@qiluo-msft
Copy link
Collaborator

qiluo-msft commented Dec 2, 2023

@prsunny Could you help review? #Closed

@liuh-80 liuh-80 marked this pull request as ready for review December 4, 2023 02:06
prsunny
prsunny previously approved these changes Dec 4, 2023
Copy link
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, wait for PR #17281

@liuh-80
Copy link
Contributor Author

liuh-80 commented Dec 6, 2023

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

Copy link

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
Copy link
Collaborator

@lguohan lguohan Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the title is about ipv6, but new test cases are all ipv4, am i missing something here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@liuh-80
Copy link
Contributor Author

liuh-80 commented Jan 22, 2024

/azpw ms_conflict

@liuh-80
Copy link
Contributor Author

liuh-80 commented Feb 5, 2024

depends PR not cherry pick to 202205/202311/202211 branch, so cherry-pick conflict.

liuh-80 added a commit to liuh-80/sonic-buildimage that referenced this pull request Feb 6, 2024
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
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Feb 7, 2024
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
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #18058

mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Feb 7, 2024
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
@liuh-80
Copy link
Contributor Author

liuh-80 commented Feb 7, 2024

Cherry-pick PR to 202311: #18045

mssonicbld pushed a commit that referenced this pull request Feb 7, 2024
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
yxieca pushed a commit that referenced this pull request Feb 7, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants