LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Network not working in Xen guest (https://www.linuxquestions.org/questions/linux-software-2/network-not-working-in-xen-guest-736201/)

Marel 06-28-2009 09:34 AM

Network not working in Xen guest
 
Please help me because it is very important to me and I have no experience with Xen.

I setup Xen guest at my home computer following this tutorial:

http://www.howtoforge.com/virtualiza...an-lenny-amd64

In vm, network does not work. I tried with type=ioemu but no success and then I get messages like this

kernel:[10703.223592] unregister_netdevice: waiting for vif3.0 to become free. Usage count = 3

Host is 192.168.0.2 and network is working properly on it. Guest is 192.168.1.11, gateway 192.168.1.1. I tried to change guest to 192.168.0.11, gateway 192.168.0.2, then 192.168.0.1 with no success.

Here are some information:

*** ON HOST ***

Code:

main:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:44:4c:11:a0:a5 
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::2a6:f0ff:fe77:3d98/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8586 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8906 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6046823 (5.7 MiB)  TX bytes:1354523 (1.2 MiB)

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:4838107 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4838107 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:65312689737 (60.8 GiB)  TX bytes:65312689737 (60.8 GiB)

peth0    Link encap:Ethernet  HWaddr 00:44:4c:11:a0:a5 
          inet6 addr: fe80::2a6:f0ff:fe77:3d98/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:8489 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9061 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6165252 (5.8 MiB)  TX bytes:1383901 (1.3 MiB)
          Interrupt:16 Base address:0x8000

vif6.0    Link encap:Ethernet  HWaddr fe:ff:ff:ff:ff:ff 
          inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:54 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:9 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:1728 (1.6 KiB)  TX bytes:1692 (1.6 KiB)

main:~# route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.0.0    0.0.0.0        255.255.255.0  U    0      0        0 eth0
0.0.0.0        192.168.0.1    0.0.0.0        UG    0      0        0 eth0

main:~# iptables -vn -L FORWARD
Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target    prot opt in    out    source              destination       
    0    0 ACCEPT    all  --  *      *      0.0.0.0/0            0.0.0.0/0          PHYSDEV match --physdev-in eth0 ! --physdev-out eth0
    0    0 ACCEPT    all  --  *      *      0.0.0.0/0            0.0.0.0/0          PHYSDEV match ! --physdev-in eth0 --physdev-out eth0
    0    0 ACCEPT    all  --  *      *      192.168.1.11        0.0.0.0/0          PHYSDEV match --physdev-in vif6.0
    0    0 ACCEPT    udp  --  *      *      0.0.0.0/0            0.0.0.0/0          PHYSDEV match --physdev-in vif6.0 udp spt:68 dpt:67

main:~# cat /proc/sys/net/ipv4/ip_forward
1

main:~# cat /etc/xen/peca.cfg | grep -v ^#
kernel      = '/boot/vmlinuz-2.6.26-2-xen-amd64'
ramdisk    = '/boot/initrd.img-2.6.26-2-xen-amd64'
memory      = '512'

root        = '/dev/xvda2 ro'
disk        = [
                  'file:/home/xen/domains/peca/swap.img,xvda1,w',
                  'file:/home/xen/domains/peca/disk.img,xvda2,w',
              ]

name        = 'peca'

vif        = [ 'ip=192.168.1.11,mac=00:16:3E:C4:F5:63,bridge=xenbr0' ]

on_poweroff = 'destroy'
on_reboot  = 'restart'
on_crash    = 'restart'

vcpus = '2'

main:~# cat /etc/xen/xend-config.sxp | grep -v ^# | grep -v ^\ *$
(network-script network-bridge)
(vif-script vif-bridge)
(dom0-min-mem 196)
(dom0-cpus 0)
(vncpasswd '')

main:/mnt/bkp/debian# apt-get update
Hit http://ftp2.de.debian.org lenny Release.gpg
Ign http://ftp2.de.debian.org lenny/main Translation-en_US
Get:1 http://volatile.debian.org lenny/volatile Release.gpg [189B]
Ign http://ftp2.de.debian.org lenny/contrib Translation-en_US
Ign http://ftp2.de.debian.org lenny/non-free Translation-en_US
Ign http://volatile.debian.org lenny/volatile/main Translation-en_US
Hit http://ftp2.de.debian.org lenny Release
Ign http://volatile.debian.org lenny/volatile/contrib Translation-en_US
Ign http://volatile.debian.org lenny/volatile/non-free Translation-en_US
Get:2 http://debian-multimedia.org lenny Release.gpg [197B]
Hit http://debian-multimedia.org lenny/main Translation-en_US
Get:3 http://www.backports.org lenny-backports Release.gpg [189B]
Ign http://www.backports.org lenny-backports/main Translation-en_US
Get:4 http://volatile.debian.org lenny/volatile Release [40.7kB]
Ign http://ftp2.de.debian.org lenny/main Packages/DiffIndex
Ign http://www.backports.org lenny-backports/contrib Translation-en_US
Ign http://www.backports.org lenny-backports/non-free Translation-en_US
Get:5 http://debian-multimedia.org lenny Release [11.5kB]
Get:6 http://www.backports.org lenny-backports Release [56.1kB]
Ign http://ftp2.de.debian.org lenny/contrib Packages/DiffIndex
Ign http://ftp2.de.debian.org lenny/non-free Packages/DiffIndex
Ign http://ftp2.de.debian.org lenny/main Sources/DiffIndex
Ign http://ftp2.de.debian.org lenny/contrib Sources/DiffIndex
Ign http://ftp2.de.debian.org lenny/non-free Sources/DiffIndex
Hit http://ftp2.de.debian.org lenny/main Packages
Hit http://debian-multimedia.org lenny/main Packages/DiffIndex
Hit http://ftp2.de.debian.org lenny/contrib Packages
Hit http://ftp2.de.debian.org lenny/non-free Packages
Ign http://volatile.debian.org lenny/volatile/main Packages/DiffIndex
Hit http://ftp2.de.debian.org lenny/main Sources
Hit http://debian-multimedia.org lenny/main Sources/DiffIndex
Ign http://volatile.debian.org lenny/volatile/contrib Packages/DiffIndex
Ign http://volatile.debian.org lenny/volatile/non-free Packages/DiffIndex
Ign http://volatile.debian.org lenny/volatile/main Sources/DiffIndex
Ign http://volatile.debian.org lenny/volatile/contrib Sources/DiffIndex
Ign http://volatile.debian.org lenny/volatile/non-free Sources/DiffIndex
Hit http://ftp2.de.debian.org lenny/contrib Sources
Hit http://ftp2.de.debian.org lenny/non-free Sources
Hit http://volatile.debian.org lenny/volatile/main Packages
Hit http://volatile.debian.org lenny/volatile/contrib Packages
Hit http://volatile.debian.org lenny/volatile/non-free Packages
Ign http://www.backports.org lenny-backports/main Packages/DiffIndex
Hit http://volatile.debian.org lenny/volatile/main Sources
Hit http://volatile.debian.org lenny/volatile/contrib Sources
Hit http://volatile.debian.org lenny/volatile/non-free Sources
Ign http://www.backports.org lenny-backports/contrib Packages/DiffIndex
Ign http://www.backports.org lenny-backports/non-free Packages/DiffIndex
Get:7 http://www.backports.org lenny-backports/main Packages [117kB]
Hit http://www.backports.org lenny-backports/contrib Packages
Hit http://www.backports.org lenny-backports/non-free Packages
Get:8 http://security.debian.org lenny/updates Release.gpg [1032B]
Ign http://security.debian.org lenny/updates/main Translation-en_US
Ign http://security.debian.org lenny/updates/contrib Translation-en_US
Ign http://security.debian.org lenny/updates/non-free Translation-en_US
Get:9 http://security.debian.org lenny/updates Release [40.8kB]
Ign http://security.debian.org lenny/updates/main Packages/DiffIndex
Ign http://security.debian.org lenny/updates/contrib Packages/DiffIndex
Ign http://security.debian.org lenny/updates/non-free Packages/DiffIndex
Ign http://security.debian.org lenny/updates/main Sources/DiffIndex
Ign http://security.debian.org lenny/updates/contrib Sources/DiffIndex
Ign http://security.debian.org lenny/updates/non-free Sources/DiffIndex
Hit http://security.debian.org lenny/updates/main Packages
Hit http://security.debian.org lenny/updates/contrib Packages
Hit http://security.debian.org lenny/updates/non-free Packages
Hit http://security.debian.org lenny/updates/main Sources
Hit http://security.debian.org lenny/updates/contrib Sources
Hit http://security.debian.org lenny/updates/non-free Sources
Fetched 268kB in 8s (31.3kB/s)
Reading package lists... Done

main:/etc# grep -v ^# /etc/xen-tools/xen-tools.conf | grep -v "^\ *$"
dir = /home/xen
install-method = debootstrap
size  = 6Gb      # Disk image size.
memory = 512Mb    # Memory size
swap  = 1024Mb    # Swap size
fs    = ext3    # use the EXT3 filesystem for the disk image.
dist  = lenny    # Default distribution to install.
image  = sparse  # Specify sparse vs. full disk images.
gateway  = 192.168.1.1
netmask  = 255.255.255.0
broadcast = 192.168.1.255
passwd = 1
kernel      = /boot/vmlinuz-`uname -r`
initrd      = /boot/initrd.img-`uname -r`
mirror = http://ftp2.de.debian.org/debian/
ext3_options  = noatime,nodiratime,errors=remount-ro
ext2_options  = noatime,nodiratime,errors=remount-ro
xfs_options    = defaults
reiser_options = defaults
serial_device = hvc0 #default
disk_device = xvda #default


*** ON GUEST ***

Code:

peca:~# apt-get update
Err http://ftp2.de.debian.org lenny Release.gpg                         
  Temporary failure resolving 'ftp2.de.debian.org'
Err http://security.debian.org lenny/updates Release.gpg               
  Temporary failure resolving 'security.debian.org'
Reading package lists... Done                                           
W: Failed to fetch http://ftp2.de.debian.org/debian/dists/lenny/Release.gpg  Temporary failure resolving 'ftp2.de.debian.org'

W: Failed to fetch http://security.debian.org/dists/lenny/updates/Release.gpg  Temporary failure resolving 'security.debian.org'

W: Some index files failed to download, they have been ignored, or old ones used instead.
W: You may want to run apt-get update to correct these problems

peca:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:3e:c4:f5:63 
          inet addr:192.168.1.11  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3eff:fec4:f563/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1692 (1.6 KiB)  TX bytes:2484 (2.4 KiB)

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:32 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2960 (2.8 KiB)  TX bytes:2960 (2.8 KiB)

peca:~# route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.0    0.0.0.0        255.255.255.0  U    0      0        0 eth0
0.0.0.0        192.168.1.1    0.0.0.0        UG    0      0        0 eth0

peca:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
 address 192.168.1.11
 gateway 192.168.1.1
 netmask 255.255.255.0
  broadcast 192.168.1.255


bhaslinux 06-29-2009 05:18 AM

Hi,

Your main network is 192.168.0.X/24
So your gateway to other machines will work fine on 192.168.0.X networked systems.
The problem with the Xen machines is they need a method to go out of the Xen box to see the outside world.
This will depend on the bridge config you want. The second method you have used (assigning IP 192.168.0.11)
must be the easiest things to make things work.
Give us the ouptut of the following command in your host system.

# brctl show

this will give us information on the bridge config in your host machine

Marel 06-29-2009 10:21 AM

Hi, bhaslinux and thanks for the reply.

I tried to regenerate image file with net parameters

ip=192.168.0.11
gw=192.168.0.1 (same as on host)
netmask = 255.255.255.0
broadcast = 192.168.0.255

# xen-create-image --hostname=peca --size=6Gb --swap=512Mb --ip=192.168.0.11 --memory=512Mb --arch=amd64 --role=udev

but still the same.

I followed that tutorial http://www.howtoforge.com/virtualiza...an-lenny-amd64 and don't know why it isn't working. In other tutorials is the same. I didn't see any bug reports that could explain this.

So I would appreciate some help.

Code:

main:/etc/xen# brctl show
bridge name        bridge id                STP enabled        interfaces
eth0                8000.00739d3ea691        no                peth0
                                                        vif3.0

With guest down:

Code:

main:/etc/xen# brctl show
bridge name        bridge id                STP enabled        interfaces
eth0                8000.00739d3ea691        no                peth0


bhaslinux 06-30-2009 03:35 AM

your bridge given in Xen config is xenbr0 whereas in your system the bridge is eth0. Can you change the
xen config vif as
vif = [ 'ip=192.168.1.11,mac=00:16:3E:C4:F5:63,bridge=eth0' ]

And try...

Marel 06-30-2009 06:31 PM

This didn't help, but thanks anyway.

I solved this problem by clearing and changing policy of forward chain:

iptables -F FORWARD
iptables -P FORWARD ACCEPT

Somehow, it works with both eth0 and xenbr0 as bridge in /etc/xen/peca.cfg.


All times are GMT -5. The time now is 05:05 PM.