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

config interface shutdown/startup command could get ip address lost #299

Closed
zhenggen-xu opened this issue Aug 16, 2018 · 7 comments
Closed
Assignees
Labels

Comments

@zhenggen-xu
Copy link
Collaborator

Description

Steps to reproduce the issue
admin@sonic:~$ sudo ifconfig Ethernet116
Ethernet116 Link encap:Ethernet HWaddr 00:e0:ec:3c:0a:3e
inet addr:10.0.1.20 Bcast:255.255.255.255 Mask:255.255.255.254
inet6 addr: 2002::1/64 Scope:Global
UP BROADCAST MULTICAST MTU:9100 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

admin@sonic:$ sudo config interface shutdown Ethernet116
admin@sonic:
$ sudo ifconfig Ethernet116
Ethernet116 Link encap:Ethernet HWaddr 00:e0:ec:3c:0a:3e
inet addr:10.0.1.20 Bcast:255.255.255.255 Mask:255.255.255.254
BROADCAST MULTICAST MTU:9100 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

admin@sonic:$ sudo config interface startup Ethernet116
admin@sonic:
$ sudo ifconfig Ethernet116
Ethernet116 Link encap:Ethernet HWaddr 00:e0:ec:3c:0a:3e
inet addr:10.0.1.20 Bcast:255.255.255.255 Mask:255.255.255.254
UP BROADCAST MULTICAST MTU:9100 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Describe the results you received
ipv6 address is lost

Describe the results you expected
ipv6 address should be reserved.

Additional information you deem important (e.g. issue happens only occasionally)
cat /etc/network/interfaces | grep -A 5 Ethernet116
allow-hotplug Ethernet116
iface Ethernet116 inet static
mtu 9100
address 10.0.1.20
netmask 255.255.255.254

allow-hotplug Ethernet116
iface Ethernet116 inet6 static
mtu 9100
address 2002::1
netmask 64

ifdown/ifup work fine, if it is agreed to use those commands, I will send a PR for this.

Output of show version

(paste your output here)
@lguohan
Copy link
Contributor

lguohan commented Aug 16, 2018

@stcheng , shuotian is working on a new config db -based ip address setup. /etc/network/interfaces is going to be deprecated, please sync up with him to avoid duplicated work.

@stcheng
Copy link
Contributor

stcheng commented Aug 28, 2018

@zhenggen-xu this is due to the attribute introduced in the new kernel: keep_addr_on_down. The default value is 0, which causes the lost of the IPv6 addresses. I'll submit a pull request to change this value to 1 to retain the global IPv6 addresses. Thanks for reporting this!

@stcheng stcheng added Bug and removed Enhancement labels Aug 28, 2018
@stcheng
Copy link
Contributor

stcheng commented Aug 28, 2018

Please check below output as reference:

root@str-s6100-acs-2:/proc/sys/net/ipv6/conf/all# cat keep_addr_on_down
0
root@str-s6100-acs-2:/proc/sys/net/ipv6/conf/all# echo 1 > keep_addr_on_down
root@str-s6100-acs-2:/proc/sys/net/ipv6/conf/all# ip addr show PortChannel20
7: PortChannel20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9100 qdisc noqueue state UP group default qlen 1000
    link/ether d8:9e:f3:d6:90:e0 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.12/31 scope global PortChannel20
       valid_lft forever preferred_lft forever
    inet6 fc00::19/126 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::da9e:f3ff:fed6:90e0/64 scope link
       valid_lft forever preferred_lft forever
root@str-s6100-acs-2:/proc/sys/net/ipv6/conf/all# ifconfig PortChannel20 down
root@str-s6100-acs-2:/proc/sys/net/ipv6/conf/all# ifconfig PortChannel20 up
root@str-s6100-acs-2:/proc/sys/net/ipv6/conf/all# ip addr show PortChannel20
7: PortChannel20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9100 qdisc noqueue state UP group default qlen 1000
    link/ether d8:9e:f3:d6:90:e0 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.12/31 scope global PortChannel20
       valid_lft forever preferred_lft forever
    inet6 fc00::19/126 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::da9e:f3ff:fed6:90e0/64 scope link
       valid_lft forever preferred_lft forever

@stcheng
Copy link
Contributor

stcheng commented Aug 28, 2018

sonic-net/sonic-buildimage#1992 Please do review!

@zhenggen-xu
Copy link
Collaborator Author

Thanks, I was swamped and didn't read this on time. It should be fine to fix that on master, but for the old branches (e,g, 201807 ), we may still need fix with a different approach.

@zhenggen-xu
Copy link
Collaborator Author

I can send a PR if you think "ifdown/ifup" approach is fine for old branches.

@stcheng
Copy link
Contributor

stcheng commented Sep 11, 2018

@zhenggen-xu please do send a PR to fix the old branches! Thanks!

@stcheng stcheng closed this as completed Nov 4, 2018
mihirpat1 pushed a commit to mihirpat1/sonic-utilities that referenced this issue Sep 15, 2023
* catch Exception to avoid CMIS code crash

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* fix review comments, add more UT test

Signed-off-by: Kebo Liu <kebol@nvidia.com>

Signed-off-by: Kebo Liu <kebol@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants