Bridge Networking

Discussions related to using VirtualBox on Linux hosts.

Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 15:47

Hi.

Host: Debian GNU/Linux 5.0.2;
Guest: Debian GNU/Linux 5.0.2;
VirtualBox 3.0.10.

How to configure a bridge network that have possibility to use Internet from a guest system? Is it possible in general?

What I did.

1. I installed the uml-utilities and bridge-utils packages on the host system;

2. I included in host's /etc/network/interfaces the next lines:

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports eth0 vbox0

3. I restarted the network:

/etc/init.d/networking restart

4. I created the VB interface including in host's /etc/vbox/interfaces the next lines:

vbox0 <username> br0

5. I restarted the guest network:

/etc/init.d/virtualbox-ose restart

6. I changed the rights for host's /dev/net/tun:

chown root:vboxusers /dev/net/tun
chmod g+rw /dev/net/tun

7. I created /etc/udev/rules.d/20-names.rules in the host system and add the next lines there:

KERNEL=="tun", NAME="NET/%k", GROUP="vboxusers", MODE="0660"

8. I started the VB and set the bridge type for the network and vbox0 for the interface in the configuration.

9. I started my virtual machine and created eth0 in /etc/network/interfaces:

auto eth0
eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

10. I restarted guest's network executed /etc/init.d/network restart there.

11. I tested the local network with the ping utility and a simple web-server with a simple application on it. All works OK and I have an access from the host to the guest and vice versa. I can connect to Internet from the host system however I can't make it from the guest.

12. I spended two days searching some information about the problem.

Any help will be welcome.

Thanks.
Last edited by Jean Jacques Linux on 3. Nov 2009, 17:19, edited 4 times in total.
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Re: Bridge Networking

Postby Perryg » 3. Nov 2009, 16:51

What version of VirtualBox are you using?
Is there a router in the mix?
Forum Guidelines -- VirtualBox HOWTOs -- Bugtracker -- Forum Howto -- Search VB Forum with YOUR KEYWORDS

Please read the Users Manual. It is located in the VirtualBox program under help and content before posting your questions.
|
Perryg
Site Moderator
 
Posts: 4963
Joined: 6. Sep 2008, 22:55
Location: Omaha, Nebraska USA
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Everything

Re: Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 17:10

I'm using a closed-source edition of VB. The version is 3.0.10 r54097. My PC is behind a router.
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Re: Bridge Networking

Postby Perryg » 3. Nov 2009, 17:35

Well then you do not need to go through all that extra work in the definition of the network.
VirtualBox provides the Bridging and has for several versions back.
All that I do is select bridged mode in the guest settings and set the network information manually.
Forum Guidelines -- VirtualBox HOWTOs -- Bugtracker -- Forum Howto -- Search VB Forum with YOUR KEYWORDS

Please read the Users Manual. It is located in the VirtualBox program under help and content before posting your questions.
|
Perryg
Site Moderator
 
Posts: 4963
Joined: 6. Sep 2008, 22:55
Location: Omaha, Nebraska USA
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Everything

Re: Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 18:23

I tried it early. It doesn't work.

Here is what I did in short.

1. host's /etc/network/interfaces:

allow-hotplug eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

2. /etc/init.d/networking restart on the host;
3. /etc/init.d/virtualbox-ose restart on the host;
4. virtualbox settings: network type — bridge, name — eth0;
5. guest's /etc/network/interfaces:

auto eth0
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

6. /etc/init.d/networking restart on the guest;
7. reboot all the systems and as the result no connection at all.

What I do wrong?
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Re: Bridge Networking

Postby Perryg » 3. Nov 2009, 18:38

What does ifconfig say about this
Forum Guidelines -- VirtualBox HOWTOs -- Bugtracker -- Forum Howto -- Search VB Forum with YOUR KEYWORDS

Please read the Users Manual. It is located in the VirtualBox program under help and content before posting your questions.
|
Perryg
Site Moderator
 
Posts: 4963
Joined: 6. Sep 2008, 22:55
Location: Omaha, Nebraska USA
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Everything

Re: Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 19:59

I reconfigured all by the new scheme. Internet started work for the host system but for the guest it doesn't work. I can ping the host and the gateway from the guest, all is OK. I can ping the guest from the host. I also can connect to the local web-server either from the host to guest or from the guest to host. It's OK too. But the main problem stay unresolved — there isn't Internet connection on the guest system.

Here is some info which can be useful:

Host's /etc/network/interfaces:

Code: Select all   Expand viewCollapse view
allow-hotplug eth0
iface eth0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1


Host's ifconfig:

Code: Select all   Expand viewCollapse view
eth0    Link encap:Ethernet  HWaddr 00:13:d3:15:8b:53 
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::213:d3ff:fe15:8b53/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1531 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1731 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1105369 (1.0 MiB)  TX bytes:401625 (392.2 KiB)
          Interrupt:23 Base address:0x4000

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


Host's route:

Code: Select all   Expand viewCollapse view
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
localnet        *               255.255.255.0   U     0      0        0 eth0
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0


Guest's /etc/network/interfaces:

Code: Select all   Expand viewCollapse view
auto eth0
   iface eth0 inet static
   address 192.168.1.4
   netmask 255.255.255.0
   network 192.168.1.0
   broadcast 192.168.1.255
   geteway 192.168.1.1


Guest's ifconfig

Code: Select all   Expand viewCollapse view
eth0    Link encap:Ethernet  HWaddr 08:00:27:0c:4f:9f 
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2380 (2.3 KiB)  TX bytes:2254 (2.2 KiB)
          Interrupt:19 Base address:0xd020

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)


Guest's route

Code: Select all   Expand viewCollapse view
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
localnet        *               255.255.255.0   U     0      0        0 eth0
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Re: Bridge Networking

Postby Perryg » 3. Nov 2009, 20:08

Have you defined the DNS?
resolv.conf

What about firewall?
Forum Guidelines -- VirtualBox HOWTOs -- Bugtracker -- Forum Howto -- Search VB Forum with YOUR KEYWORDS

Please read the Users Manual. It is located in the VirtualBox program under help and content before posting your questions.
|
Perryg
Site Moderator
 
Posts: 4963
Joined: 6. Sep 2008, 22:55
Location: Omaha, Nebraska USA
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Everything

Re: Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 20:45

Host:

Code: Select all   Expand viewCollapse view
#/etc/resolv.conf
search home
nameserver 213.140.228.252
nameserver 213.140.231.3

Guest:
Code: Select all   Expand viewCollapse view
#/etc/resolv.conf
domain home
search home
nameserver 213.140.228.252
nameserver 213.140.231.3

The router's firewall is shuted down. What about the Linux's native firewall Netfilter I haven't got any experience with it. Should I configure it to work with VB bridges?
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Re: Bridge Networking

Postby Perryg » 3. Nov 2009, 21:05

If you can ping the gateway but not beyond then It could be linux filtering it.
can you ping anything by name?
ping yahoo.com from the host and write down the IP then try to ping the IP from the guest.
Forum Guidelines -- VirtualBox HOWTOs -- Bugtracker -- Forum Howto -- Search VB Forum with YOUR KEYWORDS

Please read the Users Manual. It is located in the VirtualBox program under help and content before posting your questions.
|
Perryg
Site Moderator
 
Posts: 4963
Joined: 6. Sep 2008, 22:55
Location: Omaha, Nebraska USA
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Everything

Re: Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 21:28

I've done it.

I can ping an IP address or name from the host but I can't do it from the guest.

Code: Select all   Expand viewCollapse view
ping -c 4 yahoo.com
ping: unknown host yahoo.com

Code: Select all   Expand viewCollapse view
ping -c 4 209.131.36.159
connect: Network is unreachable


Is the problem in the Linux firewall?
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Re: Bridge Networking

Postby Perryg » 3. Nov 2009, 21:30

Yes it could be.
Can you ping the gateway?
Forum Guidelines -- VirtualBox HOWTOs -- Bugtracker -- Forum Howto -- Search VB Forum with YOUR KEYWORDS

Please read the Users Manual. It is located in the VirtualBox program under help and content before posting your questions.
|
Perryg
Site Moderator
 
Posts: 4963
Joined: 6. Sep 2008, 22:55
Location: Omaha, Nebraska USA
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Everything

Re: Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 21:49

Yes, I can.

Code: Select all   Expand viewCollapse view
guest# ping -c 4 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=1.19 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=1.25 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=255 time=0.947 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=255 time=1.15 ms

--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3018ms
rtt min/avg/max/mdev = 0.947/1.138/1.255/0.121 ms

Could you tell me how can I configure the firewall? (If you have time for it, of course)
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Re: Bridge Networking

Postby Perryg » 3. Nov 2009, 22:05

# /etc/init.d/iptables stop
Then see if you can get out.
Host and Guest.
Forum Guidelines -- VirtualBox HOWTOs -- Bugtracker -- Forum Howto -- Search VB Forum with YOUR KEYWORDS

Please read the Users Manual. It is located in the VirtualBox program under help and content before posting your questions.
|
Perryg
Site Moderator
 
Posts: 4963
Joined: 6. Sep 2008, 22:55
Location: Omaha, Nebraska USA
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Everything

Re: Bridge Networking

Postby Jean Jacques Linux » 3. Nov 2009, 22:41

I'm leaving it for tomorrow. Thanks for the help, Perryg.
Jean Jacques Linux
 
Posts: 21
Joined: 24. Feb 2009, 05:59

Next

Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 8 guests