Skip to content

Commit

Permalink
[baseos] Avoid disconnecting mgmt when re-cfg interfaces (#553)
Browse files Browse the repository at this point in the history
* [baseos] Avoid disconnecting mgmt when recfg interfaces

* Kill dhclient after interfaces-config
  • Loading branch information
taoyl-ms authored and lguohan committed Jun 7, 2017
1 parent 820e7aa commit e74196c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions files/image_config/interfaces/interfaces-config.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

ifdown -a -X eth0
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces
service networking restart
ifdown lo && ifup lo
ifup -a -X eth0

NEW_MGMT_IP=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["addr"]'`
NEW_MGMT_MASK=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["mask"]'`

ifconfig eth0 $NEW_MGMT_IP netmask $NEW_MGMT_MASK
[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid

0 comments on commit e74196c

Please sign in to comment.