sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
728 stars 1.4k forks source link

[dhcpv6 relay] - DHCPv6 relay does not work after load json config with DHCPv6 relay configuration #9679

Closed ppikh closed 2 years ago

ppikh commented 2 years ago

Description

DHCPv6 relay does not work after load json config with DHCPv6 relay configuration

Topology used in test: DHCP client (enp66s0f0) -----access VLAN 690----- (Ethernet64) DUT (Ethernet60) ----- (enp67s0f1) DHCP server

DHCP server has IP: 6900::2/64 and can advertise IP for subnet 6900:1::/64

Steps to reproduce the issue:

  1. Configure DUT
    # Link to DHCP server
    config interface ip add Ethernet60 6900::1/64
    # Vlan and link to DHCP client
    config vlan add 690
    config interface ip add Vlan690 6900:1::1/64
    config vlan member add -u 690 Ethernet64
  2. Check VLAN: show vlan brief
  3. Apply DHCPv6 relay settings by loading json config(store jsone below in to /tmp/config.json
    {
    "DHCP_RELAY": {
        "Vlan690": {
            "dhcpv6_servers": [
                "6900::2"
            ]
        }
    },
    "VLAN": {
        "Vlan690": {
            "dhcpv6_servers": [
                "6900::2"
            ]
        }
    }
    }
    config load /tmp/config.json -y
  4. Check VLAN: show vlan brief
  5. Try to get IPv6 address from DHCP client:
    dhclient -6 enp66s0f0 -v

Describe the results you received:

DHCPv6 client can not get IP address. After apply DHCPv6 configuration DHCP relay docker did not restart but DHCPv6 relay settings can see in output for cmd: "show vlan brief"

Describe the results you expected:

After apply DHCPv6 configuration DHCPv6 client can get IPv6 address from server

Output of show version:

SONiC Software Version: SONiC.master.253-dbdce62ef_Internal
Distribution: Debian 11.2
Kernel: 5.10.0-8-2-amd64
Build commit: dbdce62ef
Build date: Tue Jan  4 20:39:14 UTC 2022
Built by: sw-r2d2-bot@r-build-sonic-ci02-241

Platform: x86_64-mlnx_msn2700-r0
HwSKU: Mellanox-SN2700
ASIC: mellanox
ASIC Count: 1
Serial Number: MT2020T04244
Model Number: MSN2700-CS2FO
Hardware Revision: A2
Uptime: 10:13:06 up  1:17,  1 user,  load average: 0.74, 1.05, 1.40

Docker images:
REPOSITORY                                         TAG                             IMAGE ID       SIZE
docker-syncd-mlnx                                  latest                          46cb7cb27c65   1.01GB
docker-syncd-mlnx                                  master.253-dbdce62ef_Internal   46cb7cb27c65   1.01GB
docker-platform-monitor                            latest                          bf0d3b324f90   810MB
docker-platform-monitor                            master.253-dbdce62ef_Internal   bf0d3b324f90   810MB
urm.nvidia.com/sw-nbu-sws-sonic-docker/sonic-wjh   1.0.0-master-internal-21        4200ee0c4d1c   467MB
docker-teamd                                       latest                          6eb7e9deb6c5   438MB
docker-teamd                                       master.253-dbdce62ef_Internal   6eb7e9deb6c5   438MB
docker-sflow                                       latest                          cca0a6bacbc1   439MB
docker-sflow                                       master.253-dbdce62ef_Internal   cca0a6bacbc1   439MB
docker-orchagent                                   latest                          6a0813492654   458MB
docker-orchagent                                   master.253-dbdce62ef_Internal   6a0813492654   458MB
docker-nat                                         latest                          d929afd91b99   441MB
docker-nat                                         master.253-dbdce62ef_Internal   d929afd91b99   441MB
docker-macsec                                      latest                          dcbc568ccec6   441MB
docker-macsec                                      master.253-dbdce62ef_Internal   dcbc568ccec6   441MB
docker-fpm-frr                                     latest                          72dd6b2bbabd   457MB
docker-fpm-frr                                     master.253-dbdce62ef_Internal   72dd6b2bbabd   457MB
docker-dhcp-relay                                  latest                          c646bc83cc8c   436MB
docker-sonic-telemetry                             latest                          606f26ae194f   511MB
docker-sonic-telemetry                             master.253-dbdce62ef_Internal   606f26ae194f   511MB
docker-sonic-mgmt-framework                        latest                          7c86fd946748   578MB
docker-sonic-mgmt-framework                        master.253-dbdce62ef_Internal   7c86fd946748   578MB
docker-snmp                                        latest                          546605aaf36c   465MB
docker-snmp                                        master.253-dbdce62ef_Internal   546605aaf36c   465MB
docker-router-advertiser                           latest                          dafc3d1fb775   423MB
docker-router-advertiser                           master.253-dbdce62ef_Internal   dafc3d1fb775   423MB
docker-mux                                         latest                          b68969e05d75   475MB
docker-mux                                         master.253-dbdce62ef_Internal   b68969e05d75   475MB
docker-lldp                                        latest                          85f1ea2eb1a0   463MB
docker-lldp                                        master.253-dbdce62ef_Internal   85f1ea2eb1a0   463MB
docker-database                                    latest                          89d24c1c4f64   423MB
docker-database                                    master.253-dbdce62ef_Internal   89d24c1c4f64   423MB

Output of show techsupport:

Can not attach techsupport, in my case it usually more than 25mb(also in case when do --since 10m). Issue can be reproduced with 100% probability by my scenario.

Additional information you deem important (e.g. issue happens only occasionally):

If do:

config save -y
config reload -y

Then wait until all ifaces UP and try to get IPv6 address from DHCPv6 client - address can be obtained successfully.

yxieca commented 2 years ago

Summary: Newly added configuration is not picked up immediately. And dhcp relay docker restart doesn't pick it up either. A full config reload will pick it up.

@kellyyeh is the configuration format correct? Do we need to add dhcp relay config to the vlan config instead of a separate configuration?

kellyyeh commented 2 years ago

@yxieca The configuration format is correct. We want dhcp6relay configuration in DHCP_RELAY, configuration in VLAN config will not be picked up by dhcp6relay.

kellyyeh commented 2 years ago

@ppikh You can use command "show dhcprelay_helper ipv6" to check if dhcpv6 server ip are added to dhcp6relay configuration. Restarting dhcp relay service is needed after changing dhcp6relay configuration.

ppikh commented 2 years ago

Hi @kellyyeh Command "show dhcprelay_helper ipv6" shows that DHCP servers IPs are added to DHCP relay configuration. But if restart dhcp relay server - dhcp relay still does not work. Which command should we use for restart dhcp relay service without "config reload -y"?

kellyyeh commented 2 years ago

Hi @ppikh "config reload -y" is required to change configuration for dhcp6relay. We will add implementation to allow in time config change for dhcp6relay in the near future.

kellyyeh commented 2 years ago

Hi @ppikh "config reload -y" is required to change configuration for dhcp6relay. We will add implementation to allow in time config change for dhcp6relay in the near future.

Hi @ppikh, to correct and add on to this, one way to change dhcp6relay server IP is to make in memory change. You can use sonic-db-cli to change dhcpv6 server addresses in DHCP_RELAY table, then restart dhcp_relay service and the changes should take it effect.

ppikh commented 2 years ago

Hi @kellyyeh

I tried sonic-db-cli using next scenario:

sonic-db-cli CONFIG_DB HSET "DHCP_RELAY|Vlan690" "dhcpv6_servers" "6900::2"
config save -y

Then I checked that DHCP settings applied:

root@r-spider-05:/home/admin# sonic-db-cli CONFIG_DB HGETALL "DHCP_RELAY|Vlan690"
{'dhcpv6_servers': '6900::2'}
and via: show dhcprelay_helper ipv6

Then I did restart for DHCP relay service:

systemctl restart dhcp_relay.service 

Then tried to get IPv6 address from DHCPv6 client - but it was not successful. Packet was not forwarded to DHCP server. It looks like DHCP relay service not running.

root@r-spider-05:/home/admin# show services
dhcp_relay  docker
---------------------------
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  2.1  0.2  32288 23748 pts/0    Ss+  10:31   0:00 /usr/bin/python3 /usr/local/bin/supervisord
root          14  1.0  0.2  27648 18900 pts/0    S    10:31   0:00 python3 /usr/bin/supervisor-proc-exit-listener --container-name dhcp_relay
root          17  0.0  0.0 225860  3636 pts/0    Sl   10:31   0:00 /usr/sbin/rsyslogd -n -iNONE

Please check from your side, or provide me step by step scenario(if I'm doing something wrong). Thanks

kellyyeh commented 2 years ago

Hi @ppikh which image are you running these commands on?