Skip to content

Commit e74196c

Browse files
taoyl-mslguohan
authored andcommitted
[baseos] Avoid disconnecting mgmt when re-cfg interfaces (#553)
* [baseos] Avoid disconnecting mgmt when recfg interfaces * Kill dhclient after interfaces-config
1 parent 820e7aa commit e74196c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/bin/bash
22

3+
ifdown -a -X eth0
34
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces
4-
service networking restart
5-
ifdown lo && ifup lo
5+
ifup -a -X eth0
6+
7+
NEW_MGMT_IP=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["addr"]'`
8+
NEW_MGMT_MASK=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["mask"]'`
9+
10+
ifconfig eth0 $NEW_MGMT_IP netmask $NEW_MGMT_MASK
11+
[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid
12+

0 commit comments

Comments
 (0)