Use vif-route-qubes.
This commit is contained in:
parent
31e7e96056
commit
a013973806
@ -60,8 +60,8 @@ start()
|
|||||||
gateway=$(/usr/bin/xenstore-read qubes_gateway)
|
gateway=$(/usr/bin/xenstore-read qubes_gateway)
|
||||||
secondary_dns=$(/usr/bin/xenstore-read qubes_secondary_dns)
|
secondary_dns=$(/usr/bin/xenstore-read qubes_secondary_dns)
|
||||||
if [ x$ip != x ]; then
|
if [ x$ip != x ]; then
|
||||||
/sbin/ifconfig eth0 $ip netmask $netmask up
|
/sbin/ifconfig eth0 $ip netmask 255.255.255.255 up
|
||||||
/sbin/route add default gw $gateway
|
/sbin/route add default dev eth0
|
||||||
echo "nameserver $gateway" > /etc/resolv.conf
|
echo "nameserver $gateway" > /etc/resolv.conf
|
||||||
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
||||||
fi
|
fi
|
||||||
|
@ -501,18 +501,19 @@ class QubesVm(object):
|
|||||||
if verbose:
|
if verbose:
|
||||||
print "--> Attaching to the network backend (netvm={0})...".format(self.netvm_vm.name)
|
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 self.netvm_vm.qid != 0:
|
||||||
if not self.netvm_vm.is_running():
|
if not self.netvm_vm.is_running():
|
||||||
print "ERROR: NetVM not running, please start it first"
|
print "ERROR: NetVM not running, please start it first"
|
||||||
self.force_shutdown()
|
self.force_shutdown()
|
||||||
raise QubesException ("NetVM not running")
|
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:
|
if retcode != 0:
|
||||||
self.force_shutdown()
|
self.force_shutdown()
|
||||||
raise OSError ("ERROR: Cannot attach to network backend!")
|
raise OSError ("ERROR: Cannot attach to network backend!")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
retcode = subprocess.call (["/usr/sbin/xm", "network-attach", self.name, "backend=0"])
|
retcode = subprocess.call (xm_cmdline)
|
||||||
if retcode != 0:
|
if retcode != 0:
|
||||||
self.force_shutdown()
|
self.force_shutdown()
|
||||||
raise OSError ("ERROR: Cannot attach to network backend!")
|
raise OSError ("ERROR: Cannot attach to network backend!")
|
||||||
|
Loading…
Reference in New Issue
Block a user