Personal computing discussed

Moderators: renee, SecretSquirrel, notfred

 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 9:44 am

I'm having the weirdest problems with networking in an Ubuntu VM running in Virtualbox. Imagine this:

At work, I can connect to the internet just fine using a NatNetwork adapter in Virtualbox (or any adapter for that matter).
At home, I can't reach anything by DNS but I can ping any server I want by IP address (ie: ping google.com => "ping: unknown host: google.com", ping 8.8.8.8 => works fine). I am bouncing between OSX and Windows hosts with the same issue.
Here's the kicker: at home, if I VPN into my workplace from the HOST machine, everything works fine on the VM!

I've tried changing the DNS servers on the guest to 8.8.8.8 and 8.8.4.4, and the above still occurs. I have a hunch this is related to ipv6 (home appears to be ipv6 ready) vs ipv4 (work is still on a dedicated ipv4 address) but I have no idea where to start troubleshooting this. I noticed that when the host is disconnected from the VPN, google.com resolves to an ipv6 address, and when connected to the VPN, it resolves to an ipv4 address. And to be clear, it's like a magic switch is flipped when the host is connected to the VPN: the VM suddenly knows what address google.com is without tunneling through the VPN.

Home setup is as follows, if this helps:
Host machines: OSX and Windows
Ubuntu VM networking interfaces: NatNetwork, NAT, bridged adapter (all with same issues)
Consumer-grade Netgear AC1900 router, DHCP enabled, addresses from 192.168.1.2 - 192.168.1.254
Consumer-grade Netgear cable modem at 192.168.100.1
Comcast internet scoring a 10/10 on this site: http://test-ipv6.com/

Can someone help me understand what is going on, and how I'd go about enabling my Virtualbox'd Ubuntu client to get internet without the host connecting to the VPN? I'm a total networking n00b.

EDIT: Keeping this post updated with everything I've done
I also did the following with no changes in behavior:
Ran this on the host:
VBoxManage modifyvm "VM name" --natdnshostresolver1 on

Host: Set the NatNetwork to accept ipv6
VM: Ensured both "wired" connections (NatNetwork and NAT) have all ipv6 settings set to automatic
VM: Rebooted

SOLVED:
/etc/resolv.conf was set to something specific to my workplace. I manually edited /etc/resolv.conf to the following:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1


Appears to persist even after reinstalling resolv.conf. Not sure why.
Last edited by Duct Tape Dude on Mon Jan 09, 2017 2:22 pm, edited 3 times in total.
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 9:47 am

Are you changing the DNS server settings in the host, or the guest?
Nostalgia isn't what it used to be.
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 9:47 am

just brew it! wrote:
Are you changing the DNS server settings in the host, or the guest?

Ah sorry, the guest. Everything works fine on the host.
 
DancinJack
Maximum Gerbil
Posts: 4494
Joined: Sat Nov 25, 2006 3:21 pm
Location: Kansas

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 9:48 am

Did you try turning off V6 in Windows?
i7 6700K - Z170 - 16GiB DDR4 - GTX 1080 - 512GB SSD - 256GB SSD - 500GB SSD - 3TB HDD- 27" IPS G-sync - Win10 Pro x64 - Ubuntu/Mint x64 :: 2015 13" rMBP Sierra :: Canon EOS 80D/Sony RX100
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 9:48 am

Try the following on the host:
VBoxManage modifyvm "VM name" --natdnshostresolver1 on

(then restart the VM)
Nostalgia isn't what it used to be.
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 10:00 am

DancinJack wrote:
Did you try turning off V6 in Windows?
Not yet. I'd strongly prefer to just leave the host intact since everything works.
just brew it! wrote:
Try the following on the host:
VBoxManage modifyvm "VM name" --natdnshostresolver1 on

(then restart the VM)

Did this, ran successfully, no change in behavior.

I also did the following with no changes in behavior:
Set the NatNetwork to accept ipv6 (on the host)
Ensured both "wired" connections on the VM (NatNetwork and NAT) have all ipv6 settings set to automatic
Rebooted VM
 
SecretSquirrel
Minister of Gerbil Affairs
Posts: 2726
Joined: Tue Jan 01, 2002 7:00 pm
Location: North DFW suburb...
Contact:

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 10:03 am

Duct Tape Dude wrote:
DancinJack wrote:
Did you try turning off V6 in Windows?
Not yet. I'd strongly prefer to just leave the host intact since everything works.
just brew it! wrote:
Try the following on the host:
VBoxManage modifyvm "VM name" --natdnshostresolver1 on

(then restart the VM)

Did this, ran successfully, no change in behavior.

I also did the following with no changes in behavior:
Set the NatNetwork to accept ipv6 (on the host)
Ensured both "wired" connections on the VM (NatNetwork and NAT) have all ipv6 settings set to automatic
Rebooted VM


Sounds like the VMs aren't enabling IPv6 for some reason? Are you using NAT network connections or bridged connections?

--SS
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 10:06 am

SecretSquirrel wrote:
Sounds like the VMs aren't enabling IPv6 for some reason? Are you using NAT network connections or bridged connections?

--SS

I have one adapter set as a NatNetwork (eth0), and a second (eth1) as a NAT which I swap out to Bridged for troubleshooting. No matter if eth1 is set to NAT or Bridged, the same behavior occurs.
 
SecretSquirrel
Minister of Gerbil Affairs
Posts: 2726
Joined: Tue Jan 01, 2002 7:00 pm
Location: North DFW suburb...
Contact:

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Aug 26, 2016 11:03 am

Duct Tape Dude wrote:
SecretSquirrel wrote:
Sounds like the VMs aren't enabling IPv6 for some reason? Are you using NAT network connections or bridged connections?

--SS

I have one adapter set as a NatNetwork (eth0), and a second (eth1) as a NAT which I swap out to Bridged for troubleshooting. No matter if eth1 is set to NAT or Bridged, the same behavior occurs.


VirtualBox says they support IPv6 properly in NAT mode so it shouldn't matter. You might try disabling IPv6 in the Ubuntu VM since your home network is IPv4. The DNS lookup is coming back with a v6 address and that doesn't appear to be routable on your home network.

Edit /etc/sysctl.conf and add:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1


Reboot. Now see if a DNS lookup of google returns an IPv4 address.

--SS
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 12:45 pm

SecretSquirrel wrote:
VirtualBox says they support IPv6 properly in NAT mode so it shouldn't matter. You might try disabling IPv6 in the Ubuntu VM since your home network is IPv4. The DNS lookup is coming back with a v6 address and that doesn't appear to be routable on your home network.

Edit /etc/sysctl.conf and add:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1


Reboot. Now see if a DNS lookup of google returns an IPv4 address.

--SS
Welp, getting back to these issues a few months later: still no luck after applying these changes--still stuck with being able to ping any IP address but DNS lookups apparently fail (ping google.com never completes).

What's troubling is if I load the Mint Live CD or any other guest VM, networking works 100% fine. What's even more troubling is if I move it over to a different VM host, networking works 100% fine. What the heck did I do to this particular installation??
 
Vhalidictes
Gerbil Jedi
Posts: 1835
Joined: Fri Jan 07, 2005 2:32 pm
Location: Paragon City, RI

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 1:04 pm

I think it's time you find out. Install WireShark on the Host, start recording in WireShark, turn on the Guest, run some tests, stop recording in WireShark. If you have trouble parsing the log I can help. You're looking specifically for DNS requests from the Guest IP.

It seems like (from the posts so far) that DNS works on the Host at all times (which means your home network is probably fine) but fails from the Guest (but only from your home network).

Sorry if I missed it, but what IP(4) address is your Guest leasing from the home network? Also, don't forget that you're effectively double-NAT (once inside the Host PC and once at your router) which can also cause some oddities (although not DNS failure, usually).
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 2:40 pm

Vhalidictes wrote:
I think it's time you find out. Install WireShark on the Host, start recording in WireShark, turn on the Guest, run some tests, stop recording in WireShark. If you have trouble parsing the log I can help. You're looking specifically for DNS requests from the Guest IP.

It seems like (from the posts so far) that DNS works on the Host at all times (which means your home network is probably fine) but fails from the Guest (but only from your home network).

Sorry if I missed it, but what IP(4) address is your Guest leasing from the home network? Also, don't forget that you're effectively double-NAT (once inside the Host PC and once at your router) which can also cause some oddities (although not DNS failure, usually).
Alright I got Wireshark working. Here's the setup:

Goal is to have VM internet access when connected to work VPN and also when disconnected from work VPN.

-Home router is 192.168.1.1
-Host machine Ethernet is 192.168.1.6
-Host machine work VPN is 10.124.56.63
-Guest A has a NAT interface
-Guest B has a NAT interface

Here's what I found via Wireshark:
Guest A (VM referred to in OP, broken)
-DNS requests are routed to 10.124.5.10, then 10.124.5.12 after 5s. I think these are gateways or routers at work, but this host seems to be always referencing them. When the host is disconnected from the VPN, "ping google.com" never completes. When the host is connected to the VPN, "ping google.com" yields "ping: unknown host google.com"
-"ping 8.8.8.8" works fine always.

Guest B (new VM just made to test if I'm going crazy)
-DNS requests go to 192.168.1.1
-Everything (ping, internet, etc) works fine regardless of whether the host VPN is connected or not.

Mysteriously, after poking through "nmcli device list eth0" BOTH VMs have nearly identical configurations, with "IP4.DNS[1]=192.168.1.1".

So how do I fix the DNS issues on Guest A?
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 2:50 pm

Duct Tape Dude wrote:
So how do I fix the DNS issues on Guest A?

Delete Guest A, then clone Guest B to A? (I'm half-serious here.)
Nostalgia isn't what it used to be.
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 2:53 pm

just brew it! wrote:
Duct Tape Dude wrote:
So how do I fix the DNS issues on Guest A?

Delete Guest A, then clone Guest B to A? (I'm half-serious here.)

That's seriously what I am about to do. Or at least get B to feature parity with A and replace A altogether.
Last edited by Duct Tape Dude on Fri Jan 06, 2017 2:54 pm, edited 1 time in total.
 
Vhalidictes
Gerbil Jedi
Posts: 1835
Joined: Fri Jan 07, 2005 2:32 pm
Location: Paragon City, RI

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 2:53 pm

I'm sorry to admit that I'm more of a Network person than a Linux Guru (strange as that may sound). It sounds like 10.124.5.10 / 10.124.5.12 is hiding in some configuration file... somewhere.

IIRC it might be easiest to log in as Root /single user mode and scan all files to see where it's lurking. From what I do know, that shouldn't be showing up as auto-configuration when the system is on your home network. Maybe you can check and see if the VPN client is set to update your system?

Did you try "service-network-restart"? (that might only work for Red Hat based distros). Also, what does "ifconfig -a" show?
 
Vhalidictes
Gerbil Jedi
Posts: 1835
Joined: Fri Jan 07, 2005 2:32 pm
Location: Paragon City, RI

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 2:54 pm

Duct Tape Dude wrote:
just brew it! wrote:
Duct Tape Dude wrote:
So how do I fix the DNS issues on Guest A?

Delete Guest A, then clone Guest B to A? (I'm half-serious here.)

That's seriously what I am about to do. Or at least get B to feature parity with A and replace A altogether.

That's not a bad idea - but if the systems really are identical then I'm worried Guest B will break as soon as you load it from a work machine.
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Fri Jan 06, 2017 3:04 pm

Vhalidictes wrote:
I'm more of a Network person than a Linux Guru
No worries, you got me to play with Wireshark again so that's quite the accomplishment!
Vhalidictes wrote:
It sounds like 10.124.5.10 / 10.124.5.12 is hiding in some configuration file
That's my thought too but I'm clueless as to where. I hate networking because every time I learn something new I realize there are 10 other things that I am now aware of, and I have no idea how they work.
Vhalidictes wrote:
Did you try "service-network-restart"? (that might only work for Red Hat based distros). Also, what does "ifconfig -a" show?
Oh I've tried the Windows solution (reboot) many times, don't worry. "ifconfig -a" shows almost identical configurations, down to the same IPv4 address (result of NAT?). Just different MACs.
Vhalidictes wrote:
That's not a bad idea - but if the systems really are identical then I'm worried Guest B will break as soon as you load it from a work machine.
In all my Linux problems, I find there are two solutions: I can either try and learn what the heck I screwed up, or just reinstall the whole darn thing.
I'm becoming better at the former but today, this seems to be the latter.

Thanks for everyone's help. Stupid mysterious networking configs.
 
notfred
Maximum Gerbil
Posts: 4610
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: Need help with networking issues in Virtualbox'd Ubuntu

Sat Jan 07, 2017 5:07 pm

DNS resolution in all Unix type OS including Linux is via the file /etc/resolv.conf Technically before that the resolver consults /etc/nsswitch.conf to see what it should use to lookup the hostname (i.e. just the /etc/hosts file or also use DNS) but your guest is actually doing the DNS so /etc/nsswitch.conf is OK.

In the olden days of yore then /etc/resolv.conf was a plain file. These days where you have multiple interfaces (wired, wireless etc) and VPNs, then it is usually a link to some files that are under the control of the resolvconf package. The idea behind resolvconf is that it tries to work out which of the many possible DNS settings coming in from all these different interfaces it should use - so if your connected via wifi and wired then it uses the one from wired until you bring up a VPN connection and then it uses the VPN one.

Now to add to the complexity NetworkManager usually runs dnsmasq so you tend to just find a localhost address (127.0.1.1) in the /etc/resolv.conf from resolvconf and everything is getting controlled in dnsmasq via dbus

One other thought is that the guest NAT in VirtualBox may be all messed up depending on when you created the Guests if it provides a DNS proxy. You could try running wireshark in the guest and then clicking on the VirtualBox network interface icon to disconnect and then reconnect it and see what VirtualBox provides to the Guest as a DNS setup as part of the DHCP.
 
Duct Tape Dude
Gerbil Elite
Topic Author
Posts: 721
Joined: Thu May 02, 2013 12:37 pm

Re: Need help with networking issues in Virtualbox'd Ubuntu

Mon Jan 09, 2017 2:16 pm

notfred wrote:
DNS resolution in all Unix type OS including Linux is via the file /etc/resolv.conf Technically before that the resolver consults /etc/nsswitch.conf to see what it should use to lookup the hostname (i.e. just the /etc/hosts file or also use DNS) but your guest is actually doing the DNS so /etc/nsswitch.conf is OK.
notfred, you're a genius! The file /etc/resolv.conf differs between the two VMs, and I see the following:

Guest A (the bad one)
domain   myworkplacethatimobfuscating.com
nameserver   10.124.5.10
nameserver   10.124.5.12
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

Guest B (the good one)
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

I've changed the contents of A to match those of B (after making a backup of course), and things now work! Obviously this is not billed as a permanent solution, but here's the odd thing: the file remains changed even after restarting, and even after sudo apt-get install --reinstall resolvconf.

I have no idea what is going on but I'll call this one SOLVED and update my OP.
 
notfred
Maximum Gerbil
Posts: 4610
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: Need help with networking issues in Virtualbox'd Ubuntu

Mon Jan 09, 2017 2:51 pm

Cool! Glad to hear that helped, bizarre how things ended up in the resolv.conf in the first place.

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On