vm: more reliably set IP address of VM

This commit is contained in:
Marek Marczykowski 2011-07-13 20:16:04 +02:00
parent 1288b7a839
commit 4da05e52d8
3 changed files with 10 additions and 11 deletions

View File

@ -50,13 +50,6 @@ start()
usleep 10
done
echo Back to life.
# Fix IP address (replace template IP with DispVM one)
IP=$(/usr/bin/xenstore-read qubes_ip 2>/dev/null)
if [ "$IP" ]; then
ip addr flush dev eth0
ip addr add dev eth0 $IP/32
ip route add dev eth0
fi
fi
MEM_CHANGE_THRESHOLD_KB=30000

View File

@ -26,6 +26,12 @@ start()
hostname $name
fi
# Set IP address again (besides action in udev rules); this is needed by
# DispVM (to override DispVM-template IP) and in case when qubes_ip was
# called by udev before loading evtchn kernel module - in which case
# xenstore-read fails
INTERFACE=eth0 /usr/lib/qubes/setup_ip
if [ -e /dev/xvdb ] ; then
mount /rw

View File

@ -1,10 +1,10 @@
#!/bin/sh
ip=`/usr/bin/xenstore-read qubes_ip`
netmask=`/usr/bin/xenstore-read qubes_netmask`
gateway=`/usr/bin/xenstore-read qubes_gateway`
secondary_dns=`/usr/bin/xenstore-read qubes_secondary_dns`
ip=`/usr/bin/xenstore-read qubes_ip 2> /dev/null`
if [ x$ip != x ]; then
netmask=`/usr/bin/xenstore-read qubes_netmask`
gateway=`/usr/bin/xenstore-read qubes_gateway`
secondary_dns=`/usr/bin/xenstore-read qubes_secondary_dns`
/sbin/ifconfig $INTERFACE $ip netmask 255.255.255.255
/sbin/ifconfig $INTERFACE up
/sbin/route add default dev $INTERFACE