-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Ensuring ipv4 config ahead of ipv6 in /etc/network/interfaces file for mgmt interface #1544
Conversation
mgmt interface This solves the problem that the mgmt interface does not get its ipv4 address Signed-off-by: Wenda <wenni@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please file an issue to track the symptom. We need to revisit the problem in the future in case it hides something bigger.
@@ -21,7 +21,7 @@ iface lo {{ 'inet' if prefix | ipv4 else 'inet6' }} static | |||
# The management network interface | |||
auto eth0 | |||
{% if MGMT_INTERFACE %} | |||
{% for (name, prefix) in MGMT_INTERFACE %} | |||
{% for (name, prefix) in MGMT_INTERFACE|sort %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why sort put v4 ahead of v6? is that a co-incidence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name field is the same, eth0, for both v4 and v6. The sort is based on what is taken in the prefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no guarantee that v4 prefix will be ahead of v6 prefix.
there're tests in the sonic-cfggen could you also update the tests there? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the src/sonic-config-engine/tests/sample_output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the sort result is un-deterministic.
Signed-off-by: Wenda <wenni@microsoft.com>
Signed-off-by: Wenda <wenni@microsoft.com>
Signed-off-by: Wenda <wenni@microsoft.com>
src/sonic-config-engine/sonic-cfggen
Outdated
@@ -33,6 +33,11 @@ from swsssdk import ConfigDBConnector | |||
from collections import OrderedDict | |||
from natsort import natsorted | |||
|
|||
def sift_up_ipv4(value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort_by_prefix
add comments:
for interface name is the same, then sort by prefix. v4 address is before v6 address
Need unit test on interfaces.j2 file. |
Signed-off-by: Wenda <wenni@microsoft.com>
@stcheng src/sonic-config-engine/tests/sample_output has the correct order---v4 profile ahead of v6 |
Modify the ipv6 address such that without sort_by_prefix filter the data taken in will have ipv6 profile before ipv4 in the generated interfaces config file Signed-off-by: Wenda <wenni@microsoft.com>
</a:Prefix> | ||
<a:PrefixStr>2603:10e2:0:2902::8/64</a:PrefixStr> | ||
<a:PrefixStr>603:10e2:0:2902::8/64</a:PrefixStr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the ipv6 address such that without the sort_by_prefix filter, the interfaces.j2 template will place ipv6 profile ahead of ipv4:
--- sample_output/interfaces 2018-04-02 21:28:10.122688400 +0000
+++ /home/localadmin/interfaces 2018-04-02 23:36:40.086688400 +0000
@@ -17,6 +17,18 @@
#
# The management network interface
auto eth0
+iface eth0 inet6 static
+ address 603:10e2:0:2902::8
+ netmask 64
+ ########## management network policy routing rules
+ # management port up rules
+ up ip -6 route add default via 603:10e2:0:2902::1 dev eth0 table default
+ up ip -6 route add 603:10e2:0:2902::/64 dev eth0 table default
+ up ip -6 rule add from 603:10e2:0:2902::8/128 table default
+ # management port down rules
+ down ip -6 route delete default via 603:10e2:0:2902::1 dev eth0 table default
+ down ip -6 route delete 603:10e2:0:2902::/64 dev eth0 table default
+ down ip -6 rule delete from 603:10e2:0:2902::8/128 table default
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
@@ -31,18 +43,6 @@
down ip -4 route delete 10.0.0.0/24 dev eth0 table default
down ip -4 rule delete from 10.0.0.100/32 table default
down ip rule delete to 10.20.6.16/32 table default
-iface eth0 inet6 static
- address 2603:10e2:0:2902::8
- netmask 64
- ########## management network policy routing rules
- # management port up rules
- up ip -6 route add default via 2603:10e2:0:2902::1 dev eth0 table default
- up ip -6 route add 2603:10e2:0:2902::/64 dev eth0 table default
- up ip -6 rule add from 2603:10e2:0:2902::8/128 table default
- # management port down rules
- down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table default
- down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table default
- down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default
#
# The switch front panel interfaces
# "|| true" is added to suppress the error when interface is already a member of LAG
root caused in #1701. drop this PR. |
27ad705 Update PR 1310 with change of the function _checkNoPortsInAsicDb to checkNoPortsInAsicDb 55c64f2 [config/main.py]: Filter table from input config while config validation\DPB. 1993087 [config_mgmt.py]: Verify port status down in APPL DB. 69a5077 Replace call with mock.call cf52272 interface_name_is_valid add arg config_db 0834863 [config/main.py]: Use click.abort() and fix test case by deepcopy(). 7c76602 Fix _shutdownIntf to check correct call bbf05e1 [tests/config_mgmt_test.py]: Minor changes to fix tests. 5e69412 Tests for shutdown intf 2352650 [config_mgmt.py]: Shutdown the interfaces after config validation. (sonic-net#28) 9bbc25f [config] Eliminate race condition between reloading Monit config and (sonic-net#1543) 87b2481 Reduce time taken by show commands on multi-asic platforms (sonic-net#1544) 12fc01e [reboot] No need enable the Linux magic system request key (sonic-net#1538) e0f678a [setup.py]: move the module to test requirement (sonic-net#1542) d55d406 [acl_loader]: add iptype match to the rules for dataplane acl 37376dd [ci]: download latest docker-sonic-vs from sonic-swss repo e9cfb32 [fast-reboot] Fix dump script to support PortChannels in a VLAN group (sonic-net#1393) Signed-off-by: allas <allas@nvidia.com>
SWSS: * d97c7c7 2021-04-07 | [Dynamic Buffer Calc] Enhancement: coding style and LGTM alerts (sonic-net#1693) (HEAD -> 202012) [Stephen Sun] * f70b3da 2021-04-03 | [Makefile] Reorder libsaimetadata and libswsscommon (sonic-net#1689) [Kamil Cudnik] * 72ae85d 2021-04-08 | [vlan] Add support of VLAN host interface (sonic-net#1645) [Volodymyr Samotiy] * a555b9c 2021-04-02 | Correct the sflow default sample rate (sonic-net#1623) [fredyu190011] Utilities: * 1a789d2 2021-04-07 | Fixed the possibility of using uninitialized variable in route_check.py (sonic-net#1551) (HEAD -> 202012) [Renuka Manavalan] * 2412e3c 2021-04-06 | Fix fast-reboot-dump.py SonicV2Connector after late merge (sonic-net#1546) [shlomibitton] * f99c5f1 2021-04-02 | [fast-reboot] Fix dump script to support PortChannels in a VLAN group (sonic-net#1393) [shlomibitton] * 716e2af 2021-04-04 | Reduce time taken by show commands on multi-asic platforms (sonic-net#1544) [abdosi] * a160519 2021-04-03 | [setup.py]: move the module to test requirement (sonic-net#1542) [lguohan] * eaa67fe 2021-04-04 | [config] Eliminate race condition between reloading Monit config and (sonic-net#1543) [yozhao101] * 2497a9e 2021-04-03 | [reboot] No need enable the Linux magic system request key (sonic-net#1538) [yozhao101] * 9fda6fe 2021-04-06 | [fwutil]: Fix next image mount (sonic-net#1533) [Nazarii Hnydyn] * 9af50fe 2021-02-09 | Import 'mock' module from 'unittest' library (sonic-net#1415) (HEAD -> 202012) [Joe LeVeque] Signed-off-by: Ying Xie <ying.xie@microsoft.com>
SWSS: * d97c7c7 2021-04-07 | [Dynamic Buffer Calc] Enhancement: coding style and LGTM alerts (#1693) (HEAD -> 202012) [Stephen Sun] * f70b3da 2021-04-03 | [Makefile] Reorder libsaimetadata and libswsscommon (#1689) [Kamil Cudnik] * 72ae85d 2021-04-08 | [vlan] Add support of VLAN host interface (#1645) [Volodymyr Samotiy] * a555b9c 2021-04-02 | Correct the sflow default sample rate (#1623) [fredyu190011] Utilities: * 1a789d2 2021-04-07 | Fixed the possibility of using uninitialized variable in route_check.py (#1551) (HEAD -> 202012) [Renuka Manavalan] * 2412e3c 2021-04-06 | Fix fast-reboot-dump.py SonicV2Connector after late merge (#1546) [shlomibitton] * f99c5f1 2021-04-02 | [fast-reboot] Fix dump script to support PortChannels in a VLAN group (#1393) [shlomibitton] * 716e2af 2021-04-04 | Reduce time taken by show commands on multi-asic platforms (#1544) [abdosi] * a160519 2021-04-03 | [setup.py]: move the module to test requirement (#1542) [lguohan] * eaa67fe 2021-04-04 | [config] Eliminate race condition between reloading Monit config and (#1543) [yozhao101] * 2497a9e 2021-04-03 | [reboot] No need enable the Linux magic system request key (#1538) [yozhao101] * 9fda6fe 2021-04-06 | [fwutil]: Fix next image mount (#1533) [Nazarii Hnydyn] * 9af50fe 2021-02-09 | Import 'mock' module from 'unittest' library (#1415) (HEAD -> 202012) [Joe LeVeque] Signed-off-by: Ying Xie <ying.xie@microsoft.com>
…#1544) Optimize/Reduce the time taken by show interface * and show ip bgp * commands on Multi-asic platforms.
In generating the interfaces file, put ipv4 config ahead of ipv6 for the mgmt interface
This solves the problem that the mgmt interface does not get its ipv4 address
Signed-off-by: Wenda wenni@microsoft.com
- What I did
Put ipv4 config ahead of ipv6 for the mgmt interface. I observe that on one DUT, the mgmt interface does not possess its IPv4 address and fails to be brought up if the other way round.
- How I did it
Change interfaces.j2
- How to verify it
reboot and see if the mgmt interface has IPv4 address and is reachable.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)