Page 1 of 1

NAT guest does not get correct DNS when host uses dial-up

Posted: 27. Jan 2010, 12:58
by SecretCode
I've searched on various combinations of keywords but I haven't found anything relevant.

I use a notebook normally connected via wireless to a home router. But sometimes I use it remotely with a 3G broadband "dial-up" connection. Vbox guests work fine in the home configuration but not when connected on 3G:

In this case I have an Ubuntu 9.10 64 bit host with vbox 3.1.2 r56127 and a Windows XP SP2 guest running as NAT. When dialled into 3G, the host connects fine - ppp0 is the 3G connection:

Code: Select all

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1b:24:97:58:d3  
          UP BROADCAST MULTICAST  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:17 

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:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1960 (1.9 KB)  TX bytes:1960 (1.9 KB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:41.26.41.10  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:1592 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2099 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:1214138 (1.2 MB)  TX bytes:424759 (424.7 KB)

wlan0     Link encap:Ethernet  HWaddr 00:0d:f0:39:54:71  
          UP BROADCAST MULTICAST  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wmaster0  Link encap:UNSPEC  HWaddr 00-0D-F0-39-54-71-00-00-00-00-00-00-00-00-00-00  
          UP RUNNING  MTU:0  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Code: Select all

$ cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 196.207.32.83
nameserver 196.207.32.69
But the guest - even after repairing the connection or rebooting - does not pick up the new DNS servers. It only knows about the one derived from the original connection wlan0.

Code: Select all

Ethernet adapter Local Area Connection 4:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapte
r
        Physical Address. . . . . . . . . : 08-00-27-3B-1D-E9
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 10.0.2.15
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.0.2.2
        DHCP Server . . . . . . . . . . . : 10.0.2.2
        DNS Servers . . . . . . . . . . . : 192.168.1.5
        Lease Obtained. . . . . . . . . . : 27 January 2010 12:54:07 PM
        Lease Expires . . . . . . . . . . : 28 January 2010 12:54:07 PM
I can ping the external addresses from the guest, so basic connectivity works, and if I manually add the DNS servers all connectivity works - but this would have to be repeated often as the 3G providers sometimes gives different servers.

Does virtualbox support supplying the correct DNS server names from "dial up" connections to NAT guests? Thanks.

I'm posting this in the general forum as I don't think it's specific to the type of host or guest. I've also seen the same problem with a linux guest running on a windows host, with earlier versions of vbox, but without investigating the details.

Re: NAT guest does not get correct DNS when host uses dial-up

Posted: 27. Jan 2010, 15:59
by Perryg
Sounds like you need to setup the NAT proxy. Have a look at the following sections in the VBox Users Manual.

9.14.5. Enabling DNS proxy in NAT mode
9.14.6. Using the host's resolver as a DNS proxy in NAT mode

Re: NAT guest does not get correct DNS when host uses dial-up

Posted: 27. Jan 2010, 16:45
by SecretCode
Ah, that looks useful. Don't know why I missed that ... I must have given too much weight to the part in 6.3 which says
Network Address Translation (NAT) is the simplest way of accessing an external network from a virtual machine. Usually, it does not require any configuration on the host network and guest system.
:)

Is this working as designed, though? (I'm thinking of reporting a bug.)

Either the DNS proxy should be the default, or the current host DNS servers should be supplied to guests using DHCP every time the guest renews its dhcp lease.

Bug #3847 (re-initiate NAT on Network switch) - VirtualBox is marked solved with the DNS proxy suggestion you made. Bug #5955 (VirtualBox cannot set DNS servers in nat mode) - VirtualBox is open, and looks like this issue.

Re: NAT guest does not get correct DNS when host uses dial-up

Posted: 27. Jan 2010, 17:02
by Perryg
The first ticket was solved by doing what I sent you. It does not effect that many people and changing it would cause more problems then it would fix.
As for the second ticket, this is on a beta 10.04 and really will not get a lot of attention until the release date of the OS.
Ubuntu 10.04 has deprecated hal and VBox is working on fixing things because they rely heavily on hal at this point.

Re: NAT guest does not get correct DNS when host uses dial-up

Posted: 27. Jan 2010, 18:51
by SecretCode
Hi Perry
Although that second bug mentions Ubuntu, the issue I'm describing is not dependent on Ubuntu. To verify, I've just rebooted to my physical windows XP installation and tested the situation with a windows XP guest. The result is the same: when the host changes DNS servers, and the guest renews its dhcp lease, it gets the old (and wrong) DNS servers (for a guest using NAT and not using the DNS proxy).

Re: NAT guest does not get correct DNS when host uses dial-up

Posted: 27. Jan 2010, 18:51
by SecretCode
Question: is there any point is setting "9.14.5. Enabling DNS proxy in NAT mode" without also setting "9.14.6. Using the host's resolver as a DNS proxy in NAT mode"?

Certainly setting just the proxy doesn't resolve my issue whereas using the host resolver as well does (thanks).

Re: NAT guest does not get correct DNS when host uses dial-up

Posted: 27. Jan 2010, 19:11
by Perryg
Although that second bug mentions Ubuntu, the issue I'm describing is not dependent on Ubuntu. To verify, I've just rebooted to my physical windows XP installation and tested the situation with a windows XP guest. The result is the same: when the host changes DNS servers, and the guest renews its dhcp lease, it gets the old (and wrong) DNS servers (for a guest using NAT and not using the DNS proxy).
IMHO I would not tag myself to a ticket that is set to a beta OS. Little effort will be made on it until they have the new code available. If you feel that this is a bug then you should tag yourself to this ticket but make it known that this is NOT only specific to Ubuntu 10.04. Also log files must be included or they will not even read the ticket.
Question: is there any point is setting "9.14.5. Enabling DNS proxy in NAT mode" without also setting "9.14.6. Using the host's resolver as a DNS proxy in NAT mode"?
Certainly setting just the proxy doesn't resolve my issue whereas using the host resolver as well does (thanks).
I actually think that setting the host resolver is what is fixing your problem, but I can not verify this. Since you have activated both and it works well there you go.