0

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

Network Card 1:  Host-only
    IP:   10.0.2.15       (static)
    Mask: 255.255.255.0
    DG:   10.0.2.1        (vboxnet0)

Network Card 2:  NAT
    IP:   10.0.3.15       (auto)
    Mask: 255.255.255.0
    DG:   10.0.3.2

Host OS - Linux (192.168.100.102)

ping 10.0.2.15  ... OK!

Windows XP:

ping 192.168.100.102   ... 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

1

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 10.0.3.2 as your default gateway by means of

route delete 0.0.0.0 mask 0.0.0.0 10.0.2.1
route add    0.0.0.0 mask 0.0.0.0 10.0.3.2

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 0.0.0.0 mask 0.0.0.0 10.0.3.2
2
  • So what you're saying is that since 10.0.3.2 is the NAT interface, packets from 10.0.2.1 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 0.0.0.0 mask 0.0.0.0 10.0.3.2 overriding the previous route with default gateway 10.0.2.1. Tried to delete the latest route and problem came back. So i deleted the 10.0.2.1 route instead and added back the right one. Thanks!!!
    – WikiWitz
    Sep 25, 2013 at 10:08
0

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.

4
  • 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 10.0.2.1 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 .