Debian guest, dns not working

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Johnnythejohn
Posts: 4
Joined: 6. Aug 2014, 16:00

Debian guest, dns not working

Post by Johnnythejohn »

Hi.

Running a windows host with a debian guest.

I can't for the life of me get DNS to work.

I'm using the default (NAT) network device. I can ping ip addresses (for example 8.8.8.8) just fine, but i can't resolve any hostnames.

/etc/resolv.conf:
nameserver 10.0.2.3 (i can ping this just fine as well)

I have tried
VBoxManage modifyvm "VM name" --natdnsproxy1 on
and
VBoxManage modifyvm "VM name"--natdnshostresolver1 on

nothing is working.

what do i have to do to get dns to work?
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Debian guest, dns not working

Post by BillG »

Are you trying to resolve host names on the local network? If you are NAT may not do it for you. NAT was devised to allow machines on private LANs to resolve foreign URLs through a router which had an Internet connection. The NAT server does the DNS lookup and data acquisition on the client's behalf.

If you are trying to resolve the names of machines on the local LAN, bridged would be a better option.
Bill
Johnnythejohn
Posts: 4
Joined: 6. Aug 2014, 16:00

Re: Debian guest, dns not working

Post by Johnnythejohn »

BillG wrote:Are you trying to resolve host names on the local network? If you are NAT may not do it for you. NAT was devised to allow machines on private LANs to resolve foreign URLs through a router which had an Internet connection. The NAT server does the DNS lookup and data acquisition on the client's behalf.

If you are trying to resolve the names of machines on the local LAN, bridged would be a better option.
I'm trying to resolve (any) hostnames, but especially, well, internet hostnames.

I mean, I want to be able to run apt-get update and stuff, but I cant even resolve ftp.debian.org you know?

DNS doesn't work and I've been at it for hours trying to fix it. Usually virtualbox just works out of the box, this time it does not.
Johnnythejohn
Posts: 4
Joined: 6. Aug 2014, 16:00

Re: Debian guest, dns not working

Post by Johnnythejohn »

Still having problems. I can't get internet to work on my virtualbox guests. It's really frustrating as it has worked before and i've spent hours trying to fix it..

Current setup:
Windows host (Windows 7) - Internet works flawlessly
Windows guest (Windows 7) - can only ping internet addresses, nothing else works

NAT network adapter set on the VM. Default network adapter. (Tried all though)
Also tried bridged, and all the other settings. People generally say that the NAT setting "should just work".

Guest gets this ip automatically. IP: 10.0.2.15
I configured dns myself to googles dns. I've also tried automatic dns. No difference.

Gateway according to ipconfig /all: 10.0.2.2 (can ping this just fine)
DNS: 8.8.8.8 (can ping this just fine)

So. I can ping any internet addresses (not just googles dns) just fine.
I can not resolve any hostnames (dns is not working at all, times out). nslookup for example just says time out.

Important to note: i can only PING internet addresses, i can't for example open a website by typing its IP in the address bar. It wont connect.

I dont know what to try. I have tried different host os, different guest os, I always have the same problem.
No internet for the guest, i can just ping.

Anyone? Any suggestions?
Johnnythejohn
Posts: 4
Joined: 6. Aug 2014, 16:00

Re: Debian guest, dns not working

Post by Johnnythejohn »

yahooooooo
freephile
Posts: 2
Joined: 19. Dec 2014, 21:47

Re: Debian guest, dns not working

Post by freephile »

Same here, with Ubuntu 14.04

It seems strange to me that the host is at 10.0.3.1, while eth0 on the guest is 10.0.2.15

But, I can ping host from guest

vagrant@mediawiki-vagrant:~$ ping 10.0.3.1
PING 10.0.3.1 (10.0.3.1) 56(84) bytes of data.
64 bytes from 10.0.3.1: icmp_seq=1 ttl=63 time=0.131 ms
64 bytes from 10.0.3.1: icmp_seq=2 ttl=63 time=0.990 ms
64 bytes from 10.0.3.1: icmp_seq=3 ttl=63 time=0.000 ms
64 bytes from 10.0.3.1: icmp_seq=4 ttl=63 time=1.18 ms
64 bytes from 10.0.3.1: icmp_seq=5 ttl=63 time=1.25 ms
64 bytes from 10.0.3.1: icmp_seq=6 ttl=63 time=0.752 ms
64 bytes from 10.0.3.1: icmp_seq=7 ttl=63 time=0.984 ms
64 bytes from 10.0.3.1: icmp_seq=8 ttl=63 time=1.39 ms
64 bytes from 10.0.3.1: icmp_seq=9 ttl=63 time=0.919 ms
64 bytes from 10.0.3.1: icmp_seq=10 ttl=63 time=3.86 ms
64 bytes from 10.0.3.1: icmp_seq=11 ttl=63 time=1.94 ms
64 bytes from 10.0.3.1: icmp_seq=12 ttl=63 time=0.584 ms
64 bytes from 10.0.3.1: icmp_seq=13 ttl=63 time=1.46 ms
64 bytes from 10.0.3.1: icmp_seq=14 ttl=63 time=0.405 ms
64 bytes from 10.0.3.1: icmp_seq=15 ttl=63 time=2.61 ms
^C
--- 10.0.3.1 ping statistics ---
15 packets transmitted, 15 received, 0% packet loss, time 14048ms
rtt min/avg/max/mdev = 0.000/1.232/3.863/0.956 ms

nslookup from the host shows that it's using Google's nameservers

greg@greg-laptop:~/vagrant$ nslookup slashdotDOTorg
Server: 8.8.8.8
Address: 8.8.8.8#53

Non-authoritative answer:
Name: slashdotDOTorg
Address: 216.34.181.45


When I do nslookup from the guest, it's using 10.0.2.3 -- I don't even know who that is! and it takes entirely too long.

vagrant@mediawiki-vagrant:~$ time nslookup slashdotDOTorg
Server: 10.0.2.3
Address: 10.0.2.3#53

Name: slashdotDOTorg
Address: 216.34.181.45


real 0m5.109s
user 0m0.032s
sys 0m0.050s


$$$$$$$$$$$ Host network settings $$$$$$$$$$$$$$$$$$$$$
greg@greg-laptop:~/vagrant$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1f:16:25:48:30
inet addr:192.168.1.8 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21f:16ff:fe25:4830/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:58086 errors:0 dropped:0 overruns:0 frame:0
TX packets:37025 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:53444168 (53.4 MB) TX bytes:11824810 (11.8 MB)
Interrupt:20 Memory:fc200000-fc220000

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:65536 Metric:1
RX packets:4642 errors:0 dropped:0 overruns:0 frame:0
TX packets:4642 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:930009 (930.0 KB) TX bytes:930009 (930.0 KB)

lxcbr0 Link encap:Ethernet HWaddr f6:7f:db:21:0e:5f
inet addr:10.0.3.1 Bcast:10.0.3.255 Mask:255.255.255.0
inet6 addr: fe80::f47f:dbff:fe21:e5f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1461 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:171354 (171.3 KB)

vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00
inet addr:10.11.12.1 Bcast:10.11.12.255 Mask:255.255.255.0
inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1393 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:164027 (164.0 KB)

%%%%%%%% Guest network settings %%%%%%%%%%%%
vagrant@mediawiki-vagrant:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:22:6c:74
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe22:6c74/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2786 errors:0 dropped:0 overruns:0 frame:0
TX packets:2606 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:268312 (268.3 KB) TX bytes:647185 (647.1 KB)

eth1 Link encap:Ethernet HWaddr 08:00:27:74:1f:4e
inet addr:10.11.12.13 Bcast:10.11.12.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:965 errors:0 dropped:0 overruns:0 frame:0
TX packets:1225 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:148839 (148.8 KB) TX bytes:586744 (586.7 KB)

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:65536 Metric:1
RX packets:124 errors:0 dropped:0 overruns:0 frame:0
TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:20652 (20.6 KB) TX bytes:20652 (20.6 KB)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Debian guest, dns not working

Post by Perryg »

We do not support VirtualBox within vagrant. Too many scripts and modifications.
freephile
Posts: 2
Joined: 19. Dec 2014, 21:47

RESOLVED Re: Debian guest, dns not working

Post by freephile »

I actually had to turn OFF two supposed improvements for networking, by creating a Vagrantfile-extra.rb file, with these settings:

Code: Select all

Vagrant.configure('2') do |config|
    config.vm.provider :virtualbox do |vb|
        # Fix dns resolution problem
        vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'off']
        vb.customize ['modifyvm', :id, '--natdnsproxy1', 'off']
    end
end
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Debian guest, dns not working

Post by Perryg »

Like I said too many scripts and modifications. That's why it is not supported.
Post Reply