mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-25 19:54:38 +00:00
hvtools: Fix setting the DNS server when the host reconfigures network
Busybox ifup does not modify /etc/resolv.conf Update the hv_set_ifconfig script to overwrite /etc/resolv.conf Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
b3a82885ba
commit
5d0dfdf4fa
@ -58,9 +58,6 @@
|
|||||||
# Stash away a copy of the config we got
|
# Stash away a copy of the config we got
|
||||||
cp $1 /etc/network/hv_config
|
cp $1 /etc/network/hv_config
|
||||||
|
|
||||||
# This is where we write the configuration
|
|
||||||
outf=/etc/network/interfaces
|
|
||||||
|
|
||||||
# Source it
|
# Source it
|
||||||
. $1
|
. $1
|
||||||
|
|
||||||
@ -68,6 +65,7 @@ outf=/etc/network/interfaces
|
|||||||
ifdown -f $DEVICE
|
ifdown -f $DEVICE
|
||||||
|
|
||||||
# create a new interfaces file
|
# create a new interfaces file
|
||||||
|
outf=/etc/network/interfaces
|
||||||
echo "auto lo" > $outf
|
echo "auto lo" > $outf
|
||||||
echo "iface lo inet loopback" >> $outf
|
echo "iface lo inet loopback" >> $outf
|
||||||
echo "" >> $outf
|
echo "" >> $outf
|
||||||
@ -80,10 +78,16 @@ else
|
|||||||
echo " address $IPADDR0" >> $outf
|
echo " address $IPADDR0" >> $outf
|
||||||
echo " netmask $NETMASK0" >> $outf
|
echo " netmask $NETMASK0" >> $outf
|
||||||
echo " gateway $GATEWAY" >> $outf
|
echo " gateway $GATEWAY" >> $outf
|
||||||
echo " nameserver $DNS1 $DNS2 $DNS3" >> $outf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " hwaddress ether $HWADDR" >> $outf
|
echo " hwaddress ether $HWADDR" >> $outf
|
||||||
|
|
||||||
|
# create a new resolve.conf file
|
||||||
|
outf=/etc/resolv.conf
|
||||||
|
[ -n "$DNS1" ] && echo "nameserver $DNS1" > $outf
|
||||||
|
[ -n "$DNS2" ] && echo "nameserver $DNS2" >> $outf
|
||||||
|
[ -n "$DNS3" ] && echo "nameserver $DNS3" >> $outf
|
||||||
|
[ -n "$DNS4" ] && echo "nameserver $DNS4" >> $outf
|
||||||
|
|
||||||
# Up the interface
|
# Up the interface
|
||||||
ifup $DEVICE
|
ifup $DEVICE
|
||||||
|
Loading…
Reference in New Issue
Block a user