Ubuntu 14.04 VirtualBox guest unable to ping outside world

2

Asked on server fault: https://serverfault.com/questions/706488/ubuntu-14-04-virtualbox-guest-unable-to-ping-outside-world but put on hold as off topic:

I have an Ubuntu 14.04 VM running on Ubuntu 14.04 host on my home network, the host can access the network and internet completely fine, and the guest can ping devices on the network and be pinged- however it cannot ping (or curl) the outside world (i.e. google):

ptinkler@ptinkler-dev:~$ ping www.google.com
PING www.google.com (216.58.208.68) 56(84) bytes of data.
From ptinkler-dev.home (192.168.1.75) icmp_seq=1 Destination Host Unreachable
From ptinkler-dev.home (192.168.1.75) icmp_seq=2 Destination Host Unreachable
From ptinkler-dev.home (192.168.1.75) icmp_seq=3 Destination Host Unreachable
^C
--- www.google.com ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3014ms

I've tried both bridged and NAT adapters, and the VM works perfectly on my work network, making me think it may be an issue with my home network router.

edit:

sysctl net.ipv4.ip_forward returned 0, but setting it to 1 didn't make a difference.

iptables -L -n -v came back with:

ptinkler@ptinkler-dell-xps:~$ iptables -L -n -v
modprobe: ERROR: could not insert 'ip_tables': Operation not permitted
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded

Host:

wlan0     Link encap:Ethernet  HWaddr c8:f7:33:da:68:21  
          inet addr:192.168.1.72  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::caf7:33ff:feda:6821/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:248973 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160935 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:233346198 (233.3 MB)  TX bytes:22586578 (22.5 MB)

Guest:

eth0      Link encap:Ethernet  HWaddr 08:00:27:31:7d:f6  
          inet addr:192.168.1.75  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe31:7df6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1349 errors:0 dropped:0 overruns:0 frame:0
          TX packets:687 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:144462 (144.4 KB)  TX bytes:50305 (50.3 KB)
          Interrupt:19 Base address:0xd020 

ptr

Posted 2015-07-17T09:56:28.810

Reputation: 121

if you use nat adapter and host has access to internet the guest use that connection through the router, so the router doesn't know about the guest machine, so it is not the router. you can check the firewall on guest machine sometimes the ping are blocked but web access no – emirjonb – 2015-07-17T10:04:01.990

curl www.google.com on the guest also does not work – ptr – 2015-07-17T10:11:35.650

I am also inclined to think that it is a setup issue. Just as a side-issue, did you install the guest additions? I use Oracle VirtualBox with Ubuntu 12.04 guests, 14.04 guests, Win7 and Win XP guests, and as long as I use bridged adapter on DHCP, I never have issues. Please check this post

– Louis Parkin – 2015-07-17T10:11:37.077

guest additions is installed- and my only doubts with it being a setup issue is that the exact setup works perfectly fine without problems on the work network, only when I bring the laptop home and try to use it on the home network does this issue occur – ptr – 2015-07-17T10:19:26.547

Does the host machine on your home network has access on internet and able to ping any global IP? If yes the guest machine using nat bridge should be able to access internet without issues. You can do a check on the firewall on host machine if virtualbox is allowed. – emirjonb – 2015-07-17T10:35:16.887

the host machine can access the internet yes, but even in NAT mode the guest can't- I haven't checked the host firewall settings thoroughly yet but I'll do that next- still baffled as to why it's an issue on a home network and not the work network – ptr – 2015-07-17T10:50:48.413

I have absolutely no rules in iptables on host – ptr – 2015-07-17T11:06:54.570

Incidentally, iptables needs to be run as root, have you tried with sudo? – trpt4him – 2015-07-17T13:21:41.887

Also one more thing to check -- in Bridged mode, are you getting an IP address that is on the same subnet as the host? NAT actually introduces a lot of complexity (port forwarding, virtualized DHCP and routing, etc) that doesn't exist with Bridged, so I'd be inclined to focus on getting it working in Bridged mode first. – trpt4him – 2015-07-17T13:25:41.563

yup same subnet, I updated with the ifconfigs for both – ptr – 2015-07-17T14:41:05.873

No answers