This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
sonic-buildimage/files/image_config/interfaces/interfaces-config.sh
zhenggen-xu 19c1ad36a5
[201811] [interfaces-config.sh] Flush the loopback interface addresses (#4234)
* [interfaces-config.sh] 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>
2020-03-09 16:14:59 -07:00

26 lines
684 B
Bash
Executable File

#!/bin/bash
ifdown --force eth0
sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces
# Add usb0 interface for bfn platforms
platform=$(sonic-cfggen -H -v 'DEVICE_METADATA["localhost"]["platform"]')
if [[ "$platform" == "x86_64-accton_wedge100bf_32x-r0" || "$platform" == "x86_64-accton_wedge100bf_65x-r0" ]]; then
cat <<'EOF' >> /etc/network/interfaces
# BMC interface
auto usb0
allow-hotplug usb0
iface usb0 inet6 auto
up ifconfig usb0 txqueuelen 64
EOF
fi
[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid
systemctl restart networking
ifdown --force lo
ip addr flush dev lo
ifup lo