Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion files/dhcp/dhclient.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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}}";
9 changes: 5 additions & 4 deletions files/image_config/interfaces/interfaces-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading