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']
You can setup NAT for your VM manually for example like this:
Create another bridge:
brctl addbr xenbr1
Add it to your VM:
bridge=xenbr1
ifconfig xenbr1 192.168.0.1/24 up
Setup a DHCP server and configuration for your network
subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.10 192.168.0.50; option routers 192.168.0.1; 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.
Add a SNAT rule, for example:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source ...
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.