I have one IP address (ipv4) and I am trying to install a domU (debian stable) on a dom0 which runs the latest xen 4.4.1 on debian testing.

I have created xenbr0 bridge and it is mapped to my eth0.

My domU can be started using xl create my.cfg and the installer (using the debian installer with initrd.gz and vmlinuz) starts. Then auto network config tries to obtain an ip via dhcp in my domU but the networking fails cause I do not have a dhcp server.

How can I manually set my domU to connect to the outside (wild internet) via the xenbr0 so that I can do a network install?

Thanks for any pointers.

update: .cfg

Nothing special there really

kernel = "/tmp/vmlinuz"
ramdisk = "/tmp/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0"
vcpus = 4
memory = 2048
name = "debianvm"
vif = ['bridge=xenbr0']
disk = ['phy:/dev/vg0/debianvm,xvda,w']
  • Please post your my.cfg. – Gene Oct 7 '14 at 21:02
  • Added my.cfg file – mahatmanich Oct 7 '14 at 22:07

You can setup NAT for your VM manually for example like this:

  1. Create another bridge: brctl addbr xenbr1

  2. Add it to your VM: bridge=xenbr1

  3. Bring the bridge UP with some network, for example ifconfig xenbr1 up
  4. Setup a DHCP server and configuration for your network

    subnet netmask { range; option routers; default-lease-time 600; max-lease-time 7200; }

    And bind DHCP to your bridge xenbr1. But you can skip this step. You'll just need to specify a static IP inside your installer.

  5. Add a SNAT rule, for example: iptables -t nat -A POSTROUTING -s -j SNAT --to-source ...

  6. Allow forwarding net.ipv4.conf.all.forwarding = 1

After that you'll have a working network in your VM. Also you can specify vif = ['bridge=xenbr1,script=vif-nat'] in your VM config (more info here http://wiki.xenproject.org/wiki/Xen_Networking). It will automate some NAT settings. But in older versions of Xen it behaved strangely. I personally like to control anything so i prefer the method i described earlier.

Hope it helps.

  • Thanks Glueon I'll try that tomorrow and let you know how things went! – mahatmanich Oct 7 '14 at 22:30
  • btw from the wiki page: The XL toolstack will never modify the network configuration and expects that the administrator will have configured the host networking appropriately. That is where I was stuck ;-) – mahatmanich Oct 7 '14 at 22:34
  • Where would I setup 4. if I wanted to do that out of curiosity? – mahatmanich Oct 7 '14 at 22:37
  • 1
    Just install isc-dhcp-server in your dom0. Modify /etc/default/isc-dhcp-server setting INTERFACES=xenbr1 then add the block i gave earlier at the end of /etc/dhcp/dhcpd.conf. – Glueon Oct 7 '14 at 22:41
  • 1
    6 - yes, this works. 5 - In --to-source you should put the IP address used for outgoing connections. So that most likely is one on the eth0 – Glueon Oct 8 '14 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.