Two Host Network Adapters: NAT or Something Else?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
duskrider
Posts: 1
Joined: 3. Jul 2008, 11:31

Two Host Network Adapters: NAT or Something Else?

Post by duskrider »

Hello,

I'm running 1.6.2r31466 on Debian Lenny, using a Windows XP guest. So far, everything works fine (after installing the geust extensions twice to enable shared folders).

BUT: The host is on two physically separate networks with two different adapters. The guest can only access eth0 and eth0:1, but nothing on eth1.
The routing on the guest looks ok, it goes via the gateway and does not try to find the adresses locally. The second network has IPs in the 10.x.x.x range as well as 172.16.0.x, both are not accessible.
What else can I do to track down the error source?

I have no intention of switching to bridge networking unless I'm pretty sure this can help me.

So, is this a known bug? I could find nothing on this in the forums and bug lists.

Thanks in advance for any advice!

Yours sincerely,
Jörg Neulist
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

NAT let you use internet and some network browsing, but it's not a perfect solution. If you set up bridging, you can create two bridges. One for your internet, where you set the gateway and dns server on the Guest. For the other network, you only enter the correct IP address and netmask. So let's say your 172.16.0.x is internet, and the 10.x.x.x is local network. The settings would be like this on the Guest:

Code: Select all

iface eth0 inet static
address 172.16.0.40
netmask 255.255.0.0
dns-nameserver 172.16.0.1
gateway 172.16.0.1

iface eth1 inet static
address 10.0.0.40
netmask 255.0.0.0
Now the internet will go over the 172.16.0.x network. However, if you have both the 172.16.0.x and 10.x.x.x network running over eth0 (with your eth0 and eth0:1) and internet over eth1, you can do about the same, but keep the NAT interface. You don't have to create two Host Interfaces too, you just create the same setup as you have now with the alias. Only change is the bridge with an alias for the second network. So you will have only one eth0 interface, and a br0 and br0:1 interface for the two private networks.

Hope I made sense :P.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
dariusb
Posts: 1
Joined: 3. Jul 2008, 22:38

Post by dariusb »

I've got my system similarly setup, but no Internet connection.

The host network is working using the scripts found in this post:
http://forums.virtualbox.org/viewtopic.php?t=933

I use gksu to run the Setup and Terminate applications.

Connections are going both ways just fine.

I can still access the Internet with the host system during this as well.

What I cannot do it connect to the Internet with the guest system using the second adapter set up for NAT. I get the DHCP address, I get DNS configured properly. It looks to me like the route is configured properly, it just doesn't go anywhere. I think it must be something I still need to setup on the host system.

If I set the guest to only NAT with neither the Setup or Terminate Applications, I can get to the Internet.

Here's the information:

GUEST SYSTEM

/etc/network/interfaces

Code: Select all

# The primary network interface
iface eth0 inet static
address 10.1.1.2
netmask 255.255.255.0

iface eth2 inet dhcp 
ifconfig

Code: Select all

eth0      Link encap:Ethernet  HWaddr 08:00:27:1D:28:60  
          inet addr:10.1.1.2  Bcast:10.1.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe1d:2860/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:1000 
          RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)
          Interrupt:11 Base address:0xc020 

eth2      Link encap:Ethernet  HWaddr 08:00:27:A0:C6:45  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fea0:c645/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:288 errors:0 dropped:0 overruns:0 frame:0
          TX packets:204 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:400064 (390.6 KiB)  TX bytes:12283 (11.9 KiB)
          Interrupt:10 Base address:0xc060 
/etc/resolv.conf

Code: Select all

search bounceme.net
nameserver 10.0.2.3

nslookup works...

Code: Select all

Server:		10.0.2.3
Address:	10.0.2.3#53

Non-authoritative answer:
Name:	yahoo.com
Address: 206.190.60.37
Name:	yahoo.com
Address: 68.180.206.184

routing table...

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.2.0        *               255.255.255.0   U     0      0        0 eth2
10.1.1.0        *               255.255.255.0   U     0      0        0 eth0
default         10.0.2.2        0.0.0.0         UG    0      0        0 eth2


HOST SYSTEM

ifconfig

Code: Select all

eth0      Link encap:Ethernet  HWaddr 00:1b:24:63:95:ad  
          UP BROADCAST PROMISC 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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:251 Base address:0xa000 

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:2934 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2934 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:148982 (145.4 KB)  TX bytes:148982 (145.4 KB)

vbox0     Link encap:Ethernet  HWaddr 00:ff:aa:f1:67:38  
          inet addr:10.1.1.1  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::2ff:aaff:fef1:6738/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:203 errors:0 dropped:0 overruns:0 frame:0
          TX packets:219 errors:0 dropped:11 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:25874 (25.2 KB)  TX bytes:28092 (27.4 KB)

wlan0     Link encap:Ethernet  HWaddr 00:13:e8:3c:6c:87  
          inet addr:192.168.5.122  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::213:e8ff:fe3c:6c87/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7805920 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11745980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1270517533 (1.1 GB)  TX bytes:17355344378 (16.1 GB)

wmaster0  Link encap:UNSPEC  HWaddr 00-13-E8-3C-6C-87-00-00-00-00-00-00-00-00-00-00  
          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:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
[/u]
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Darius, if you used the command VBoxAddIF, you do not need the scripts, VB does it for you.

Have you tried a different IP address range for the Host-Guest network? As your wifi uses the class C 192.168.x.y network, and VB the class A 10.x.y.z network, you could use the class B 172.16-32.x.y network. Read Wikipedia for more info about private networking.

In theory, it should all work for you, but I think that 10.1.1.1. address is in the way, along with the script you use.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply