# xen domU network problems (solved)

## slackeast

gentoo-wiki is down and I can't find a thread that helps me so I started a new one.  I followed the official gentoo howto here: http://www.gentoo.org/doc/en/xen-guide.xml Here's my problem.

I can't get my gentoo domU network to work.   The domU's net.eth0 dhcpcd timeouts.  Here's my configuration

hardware 

---------------------------------

Dell laptop with intel core2 duo

one broadcom ethernet card.

dom0

---------------------------------

xen 3.1.3

xen-tools 3.1.3

xen-sources 2.6.20-r6

/etc/conf.d/net

```

config_eth0=( "dhcp" )

dhcp_eth0="nodns nontp nonis"

```

/mnt/xen/configs/ora

```

kernel = "/mnt/xen/kernel/kernel-2.6.20-xen-r6

memory = 512

name = ora

disk = [ 'phy:/dev/vg/ora,sda1,w', 'phy:/dev/vg/ora-swap,sda2,w' ]

root = "/dev/sda1 ro"

vif = [ 'ip=192.168.1.101, vifname =veth1']

```

/etc/xen/xend-config.sxp

```

(network-script network-route)

(vif-script vif-route)

```

my iptables script

```

iptables -F

iptables -t nat -F

iptables -P INPUT ACCEPT

iptables -P OUTPUT ACCEPT

iptables -P FORWARD DROP

iptables -A INPUT -p TCP --dport ssh -j ACCEPT

iptables -A INPUT -p TCP --dport http -j ACCEPT

iptables -A INPUT -p TCP -d 0/0 --dport 0:1023 -j DROP

iptables -A INPUT -p UDP -d 0/0 --dport 0:1023 -j DROP

iptables -t nat -A POSTROUTING -d 0/0 -j MASQUERADE

```

My dom0 network works fine.  I can ping the yahoo.

here is my ifconfig for dom0

```

eth0      Link encap:Ethernet  HWaddr 00:18:8B:BD:6A:E6  

          inet addr:10.226.4.35  Bcast:10.226.7.255  Mask:255.255.252.0

          inet6 addr: fe80::218:8bff:febd:6ae6/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:92626 errors:0 dropped:0 overruns:0 frame:0

          TX packets:51474 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:30708565 (29.2 Mb)  TX bytes:5748551 (5.4 Mb)

          Interrupt:18 

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:120904 errors:0 dropped:0 overruns:0 frame:0

          TX packets:120904 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:19186816 (18.2 Mb)  TX bytes:19186816 (18.2 Mb)

veth1     Link encap:Ethernet  HWaddr 00:00:00:00:00:00  

          inet addr:10.226.4.35  Bcast:10.255.255.255  Mask:255.255.255.255

          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)

xenbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  

          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)

```

domU

-------------------------------------------

Everything boots up just fine except for my network.  

I addeed net.eth0 to default run level and emerged dhcpcd then

/etc/conf.d/net

[/code] 

config_eth0=("dhcp" )

dhcp_eth0="nodns nontp nonis"

Im using the same kernel xen-sources-2.6.20-6 but I enabled all the frontend xen drivers instead of backend.

Any help on the network would be greatly appreciated. 

ThanksLast edited by slackeast on Fri Feb 15, 2008 6:04 am; edited 1 time in total

----------

## loisl

Slackeast,

try the following for Your vif (and use bridged networking, not routed).

```
vif = [ "mac=00:11:50:00:00:50, bridge=xenbr0" ]
```

This works perfectly for me.

You may omit the mac definition, use the xenbrXYZ of Your setup.

Cheers,

Loisl

----------

## slackeast

I've tried to bridge but it brings the network down on my dom0.   When I start xend I get this message:

```
Nothing to Flush.

Waiting for peth0 to negotiate link

Error: either "local" is duplicate, or "inet6" is a garbage

```

Then I try to ping www.yahoo.com and it says:

 *Quote:*   

> ping: unknown host www.yahoo.com

 

if I try to ping yahoo's ip address i get:

 *Quote:*   

> connect: Network is unreachable

 

When I bring up my domU, the network doesn't work there either.  I tried static + dynamic ip.   

It seems like all the howtos on the xen-wiki and gentoo-wiki say I just need to configure the domu config file + /etc/xen/xend-config-sxp file and the network seems to work.   I've tried so many different permutations that I'm about to give up and try debian because it appears they have better xen support.   I would hate to do that because gentoo is by far my favorite distro.  J

----------

## sgao

Same issue here.

Worked with xen-3.1.2 and xen-sources-2.6.18-r8. Now with xen-3.2.0 and xen-sources-2.6.20-r6, network does not work on domU.

No domU config change except using newer kernel.

Simon

----------

## slackeast

that worked!

I switched to the 2.6.18-r8 xen-sources and everything works flawlessly.   So don't use the 2.6.20-xen-r8.

Thanks!

----------

## loisl

This is not an issue with xen-sources-2.6.20-r6, it is an issue with xen-3.2.0 and xen-tools-3.2.0.

I just updated to xen-3.2.0 xen-tools-3.2.0 and my networking was broken instantly. changing back to 3.1.2 without touching any config files and networking worked again.

----------

## sgao

With xen-3.2.0, the bridging device has changed from xenbr0 to eth0 for the first interface. Changing xenbr0 to eth0 in domU config file should solve network bridging problem.

So xen-sources-2.6.21 and xen-3.2.0 worked without problem.

Simon

----------

## gentleman

Hey guys,

ok and how is this to solve now? I use 3.2.0, too and have same problem here. When I start the machine without starting xend, network is working. As network-bridge-script is executed, nothing does work anymore.

 *Quote:*   

> Nothing to Flush.
> 
> Waiting for peth0 to negotiate link
> 
> Error: either "local" is duplicate, or "inet6" is a garbage.

 .

And: I am confused. Sometimes I read "network interface must not start on system startup". And in the next article I read: "network interface must be started on startup". What ist right here now?

After starting my xend I execute 

```
brctl show
```

 and get eth0 as bridgename (just as sgao said) but only interface is peth0.

All the time I am talking about Dom0, not DomU.

----------

## gentleman

ok, little correction:

after starting xend i can rund 

```
dhcpcd eth0
```

 and i have a ip address on my device. BUT: I thought eth0 was the name of my bridge. Why can I run dhcpcd on a bridge??

I am far away from being expert on this issue, but would like to learn s.th. What is happening here?

----------

## loisl

 *gentleman wrote:*   

> BUT: I thought eth0 was the name of my bridge. Why can I run dhcpcd on a bridge??
> 
> I am far away from being expert on this issue, but would like to learn s.th. What is happening here?

 

An Ethernet bridge is a device which connects multiple Ethernet's (the buses) to a single broadcast domain. When a bridge receives an Ethernet frame on a given port, it learns the source MAC address of this frame and places it combined with the port identifier into it's MAC address table. Then it looks up the destination MAC address of the frame and makes a forwarding decision based on the destination MAC address.

There are three cases to distinguish depending on the destination MAC address:

It finds a match of the destination MAC address in the MAC table

The Frame will be forwarded via the port listed in the MAC table

It finds no match of the destination MAC address in the MAC table

The Frame will be forwarded (flooded) via all ports connected to the bridge

The destination MAC address is a multicast or a broadcast address

The Frame will be forwarded (flooded) via all ports connected to the bridge

MAC addresses not used for forwarding in the MAC address table for a to be configured period of time will be dropped off the table and may be relearned if required.

There is no reason a bridge could not have an IP address (e.g. for management reasons, whatsoever). When You configure a DHCP request for Your bridge, it sends a via all connected ports an Ethernet broadcast message in order to get an IP address. As source MAC it uses the MAC addresses of the  Ethernet port where the broadcast frame leaves the bridge when You do not configure a unique MAC address for the bridge itself. If there are more than one DHCP-Servers connected to the bridge, the first answer to the DHCP request will succeed.

Now to Xen:

I got bored with the network bridge issues and behavior changes with each Xen upgrade. So I made use of Gentoos Baselayout capabilities for setting up the bridge where i connect my DomUs

In my special case I have a dedicated Ethernet Port on my Server which is only connected to the DMZ port of my Router, so I do not need an IP address for it on the Dom0.

/etc/conf.d/net

```
config_eth0=( "null" )

bridge_xenbr0="eth0"

config_xenbr0=( "null" )

RC_NEED_xenbr0="net.eth0"

```

In order to get the bridge up a link of /etc/init.d/net.xenbr0 pointing to /etc/init.d/net.lo is required as well.

The Network part of my /etc/xen/xend-config.sxp reads

```
(network-script /bin/true )

(vif-script 'vif-bridge bridge=xenbr0')

```

I have found this somewhere here in the forums

----------

## Parmenides

any news on this?

I have the same problem that when I try to start xend (Xen 3.2 and tools 3.2)

I get 

Error: either "local" is duplicate, or "inet6" is a garbage

----------

## guni

 *Parmenides wrote:*   

> any news on this?
> 
> I have the same problem that when I try to start xend (Xen 3.2 and tools 3.2)
> 
> I get 
> ...

 

The error is produced by /etc/xen/scripts/network-bridge.

Change on line 93:

```

addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e "s/$1//"`

```

into

```

addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e "s/$1//" | head -n1`

```

In other words: add | head -n1.

This way you just use the first line of the output, which is needed for the do_ifup().

----------

## Parmenides

many thanks ist working now.

would be fine if this fix could be deployed also from emerge  :Smile: 

----------

## plek

I got caught by this one too (has taken me 2 hours to work it out... never liked dealing with network bridges)

It appears there's a bug in bugzilla (https://bugs.gentoo.org/show_bug.cgi?id=210555) with a slightly different fix. Both effectively do the same thing though.

----------

## jcs32

I had the same problem, just want to note that starting xend before eth0 was the trivial solution for me, although less elegant/general that the one proposed here. May be the reason why the gentoo/xen wiki page states network interfaces should not be automatically started. Just remembered this as it used to work and just stopped without any updates.

----------

