Changed network addresses to 10.137.0.0/16 (#73)

Also limit qid to 254 - should be enough and fits in one byte (in IP address)
This commit is contained in:
Marek Marczykowski 2011-03-27 12:28:13 +02:00
parent 14f0141214
commit 0d52b037f1
3 changed files with 12 additions and 13 deletions

View File

@ -30,8 +30,8 @@ start()
elif [ $NETVM = "dom0" ] ; then
echo -n $"Setting up net backend in Dom0:"
echo "NS1=10.0.0.1" > /var/run/qubes/qubes_ns
echo "NS2=10.0.255.254" >> /var/run/qubes/qubes_ns
echo "NS1=10.137.0.1" > /var/run/qubes/qubes_ns
echo "NS2=10.137.255.254" >> /var/run/qubes/qubes_ns
/usr/lib/qubes/qubes_setup_dnat_to_ns
echo "1" > /proc/sys/net/ipv4/ip_forward || exit 1
else

View File

@ -54,9 +54,9 @@ qubes_templates_dir = qubes_base_dir + "/vm-templates"
qubes_servicevms_dir = qubes_base_dir + "/servicevms"
qubes_store_filename = qubes_base_dir + "/qubes.xml"
qubes_max_qid = 254*254
qubes_max_qid = 254
qubes_max_netid = 254
vm_default_netmask = "255.255.0.0"
vm_default_netmask = "255.255.255.0"
default_root_img = "root.img"
default_rootcow_img = "root-cow.img"
@ -1135,11 +1135,11 @@ class QubesNetVm(QubesCowVm):
def __init__(self, **kwargs):
netid = kwargs.pop("netid")
self.netid = netid
self.__network = "10.{0}.0.0".format(netid)
self.netprefix = "10.{0}.".format(netid)
self.__network = "10.137.{0}.0".format(netid)
self.netprefix = "10.137.{0}.".format(netid)
self.__netmask = vm_default_netmask
self.__gateway = self.netprefix + "0.1"
self.__secondary_dns = self.netprefix + "255.254"
self.__gateway = self.netprefix + "1"
self.__secondary_dns = self.netprefix + "254"
if "dir_path" not in kwargs or kwargs["dir_path"] is None:
kwargs["dir_path"] = qubes_servicevms_dir + "/" + kwargs["name"]
@ -1173,10 +1173,9 @@ class QubesNetVm(QubesCowVm):
return self.__network
def get_ip_for_vm(self, qid):
hi = qid / 253
lo = qid % 253 + 2
assert hi >= 0 and hi <= 254 and lo >= 2 and lo <= 254, "Wrong IP address for VM"
return self.netprefix + "{0}.{1}".format(hi,lo)
assert lo >= 2 and lo <= 254, "Wrong IP address for VM"
return self.netprefix + "{0}".format(lo)
def create_xenstore_entries(self, xid):
if dry_run:

View File

@ -52,7 +52,7 @@ def bringup_eth0(netvm):
resolv_conf.write('nameserver ' + netvm.gateway + '\n')
resolv_conf.write('nameserver ' + netvm.secondary_dns + '\n')
resolv_conf.close()
return os.system('ifconfig eth0 10.0.0.1 netmask 255.255.255.255 && route add default dev eth0') == 0
return os.system('ifconfig eth0 10.137.0.1 netmask 255.255.255.255 && route add default dev eth0') == 0
def unpause_all(netvm_name):
os.system('qvm-run --exclude=' + netvm_name + ' --all --unpause')
@ -62,7 +62,7 @@ def netup():
if os.path.isfile('/var/lock/subsys/NetworkManager'):
os.system('/etc/init.d/NetworkManager stop')
if not vif_eth0_exists():
cmd = 'modprobe xennet && xm network-attach 0 ip=10.0.0.1 backend='
cmd = 'modprobe xennet && xm network-attach 0 ip=10.137.0.1 backend='
cmd += netvm.name
cmd += ' script=vif-route-qubes'
if os.system(cmd) != 0: