I have a Windows XP w/ SP2 (guest additions installed) configured with 2 network cards.

Network Card 1:  Host-only
    IP:       (static)
    DG:        (vboxnet0)

Network Card 2:  NAT
    IP:       (auto)

Host OS - Linux (

ping  ... OK!

Windows XP:

ping   ... OK!
ping google.com        ... FAIL! (time out)

BUT when i disable the Network Card 1 from the control panel of Windows, I CAN ping google.com. Virtualbox 4.2.18

Any ideas?

2 Answers 2


Most likely, you have a routing table specifying that your default gateway is on the Host-only network, not your main connection. Which interface is chosen at boot as the default gateway depends on the vagaries of boot-up, it is not necessarily always the same IF that comes up first. You may peruse your routing table with the command

route print 

and you may add as your default gateway by means of

route delete mask
route add mask

The first command of course removes the current default gateway, the second introduces the new one. If you intend to make this permanent,

route -p add mask
  • So what you're saying is that since is the NAT interface, packets from should be forwarded to this interface in order to communicate with the public internet?
    – WikiWitz
    Sep 25, 2013 at 10:04
  • +1 It works! I disabled the NAT interface for a while, when reenabled it created a route mask overriding the previous route with default gateway Tried to delete the latest route and problem came back. So i deleted the route instead and added back the right one. Thanks!!!
    – WikiWitz
    Sep 25, 2013 at 10:08

try removing the gateway from connection 1. It'll use the second gateway instead.

You can also switch the LAN ports and make connection 1 NAT and connection 2 host only.

  • This setup used to work before, NAT providing internet access, Host-only providing host-guest interaction. I want to find out what went wrong this time.
    – WikiWitz
    Sep 25, 2013 at 7:53
  • And btw as i suspected switching the LAN ports doesn't change a thing. Still had to disable the host-only adapter in order to have access to the public internet
    – WikiWitz
    Sep 25, 2013 at 8:16
  • Actually. i suspect that might be down. ping it first to see if it's up and confirm that it has access. You can run ifconfig on your linux to see the network connections on the linux box
    – Zigmaphi
    Sep 25, 2013 at 8:19
  • it can be pinged and the virtual interface is up on my host
    – WikiWitz
    Sep 25, 2013 at 8:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .