diff --git a/files/dhcp/dhclient.conf.j2 b/files/dhcp/dhclient.conf.j2 index 2a6f6fa84fbd..07c61ea23b74 100644 --- a/files/dhcp/dhclient.conf.j2 +++ b/files/dhcp/dhclient.conf.j2 @@ -28,6 +28,7 @@ option provisioning-script-url code 239 = text; option dhcp6.user-class code 15 = text; option dhcp6.provisioning-script-url code 239 = text; option dhcp6.boot-file-url code 59 = text; +option vendor-class code 60 = text; send host-name = gethostname(); request subnet-mask, broadcast-address, time-offset, routers, @@ -40,6 +41,8 @@ request subnet-mask, broadcast-address, time-offset, routers, {% if ZTP is defined and ZTP_DHCP_DISABLED is not defined %} send user-class "SONiC-ZTP"; send dhcp6.user-class "SONiC-ZTP"; -send dhcp-client-identifier "SONiC##{{ ZTP['mode']['product-name'] }}##{{ ZTP['mode']['serial-no'] }}"; +send dhcp-client-identifier "\x00SONiC##{{ ZTP['mode']['product-name'] }}##{{ ZTP['mode']['serial-no'] }}"; retry 60; {% endif %} + +send vendor-class "{{VENDOR_NAME}}:{{PRODUCT_NAME}}"; \ No newline at end of file diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 669d12849f10..c8fd60599223 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -63,14 +63,15 @@ else echo "{ \"ZTP_DHCP_DISABLED\" : \"true\" }" > /tmp/ztp_input.json fi +VENDOR_NAME=$(decode-syseeprom -v | tr -dc '[[:print:]]') +PRODUCT_NAME=$(decode-syseeprom -p | tr -dc '[[:print:]]') # Create /e/n/i file for existing and active interfaces, dhcp6 sytcl.conf and dhclient.conf -CFGGEN_PARAMS=" \ +sonic-cfggen -a "{\"VENDOR_NAME\": \"${VENDOR_NAME}\", \ + \"PRODUCT_NAME\":\"{$PRODUCT_NAME}\"}" \ -d -j /tmp/ztp_input.json \ -t /usr/share/sonic/templates/interfaces.j2,/etc/network/interfaces \ -t /usr/share/sonic/templates/90-dhcp6-systcl.conf.j2,/etc/sysctl.d/90-dhcp6-systcl.conf \ - -t /usr/share/sonic/templates/dhclient.conf.j2,/etc/dhcp/dhclient.conf \ -" -sonic-cfggen $CFGGEN_PARAMS + -t /usr/share/sonic/templates/dhclient.conf.j2,/etc/dhcp/dhclient.conf [[ -f /var/run/dhclient.eth0.pid ]] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid [[ -f /var/run/dhclient6.eth0.pid ]] && kill `cat /var/run/dhclient6.eth0.pid` && rm -f /var/run/dhclient6.eth0.pid