# VirtualBox Network woes [Solved]

## Korhul

Hi,

I set up VirtualBox on my desktop workstation with Kubuntu and Windows XP with bridged networking according to the gentoo-wiki.com. This set up worked as a charm until recent time. But now my virtual machines doesn't get leases from my router. Although I can see their requests in routers log:

```

Jan  5 20:32:07 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 169.254.188.98 08:00:27:15:0a:65

Jan  5 20:32:07 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65

Jan  5 20:32:08 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 169.254.188.98 08:00:27:15:0a:65

Jan  5 20:32:08 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65

```

But lease doesn't get back. I tried to set up network interface in the virtual machine manualy, but the network is unreachable.

Iptables on the router are set like this:

```
# Generated by iptables-save v1.3.5 on Thu Dec 27 00:36:00 2007

*raw

:PREROUTING ACCEPT [11354:3371910]

:OUTPUT ACCEPT [6439:2537184]

COMMIT

# Completed on Thu Dec 27 00:36:00 2007

# Generated by iptables-save v1.3.5 on Thu Dec 27 00:36:00 2007

*filter

:INPUT ACCEPT [0:0]

:FORWARD DROP [0:0]

:OUTPUT ACCEPT [6439:2537184]

-A INPUT -i lo -j ACCEPT

-A INPUT -i lan -j ACCEPT

-A INPUT -i wlan0 -j ACCEPT

-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

-A INPUT -i wan -p udp -m udp --dport 67 -j REJECT --reject-with icmp-port-unreachable

-A INPUT -i wan -p udp -m udp --dport 53 -j REJECT --reject-with icmp-port-unreachable

-A INPUT -p tcp -m state --state NEW -m multiport --dports 21,80,111,443,873,1194,1043,2049,2222,4001,6881,31416,32764:32767 -j ACCEPT

-A INPUT -p udp -m state --state NEW -m multiport --dports 53,67,111,873,1043,2049,2222,4001,6881,31416,32764:32767 -j ACCEPT

-A INPUT -p udp -m state --state NEW -m udp --sport 123 -j ACCEPT

-A INPUT -i ! lan -p tcp -m tcp --dport 0:1023 -j REJECT --reject-with tcp-reset

-A INPUT -i ! lan -p udp -m udp --dport 0:1023 -j REJECT --reject-with icmp-port-unreachable

-A INPUT -p tcp -j REJECT --reject-with tcp-reset

-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable

-A FORWARD -s 192.168.10.0/255.255.255.0 -i lan -j ACCEPT

-I FORWARD -d 192.168.10.0/255.255.255.0 -i lan -j DROP

-A FORWARD -d 192.168.10.0/255.255.255.0 -i wan -j ACCEPT

-A FORWARD -s 192.168.30.0/255.255.255.0 -i wlan0 -j ACCEPT

-I FORWARD -d 192.168.30.0/255.255.255.0 -i wlan0 -j DROP

-A FORWARD -d 192.168.30.0/255.255.255.0 -i wan -j ACCEPT

-A FORWARD -d 192.168.10.0/255.255.255.0 -i wlan0 -j ACCEPT

-A FORWARD -d 192.168.30.0/255.255.255.0 -i lan -j ACCEPT

-A FORWARD -d 192.168.10.0/255.255.255.0 -i tun0 -j ACCEPT

-A FORWARD -d 192.168.30.0/255.255.255.0 -i tun0 -j ACCEPT

-A FORWARD -d 10.88.254.0/255.255.255.0 -i lan -j ACCEPT

-A FORWARD -d 10.88.254.0/255.255.255.0 -i wlan0 -j ACCEPT

COMMIT

# Completed on Thu Dec 27 00:36:00 2007

# Generated by iptables-save v1.3.5 on Thu Dec 27 00:36:00 2007

*nat

:PREROUTING ACCEPT [242:15498]

:POSTROUTING ACCEPT [0:0]

:OUTPUT ACCEPT [1:76]

-A POSTROUTING -o wan -j SNAT --to 89.203.143.43

-A PREROUTING -d 192.168.10.1 -p tcp -m tcp --dport 2155 -j DNAT --to-destination 192.168.10.55:21

-A PREROUTING -d 192.168.10.1 -p tcp -m tcp --dport 2155 -j DNAT --to-destination 192.168.10.55:21

-A PREROUTING -i wan -p tcp -m tcp --dport 26000 -j DNAT --to 192.168.10.65

COMMIT

# Completed on Thu Dec 27 00:36:00 2007

# Generated by iptables-save v1.3.5 on Thu Dec 27 00:36:00 2007

*mangle

:PREROUTING ACCEPT [11353:3372361]

:INPUT ACCEPT [6908:1136320]

:FORWARD ACCEPT [4445:2236041]

:OUTPUT ACCEPT [6439:2537184]

:POSTROUTING ACCEPT [10884:4773225]

COMMIT

# Completed on Thu Dec 27 00:36:00 2007
```

I think that is not the problem. On my host machine I have no firewall at all ( :Neutral: ) and all the other machines (mostly laptops) in my network get leases as expected.

These are dmesg entries for br0 bridge and vbox0 device:

```
br0: Dropping NETIF_F_UFO since no NETIF_F_HW_CSUM feature.

br0: port 3(vbox0) entering learning state

br0: port 2(eth1) entering learning state

br0: no IPv6 routers present

br0: topology change detected, propagating

br0: port 3(vbox0) entering forwarding state

br0: topology change detected, propagating

br0: port 2(eth1) entering forwarding state
```

```
device vbox0 entered promiscuous mode

br0: port 3(vbox0) entering learning state

vbox0: no IPv6 routers present

br0: port 3(vbox0) entering forwarding state
```

and brctl show:

```

bridge name   bridge id         STP enabled   interfaces

br0         8000.001731bb41fc   no         eth0

                              eth1

                              vbox0
```

brctl showstp:

```

br0

 bridge id              8000.001731bb41fc

 designated root        8000.001731bb41fc

 root port                 0                    path cost                  0

 max age                  19.99                 bridge max age            19.99

 hello time                1.99                 bridge hello time          1.99

 forward delay            14.99                 bridge forward delay      14.99

 ageing time             299.95

 hello timer               0.77                 tcn timer                  0.00

 topology change timer     0.00                 gc timer                  12.77

 flags

eth0 (0)

 port id                0000                    state                  disabled

 designated root        8000.001731bb41fc       path cost                100

 designated bridge      8000.001731bb41fc       message age timer          0.00

 designated port        8001                    forward delay timer        0.00

 designated cost           0                    hold timer                 0.00

 flags

eth1 (0)

 port id                0000                    state                forwarding

 designated root        8000.001731bb41fc       path cost                 19

 designated bridge      8000.001731bb41fc       message age timer          0.00

 designated port        8002                    forward delay timer        0.00

 designated cost           0                    hold timer                 0.00

 flags

vbox0 (0)

 port id                0000                    state                forwarding

 designated root        8000.001731bb41fc       path cost                100

 designated bridge      8000.001731bb41fc       message age timer          0.00

 designated port        8003                    forward delay timer        0.00

 designated cost           0                    hold timer                 0.00

 flags
```

So what could that be?  :Sad: Last edited by Korhul on Tue Jan 29, 2008 11:06 pm; edited 1 time in total

----------

## gerdesj

I am sure you understand that a Kubuntu machine is not going to be easy to fix from a Gentoo forum.  I can't ask you to run revdep-rebuild  :Cool: 

That said, what has changed to make it stop working.  Have you recently updated anything (Windows update on the XP, Kubuntu packages or Virtualbox itself) ?  What is the router running and also what DHCP server software ?

I note that there is one second between the discover, offer and another discover so it appears that your XP machine is actually refusing the lease it is offered.  I'd expect it to wait longer than one second before trying again.

If you put a static IP on the XP machine, does it work OK?

Cheers

Jon

----------

## Korhul

Desktop workstation:

```
thuban ctibor # genlop -l --date 20071215 --date 20071230

 * media-sound/lilypond

     Sun Dec 16 13:14:37 2007 >>> media-sound/lilypond-2.10.33

     Sun Dec 16 14:51:23 2007 >>> sys-apps/lm_sensors-2.10.4

     Sun Dec 16 14:55:31 2007 >>> sys-fs/sysfsutils-2.1.0

     Sun Dec 16 15:09:48 2007 >>> sys-fs/sysfsutils-1.3.0-r1

     Sun Dec 16 15:13:01 2007 >>> sys-apps/lm_sensors-2.10.4

     Sun Dec 16 15:14:40 2007 >>> kde-misc/ksensors-0.7.3

     Fri Dec 21 10:44:36 2007 >>> dev-lang/python-2.4.4-r6

     Fri Dec 21 10:46:02 2007 >>> sys-apps/sandbox-1.2.18.1-r2

     Fri Dec 21 10:46:12 2007 >>> app-misc/pax-utils-0.1.16

     Fri Dec 21 10:48:36 2007 >>> app-shells/bash-3.2_p17

     Fri Dec 21 10:48:47 2007 >>> sys-apps/portage-2.1.4_rc3

     Sun Dec 23 14:47:47 2007 >>> media-video/vlc-0.8.6c

     Mon Dec 24 22:46:43 2007 >>> app-text/docbook-xsl-stylesheets-1.70.1

     Tue Dec 25 00:17:54 2007 >>> net-misc/curl-7.17.1

     Tue Dec 25 00:18:53 2007 >>> media-libs/libvorbis-1.2.0

     Tue Dec 25 00:37:44 2007 >>> games-fps/nexuiz-2.3

     Wed Dec 26 13:15:40 2007 >>> net-wireless/kdebluetooth-1.0_beta1-r2

     Wed Dec 26 22:12:44 2007 >>> games-fps/nexuiz-2.3

     Thu Dec 27 02:10:29 2007 >>> sci-visualization/gnuplot-4.2.2

     Thu Dec 27 02:32:03 2007 >>> sci-mathematics/octave-2.1.73

     Thu Dec 27 02:33:13 2007 >>> media-libs/pfstools-1.6.2

     Thu Dec 27 02:33:44 2007 >>> media-libs/pfstmo-1.1

     Thu Dec 27 02:33:52 2007 >>> app-admin/whowatch-1.5.2-r1

     Thu Dec 27 02:34:09 2007 >>> media-libs/pfscalibration-1.3

     Thu Dec 27 02:35:03 2007 >>> media-gfx/qtpfsgui-1.8.3

     Thu Dec 27 22:42:38 2007 >>> kde-misc/kio-ftps-0.1

     Thu Dec 27 22:45:48 2007 >>> net-ftp/kasablanca-0.4.0.2

     Fri Dec 28 17:00:46 2007 >>> net-misc/openvpn-2.0.6

     Fri Dec 28 19:17:43 2007 >>> app-crypt/truecrypt-4.3a

     Fri Dec 28 20:38:54 2007 >>> net-p2p/gift-0.11.8.1-r1

     Sat Dec 29 14:18:50 2007 >>> sys-devel/gettext-0.17

     Sat Dec 29 14:21:21 2007 >>> x11-wm/fluxbox-1.0.0

     Sat Dec 29 15:05:00 2007 >>> dev-libs/openssl-0.9.8g

     Sat Dec 29 15:05:32 2007 >>> sys-libs/readline-5.2_p7

     Sat Dec 29 15:05:55 2007 >>> net-wireless/wpa_supplicant-0.5.8

     Sat Dec 29 16:12:59 2007 >>> dev-libs/libdaemon-0.11-r1

     Sat Dec 29 16:13:19 2007 >>> sys-apps/ifplugd-0.28-r7

```

Router:

```
etamin brancik # genlop -l --date 20071215 --date 20071230

 * sys-kernel/gentoo-sources

     Sat Dec 15 14:52:45 2007 >>> sys-kernel/gentoo-sources-2.6.23-r3

     Sat Dec 15 16:01:29 2007 >>> dev-libs/openssl-0.9.8g

     Sat Dec 15 16:08:18 2007 >>> net-wireless/hostapd-0.6.1

     Wed Dec 26 19:24:38 2007 >>> app-portage/eix-0.10.2

     Wed Dec 26 22:42:10 2007 >>> games-fps/nexuiz-2.3

     Thu Dec 27 17:29:29 2007 >>> app-shells/rssh-2.3.2

     Thu Dec 27 17:43:38 2007 >>> app-admin/superadduser-1.0.9

     Thu Dec 27 17:53:26 2007 >>> net-ftp/vsftpd-2.0.5-r3

     Fri Dec 28 19:20:19 2007 >>> sys-fs/device-mapper-1.02.22-r5

     Fri Dec 28 19:26:12 2007 >>> app-crypt/truecrypt-4.3a

     Sat Dec 29 15:00:09 2007 >>> net-wireless/wpa_supplicant-0.5.8

```

Things stopped to work on about 28th of Dec and definetely worked on 15th Dec. Setting up the the network manualy doesn't help. It says Netwrok unreachable. On both virtual machines.

Router is gentoo machine with dnsmasq.

I noticed, that the wait time actually varies, sometimes 1 sec, sometimes 15 sec. or so...:

```
Jan  7 02:35:40 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 08:00:27:15:0a:65

Jan  7 02:35:40 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65

Jan  7 02:35:55 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 08:00:27:15:0a:65

Jan  7 02:35:55 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65

Jan  7 02:35:56 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 08:00:27:15:0a:65

Jan  7 02:35:56 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65

Jan  7 02:36:04 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 08:00:27:15:0a:65

Jan  7 02:36:04 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65

Jan  7 02:36:20 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 08:00:27:15:0a:65

Jan  7 02:36:20 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65
```

VirtualBox is of version 1.5.2_ose.

----------

## koan

Any progress with this?  The same thing has happened to my vbox setup.  Packets can leave the virtual box without issue, and traverse the network.

Anything coming back reaches the bridged interface of the host machine, but doesn't appear to make it into the vm itself.

I too did an update recently, but haven't tracked down the package that may have caused it.   Nothing for revdep-rebuild to do...

----------

## koan

Was openvpn a new install?  This is the first time I have rebooted since installing openvpn on the virtualbox host...

----------

## Korhul

Nope. Just update... But I'm not willing to believe, that openvpn is doing this... I have it only on the router, not on the desktop or vm...

----------

## Dagger

from your logs it seems that

```

Jan  7 02:36:20 etamin dnsmasq[27390]: DHCPDISCOVER(lan) 08:00:27:15:0a:65

Jan  7 02:36:20 etamin dnsmasq[27390]: DHCPOFFER(lan) 192.168.10.8 08:00:27:15:0a:65

```

your VM is asking for IP and dhcp server on your gentoo box is offering ip 192.168.10.8

your VM doesn't accept this IP (or it does and router doesn't confirm this)

can you post:

/var/lib/dhcp/dhcpd.leases

on your gentoo box

and what happens when you try to run on your VM

dhclient eth0 or dhcpcd eth0 (don't know which dhcp client you've got)

please post any messages

----------

## koan

 *Korhul wrote:*   

> Nope. Just update... But I'm not willing to believe, that openvpn is doing this... I have it only on the router, not on the desktop or vm...

 

From the genlop above, the openvpn installation is on the desktop - or are these outputs mislabelled?

In any case, I have disabled my openvpn installation on the host, and the guest still cannot receive packets.  

The mac address on the emitted packets is the vbox interface mac, rather than the br0 mac.  If someone has a working virtualbox with bridging set up, perhaps they could confirm this is the right behaviour.  I suspect it is as the response packets are seen, so layer 2 is working across the network.

As the packets are being emited from the vbox interface, and leave and return by the eth0 interface, means that the bridging itself is working.  I have tested with a linux host also, and the same thing happens...so this is not a guest issue.

That leaves virtualbox itself as the candidate for the problem...  I have uninstalled and reinstalled virtualbox (1.5) from portage, both binaries and source, without any change.

----------

## koan

Interestingly, I am also finding that my virtualbox VMs are terminating if left alone after they fail to get dhcp.

Not sure how long it takes, but I would guess a couple of hours, the vm stops, and there doesn't seem to be any clues in the logs as to why they stopped...

----------

## Korhul

 *Quote:*   

> can you post: 
> 
>  /var/lib/dhcp/dhcpd.leases 
> 
>  on your gentoo box 
> ...

 

Well This file is not present on any of the machines. My Workstation (host machine for vm) has fixed IP.

I have forgotten that I have instaled openvpn on my desktop. But I have never actualy started it or even configured it, because I decided later I am not in need of it.

dhcpcd -d eth0 (gentoo livecd) on VM spits out only MAC address of eth0.

----------

## koan

I am fairly sure that dhcp itself isn't related to the problem, as even with a fixed IP address, the behaviour is the same.

Packets are issued from the VM, and will get to the host, and traverse the network.  Response packets will return, containing the correct MAC of the VM, and seem to not get across the host/guest interface.

Did you make any progress Korhul?

----------

## Korhul

Well, I have updated virtualbox to 1.5.4-r1 with no success.

But I have one more clue to consider. I have three ifaces in my bridge. eth1 is currently NIC in my workstation and with eth0 I sometimes get my laptop connected when I want high speed network upload. Laptop works like a charm, gets dhcp address and so on.

So it is likely mistake in tap driver or vboxdrv module?

----------

## koan

Hi Korhul,

I gave up by the way, but please post here if you find a solution.

I only need RDP inbound to the box, so I have resorted to using NAT+portforwarding instead of bridged networking.

Ah well...

----------

## manaka

See this related thread.

----------

## Korhul

Upgrading openvpn to unstable 2.0.7-r1 helped.

Workaround is to use 

```
ifconfig vbox0 txqueuelen 100
```

 command. I tried also 500 value at the end and it also worked. But baselayout with updated openvpn sets it to 100. Other devices in bridge have it on 1000, but I really don't know what this parametr is good for so I am sticking with the default way (100).

Marking as solved for now...

----------

