Page 1 of 1

host-only networking -- default route?

Posted: 27. Feb 2013, 14:51
by JH60
After having worked for a while with NAT,
I am now giving "host-only networking" a try.
There are quite a few reasons to consider "host-only networking" the right thing for me now:
The guests can see each other,
I can see the Samba server running in a guest,
I can communicate with guests w/o going through forwarded weird port numbers.

So ...
I see eth0 and eth1 in my guest (for details see below!),
I understand eth0 is for internal networking,
and eth1 is the bridge.

Shouldn't there also be a default route
in order to determine how the guest reaches "the world" through the bridge?

I had a few attempts like this:

$ route add default dev eth1
# Update: this choice seems to work with a bridge over a wifi adapter connected to one wifi but not to another one.
# The VirtualBox host itself does not have a problem with either of the two wifis.

$ route add default gw 192.168.43.40
$ route add default gw 192.168.43.140 # the other end of the bridge within OS X

but to no success ;-(
I seem to not be able to see "the world", as I usually am using NAT as networking mode.

I ran out of ideas.

I am very happy to supply you with more details than the ones below.

Can you give me any hints?

Thanks in advance!

JH60

----------

# ifconfig -a
eth0 Link encap:Ethernet HWaddr 08:00:27:44:F7:2F
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe44:f72f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41374 errors:0 dropped:0 overruns:0 frame:0
TX packets:35457 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12617162 (12.0 Mb) TX bytes:35411893 (33.7 Mb)

eth1 Link encap:Ethernet HWaddr 08:00:27:8E:E8:31
inet addr:192.168.43.40 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe8e:e831/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5908 errors:0 dropped:0 overruns:0 frame:0
TX packets:2316 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:517817 (505.6 Kb) TX bytes:286636 (279.9 Kb)

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:782 errors:0 dropped:0 overruns:0 frame:0
TX packets:782 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:55561 (54.2 Kb) TX bytes:55561 (54.2 Kb)

# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.43.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0



--
I am using 4.2.6 on OS X (10.7.5).
Guest OS: openSUSE 12.2 (x86_64).

Re: host-only networking -- default route?

Posted: 27. Feb 2013, 16:53
by noteirak
Could you attach as a zip file the .vbox file of your VM please? you are not clear on some details and all the answers are there. After which, I can tell you how to make this work

Re: host-only networking -- default route?

Posted: 27. Feb 2013, 19:14
by JH60
As requested please find the .vbox.zip file attached!

Re: host-only networking -- default route?

Posted: 27. Feb 2013, 20:36
by noteirak
and could you post as an attached zip file the output of the following command :

Code: Select all

vboxmanage showvminfo <vmname> --details

Re: host-only networking -- default route?

Posted: 27. Feb 2013, 22:03
by JH60
Now the requested vminfo details as requested.

BTW: Actually I repeated my very first "route add" attempt ("route add default dev eth1) with another connection on eth1 and voilà it worked.
No idea why.
Maybe it's not even the "right way" – I am certainly not the networking guru.
So maybe you still have a nicer way of how to achieve it.

Re: host-only networking -- default route?

Posted: 27. Feb 2013, 22:09
by noteirak
I guess the VM gets its IP on the bridged interface via the DHCP server in place on your network? If yes, the default GW would be propagated and since the host-only interface doesn't have one, it would be the default route anyway.
If that's not the case, then it's only networking setup.

Also, I notice you are bridging on a wifi connection? This is inhenrently unreliable - Some Wifi hardware are not alaways made to support several comptuers behind a single Wifi link, which can cause issues.
Using Wifi bridging would be up to you to ensure it can actually work with your equipement.

Re: host-only networking -- default route?

Posted: 27. Feb 2013, 23:09
by JH60
noteirak wrote:I guess the VM gets its IP on the bridged interface via the DHCP server in place on your network?
From the VirtualBox set-up on OS X I can't see, that there is a DHCP server serving the bridged interface.
On the guest's side it looks like that.
But without my explicit and additional "route add default gw eth0" nothing goes.
noteirak wrote:If yes, the default GW would be propagated and since the host-only interface doesn't have one, it would be the default route anyway.
Are you reckoning, a "route add default ..." should be launched automatically on the DHCP client's side?
noteirak wrote:If that's not the case, then it's only networking setup.
noteirak wrote:Also, I notice you are bridging on a wifi connection?
True, but I don't really have alternatives,
"out there" I am using my Android tablet (with 3G) as "portable Wi-Fi hotspot" ("Tethering").
noteirak wrote: This is inhenrently unreliable
- Some Wifi hardware are not alaways made to support several comptuers behind a single Wifi link, which can cause issues.
Using Wifi bridging would be up to you to ensure it can actually work with your equipement.
Hmm, the Wifi bridging seems to work with one wifi but not with another one.
That confuses me.

J.

Re: host-only networking -- default route?

Posted: 27. Feb 2013, 23:18
by Perryg
See chapter 6 of your VirtualBox users manual for a definition of "Host-Only"

Re: host-only networking -- default route?

Posted: 28. Feb 2013, 02:53
by noteirak
JH60 wrote:Are you reckoning, a "route add default ..." should be launched automatically on the DHCP client's side?
If the DHCP provides a gateway IP address, yes there will be an equivalent of that command called from The TCP/IP stack.
JH60 wrote:Hmm, the Wifi bridging seems to work with one wifi but not with another one.
That confuses me.
It all depends on the Wifi Access Point. Is the firmware code wrote properly or not.

Your issue is not related to Virtualbox but to your network setup & equipement.