[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-users] domU HVM network problem (fixed!)


  • To: xen-users@xxxxxxxxxxxxxxxxxxx
  • From: Carles Pina i Estany <carles@xxxxxxxx>
  • Date: Sun, 27 Apr 2008 19:03:08 +0200
  • Delivery-date: Sun, 27 Apr 2008 10:03:45 -0700
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

Hello,

Last month I had a problem with Xen 3.0.3 in Debian Etch. The problem
was "arp who-has not answered", and I asked here:
http://article.gmane.org/gmane.comp.emulators.xen.user/33034
http://www.nabble.com/arp-who-has-not-answered-td15988849.html

After some suggestions I was asking for the correct configuration
without success :-( . Yesterday, finally, I got the good way to do that
so let me to describe just in case it will help to somebody.

My system: Debian Etch with Debian Etch Xen. I have these packages
installed:
-------
servidor:~# dpkg -l | grep -i xen | awk '{print $2,",",$3}'
linux-headers-2.6-xen-amd64 , 2.6.18+6etch3
linux-headers-2.6.18-6-xen , 2.6.18.dfsg.1-18etch1
linux-headers-2.6.18-6-xen-amd64 , 2.6.18.dfsg.1-18etch1
linux-image-2.6-xen-amd64 , 2.6.18+6etch3
linux-image-2.6.18-6-xen-amd64 , 2.6.18.dfsg.1-18etch1
linux-modules-2.6.18-6-xen-amd64 , 2.6.18.dfsg.1-18etch1
xen-hypervisor-3.0.3-1-amd64 , 3.0.3-0-4
xen-ioemu-3.0.3-1 , 3.0.3-0-4
xen-linux-system-2.6.18-6-xen-amd64 , 2.6.18.dfsg.1-18etch1
xen-tools , 2.8-2
xen-utils-3.0.3-1 , 3.0.3-0-4
xen-utils-common , 3.0.3-0-2
-------

I wanted NAT networking configuration (after some tests using bridge).
This machine is doing NAT from one network to one external network.

Dom0 machine is using 192.168.0.1 and DomU machine will use 192.168.10.0/24
(192.168.10.1 to "link" with Dom0)

My current /etc/xen/machine.cfg file is:
-------
kernel='/usr/lib64/xen-3.0.3-1/boot/hvmloader'
builder='hvm'
device_model='/usr/lib64/xen-3.0.3-1/bin/qemu-dm'
memory=256
name='machine'
disk=['file:/home/xen/domains/machine/root,hda,w','file:/home/xen/domains/debian-etch.iso,hdc:cdrom,r']
vif = ['mac=22:16:3e:00:00:11,type=ioemu' ] #add your script=vif-nat,
#vif-nat-personal or whatever you want.
boot='c'
vncpasswd=''
stdvga=0
pae=1
acpi=1
apic=1
vnc=1 
vncviewer=1
sdl=0
-------

Before switch on the virtual machine, I need to create xenbr0 bridge (or
qemu-dm will complain and die, see on /var/log/xen/qemu-dm.log.PID where
PID is the PID of ps auxw | grep -i qemu). Feel free to add
script=personal in vif nat and then add the correct script
/etc/xen/scripts/personal.

I did it:
--------
tunctl -t tap0 -u root
ip link set up dev tap0
brctl addbr xenbr0
brctl addif xenbr0 tap0
ip link set up dev xenbr0
ip addr add 192.168.10.1/24 dev xenbr0
ip route add 192.168.10.0/24 dev xenbr0 #not needed?
brctl addif xenbr0 tap0
xm create /etc/xen/machine.hvm
--------

Final result of my networking configuration:
--------
servidor:~# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:1A:A0:D9:D5:CE  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:a0ff:fed9:d5ce/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:669957 errors:0 dropped:0 overruns:0 frame:1
          TX packets:950312 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:217565298 (207.4 MiB)  TX bytes:1132767974 (1.0 GiB)
          Interrupt:16 


eth1      Link encap:Ethernet  HWaddr 00:60:08:6D:09:DC  
          inet addr:PUBLIC IP ADD Bcast:PUBLIC IP ADD Mask:255.255.255.192
          inet6 addr: fe80::260:8ff:fe6d:9dc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:513106 errors:0 dropped:0 overruns:0 frame:0
          TX packets:595892 errors:0 dropped:0 overruns:0 carrier:0
          collisions:2485 txqueuelen:1000 
          RX bytes:160333319 (152.9 MiB)  TX bytes:462082545 (440.6 MiB)
          Interrupt:19 Base address:0xecc0 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:162878 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162878 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:798741818 (761.7 MiB)  TX bytes:798741818 (761.7 MiB)

tap0      Link encap:Ethernet  HWaddr 52:BE:57:00:3B:F9  
          inet6 addr: fe80::50be:57ff:fe00:3bf9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:64 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

tap1      Link encap:Ethernet  HWaddr B6:9D:20:EE:6C:A1  
          inet6 addr: fe80::b49d:20ff:feee:6ca1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:191 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:19253 (18.8 KiB)  TX bytes:19257 (18.8 KiB)

vif9.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.255
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

xenbr0    Link encap:Ethernet  HWaddr 52:BE:57:00:3B:F9  
          inet addr:192.168.10.1  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::50be:57ff:fe00:3bf9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5024 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7765 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:309573 (302.3 KiB)  TX bytes:11085251 (10.5 MiB)

servidor:~# brctl show
bridge name     bridge id               STP enabled     interfaces
xenbr0          8000.52be57003bf9       no              tap0
                                                        tap1
#why tap0 and tap1?!?! I'm confused here, I didn't see it before, I don't
#think that it's correct, I will do some tests soon -but I prefer to have
#physical access to that machine before change bridges and some of the
#configuration network
----------

And then I can switch on DomU and setup 192.168.10.10 as address, and gateway
192.168.10.1.

After switch on DomU, from Dom0 I can ping 192.168.10.10, and from DomU I can
ping 192.168.10.1 (good!)

Then some manual NAT rules to be able to have intenret in DomU, in my case I
have: 
---------
$IPTABLES -A FORWARD -s 192.168.10.0/24 -d 192.168.0.1 -j ACCEPT 
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED \
        -d 192.168.10.0/24 -j ACCEPT 
$IPTABLES -t nat -A POSTROUTING -o eth1 -s 192.168.10.0/24 -j MASQUERADE
---------

And that's all that I needed!

I have had some pending question writing this email (why tap0 and tap1 is in
xenbr0? i think that it's a mistake, only tap0 is needed). I hope that this
mail will be usefull for somebody. Else, I have all information.

Thanks to everybody who helped/gave some ideas, specially Max E. Baro.

-- 
Carles Pina i Estany            GPG id: 0x8CBDAE64
        http://pinux.info       Manresa - Barcelona

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.