netvm.py 770 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/python2 -O
  2. # vim: fileencoding=utf-8
  3. import qubes.vm.qubesvm
  4. class NetVM(qubes.vm.appvm.AppVM):
  5. '''Network interface VM'''
  6. netvm = qubes.property('netvm', setter=qubes.property.forbidden)
  7. def __init__(self, *args, **kwargs):
  8. super(NetVM, self).__init__(*args, **kwargs)
  9. def get_ip_for_vm(self, vm):
  10. return '10.137.{}.{}'.format(self.qid, vm.qid + 2)
  11. @property
  12. def gateway(self):
  13. return '10.137.{}.1'.format(self.qid)
  14. @property
  15. def secondary_dns(self):
  16. return '10.137.{}.254'.format(self.qid)
  17. # @property
  18. # def netmask(self):
  19. # return '255.255.255.0'
  20. #
  21. # @property
  22. # def provides_network(self):
  23. # return True
  24. netmask = '255.255.255.0'
  25. provides_network = True