Use vif-route-qubes.

This commit is contained in:
Rafal Wojtczuk 2010-09-06 17:24:12 +02:00
parent 31e7e96056
commit a013973806
2 changed files with 5 additions and 4 deletions

View File

@ -60,8 +60,8 @@ start()
gateway=$(/usr/bin/xenstore-read qubes_gateway)
secondary_dns=$(/usr/bin/xenstore-read qubes_secondary_dns)
if [ x$ip != x ]; then
/sbin/ifconfig eth0 $ip netmask $netmask up
/sbin/route add default gw $gateway
/sbin/ifconfig eth0 $ip netmask 255.255.255.255 up
/sbin/route add default dev eth0
echo "nameserver $gateway" > /etc/resolv.conf
echo "nameserver $secondary_dns" >> /etc/resolv.conf
fi

View File

@ -501,18 +501,19 @@ class QubesVm(object):
if verbose:
print "--> Attaching to the network backend (netvm={0})...".format(self.netvm_vm.name)
xm_cmdline = ["/usr/sbin/xm", "network-attach", self.name, "script=vif-route-qubes", "ip="+self.ip]
if self.netvm_vm.qid != 0:
if not self.netvm_vm.is_running():
print "ERROR: NetVM not running, please start it first"
self.force_shutdown()
raise QubesException ("NetVM not running")
retcode = subprocess.call (["/usr/sbin/xm", "network-attach", self.name, "backend={0}".format(self.netvm_vm.name)])
retcode = subprocess.call (xm_cmdline + ["backend={0}".format(self.netvm_vm.name)])
if retcode != 0:
self.force_shutdown()
raise OSError ("ERROR: Cannot attach to network backend!")
else:
retcode = subprocess.call (["/usr/sbin/xm", "network-attach", self.name, "backend=0"])
retcode = subprocess.call (xm_cmdline)
if retcode != 0:
self.force_shutdown()
raise OSError ("ERROR: Cannot attach to network backend!")