Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have the following setup:

  • Windows host running virtualbox
  • Ubuntu server as a guest

I've enabled a second networking interface in Virtualbox - a bridged one - so I can connect to the instance via ssh, http etc

(note: this has always worked using ubuntu desktop using the GUI to configure networking, but now I'm using ubuntu server and doing it manually in ubuntu)

This is roughly what I do:

I have the instance running and I can, eg. ping stackoverflow.com and I get an IP address I stop the server, enable the second adapter in virtualbox I start the instance again I can see that the interface is listed using ifconfig -a I open /etc/network/interfaces and add the eth1 controller, so my interfaces file looks like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet dhcp

and when I restart using /etc/init.d/networking restart everything seems to work - ie. ifconfig gives me this:

eth0  Link encap:Ethernet  HWaddr 08:00:27:ad:75:94
      inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
      inet6 addr: fe80::a00:27ff:fead:7594/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:1074 errors:0 dropped:0 overruns:0 frame:0
      TX packets:318 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:1301455 (1.3 MB)  TX bytes:26248 (26.2 KB)

eth1  Link encap:Ethernet  HWaddr 08:00:27:73:f7:37
      inet addr:192.168.1.149  Bcast:192.168.1.255  Mask:255.255.255.0
      inet6 addr: fe80::a00:27ff:fe73:f737/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:464 errors:0 dropped:0 overruns:0 frame:0
      TX packets:243 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:65921 (65.9 KB)  TX bytes:32173 (32.1 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:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

And I can connect to the instance using ssh, so networking is working..

however, DNS resolving seems to be not working, because when I ping any website (eg. stackoverflow.com) it just times out..

I checked /etc/resolv.conf and everything looks fine (in fact, looks the same as the one on my ubuntu desktop instance.

Any ideas?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Please provide the output of sudo ip route list. I think your queries leave the box on one interface while they come back on another and your kernel will throw them away..
Try do disable the unbridged interface and retest the connectivity again:

usr@srv % sudo ifdown eth0
usr@srv % nslookup 8.8.8.8

If this doesn't work: are you able to ping to 8.8.8.8?


Update:

If you use bridged networking there is no need to use VirtualBox as NAT.
The problem was, as expected, that DNS is configured to ask via eth0, the shorter way is through eth1, so the answer comes via eth1. Your kernel however doesn't expect any message on eth1 and drops them..

share|improve this answer
    
wait.. so you mean I don't need the default NAT networking controller that virtualbox creates and that I can simply change it to a bridged one? (I am able to ping to google's 8.8.8.8 and use it for dig) –  arnorhs Apr 25 '11 at 13:01
    
So your net is working with both interfaces enabled and only DNS doesn't? Have you tried DNS lookups with disabled eth0? –  binfalse Apr 25 '11 at 13:03
    
yes, net is working on both, but dns doesn't.. exactly.. I just tried a dns lookup using only eth1 - with eth0 disabled.. and that WORKED.. it seems like I don't need two networking interfaces on the virtualbox instace... I just need a bridged one! wow, thanks a lot.. been stressed here (leaving on a trip in a few hours) –  arnorhs Apr 25 '11 at 13:10
    
If you can modify your answer to the solution (not using two controllers in virtualbox for this purpose, just one) - and essentially trying to disable eth0 - I can approve the answer! thanks again –  arnorhs Apr 25 '11 at 13:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.