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

[201811] [interfaces-config.sh] Flush the loopback interface addresses #4234

Merged
merged 2 commits into from
Mar 9, 2020

Conversation

zhenggen-xu
Copy link
Collaborator

Flush the loopback interface before configure it

Without this, you may end up with more and more ip addresses
on loopback interface after you change the loopback ip and do config reload

Signed-off-by: Zhenggen Xu zxu@linkedin.com

- What I did
Flush the loopback interface before configure it

- How I did it
Flush the loopback interface before configure it

- How to verify it

config_db-1.json:

    "LOOPBACK_INTERFACE": {
        "Loopback0|2000::1/128": {
            "family": "IPv6",
            "scope": "global"
        },

        "Loopback0|10.10.10.1/32": {
            "family": "IPv4",
            "scope": "global"
        }
    },

config_db-2.json

    "LOOPBACK_INTERFACE": {
        "Loopback0|2000::2/128": {
            "family": "IPv6",
            "scope": "global"
        },
        "Loopback0|10.10.10.2/32": {
            "family": "IPv4",
            "scope": "global"
        }
    },

After sudo config reload config_db-1.json:

admin@sonic:~$ ip addr show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 10.10.10.1/32 brd 10.10.10.1 scope global lo
       valid_lft forever preferred_lft forever
    inet6 2000::1/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

Before the fix:

config reload config_db-2.json after config_db-1.json:

admin@sonic:~$ ip addr show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 10.10.10.1/32 brd 10.10.10.1 scope global lo
       valid_lft forever preferred_lft forever
    inet 10.10.10.2/32 brd 10.10.10.2 scope global lo
       valid_lft forever preferred_lft forever
    inet6 2000::2/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 2000::1/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

After fix:

config reload config_db-2.json after config_db-1.json:

admin@sonic:~$ ip addr show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 10.10.10.2/32 brd 10.10.10.2 scope global lo
       valid_lft forever preferred_lft forever
    inet6 2000::2/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@lguohan lguohan requested review from jleveque and prsunny March 8, 2020 22:53
Without this, you may end up with more and more ip addresses
on loopback interface after you change the loopback ip and do config reload

Signed-off-by: Zhenggen Xu <zxu@linkedin.com>
Signed-off-by: Zhenggen Xu <zxu@linkedin.com>
@zhenggen-xu zhenggen-xu changed the title Flush the loopback interface before configure it [201811] [interfaces-config.sh] Flush the loopback interface before configure it Mar 9, 2020
@zhenggen-xu zhenggen-xu changed the title [201811] [interfaces-config.sh] Flush the loopback interface before configure it [201811] [interfaces-config.sh] Flush the loopback interface addresses Mar 9, 2020
@lguohan lguohan merged commit 19c1ad3 into sonic-net:201811 Mar 9, 2020
@zhenggen-xu zhenggen-xu deleted the 201811-fix-lo-ip branch May 24, 2024 19:07
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.

4 participants