Page 1 of 1
Problem with hostnames resolution
Posted: 29. Nov 2020, 13:43
by VerbaL
Host: W10/64, last VBX
Guest: any Linux, CentOS7/8 first
I have a strange behaviour, and i do not want to assign static ip address to my machines, i want to keep dhcp assignment.
FROM GUEST MACHINE:
no problems, router is the assigned dhcp dns server (192.168.1.1)
FROM HOST MACHINE:
1) i can ping ip address of any Linux machine
2) i can't ping hostname of any Linux machine
Problem seems to be the dns. My host does not use router/gateway dns (192.168.1.1), but other dns servers (cloudflare, google, etc...), so i'm stuck here,
Code: Select all
---BAD---
C:\Windows\system32>nslookup centos
Server: one.one.one.one
Address: 1.1.1.1
Risposta da un server non autorevole:
Nome: centos.homenet.telecomitalia.it
Address: 127.0.0.1
C:\Windows\system32>ping centos
Esecuzione di Ping CentOS.homenet.telecomitalia.it [127.0.0.1] con 32 byte di dati: <-- bad resolution from 1.1.1.1
---GOOD---
C:\Windows\system32>nslookup centos 192.168.1.1
Server: modemtim.homenet.telecomitalia.it
Address: 192.168.1.1
Nome: centos.homenet.telecomitalia.it
Address: 192.168.1.30
Is there a trick to get hostnames?
Thanks.
Re: Problem with hostnames resolution
Posted: 29. Nov 2020, 16:40
by scottgus1
VerbaL wrote:Host: W10/64, last VBX
Please define "last VBX".
If it is normal for regular physical Windows and Linux PCs in the same network to see and ping each other's network names, then a Virtualbox network that puts the VMs in the same network as the host is (Bridged, possibly Host-Only) should not stand in the way of the host and the VMs pinging each other by network name. (My old boss's domain-controller/file-print-server VM was Bridged, and we could access it by it's network name \\server01 from all the Windows workstations. We didn't have Linux workstations.)
Try Bridged if at all possible.
Virtualbox's NAT and NAT Network act like routers, with the Host PC on the WAN side, and may not let access to the VM's name get through for pinging. Ther are three DNS commands for NAT:
vboxmanage modifyvm "vm name" --natdnspassdomain<1-N> on|off
vboxmanage modifyvm "vm name" --natdnsproxy<1-N> on|off
vboxmanage modifyvm "vm name" --natdnshostresolver<1-N> on|off
I don't know if any of these would help.
See
Virtualbox Networks: In Pictures
Re: Problem with hostnames resolution
Posted: 29. Nov 2020, 17:43
by VerbaL
What about "last VBX"? Last version of VirtualBox.. 6.1.16 r140961.
Network is already in Bridged Mode, since i can obtain my ip add by local dns (router/gateway at 192.168.1.1).
As you can read above, local dns resolves guest VM hostname,
Code: Select all
C:\Windows\system32>nslookup centos 192.168.1.1
Server: modemtim.homenet.telecomitalia.it
Address: 192.168.1.1
Nome: centos.homenet.telecomitalia.it
Address: 192.168.1.30
... but if, in host machine, my W10, i set CloudFlare/Google dns (as i do), i miss resolution. See coded part.
Re: Problem with hostnames resolution
Posted: 29. Nov 2020, 21:40
by fth0
VerbaL wrote:if, in host machine, my W10, i set CloudFlare/Google dns (as i do), i miss resolution.
Of course. If you configure your host to not use the DNS server of the router, than it does not use the DNS server of the router. Depending on the router, you could configure it to forward DNS requests from your host to Cloudflare or Google DNS, and configure the router to be the DNS server for the host. Note that you can usually configure two DNS servers in modern OSs, so why not configure both?
An alternative would be to use mDNS for your local DNS resolution.
Re: Problem with hostnames resolution
Posted: 29. Nov 2020, 22:46
by VerbaL
fth0 wrote:VerbaL wrote:if, in host machine, my W10, i set CloudFlare/Google dns (as i do), i miss resolution.
Note that you can usually configure two DNS servers in modern OSs, so why not configure both?
I'm already using 4 dns,
1.1.1.1
8.8.8.8
8.8.4.4
192.168.1.1
And, obviously, router can't be configured and customized for external ISP dnses.
In my previous pc (i5-2500K), same config as the actual (many dnses, router at bottom, same VirtualBox, same VMs now ported to new pc), i used to resolve my VMs hostnames without problems (MobaXterm still have configuration to point to hostname, not ip). This is a strange behaviour.
Re: Problem with hostnames resolution
Posted: 29. Nov 2020, 23:05
by VerbaL
I restarted the router... now i can see hostnames
Code: Select all
C:\Windows\system32>ping centos
Esecuzione di Ping CentOS.local [192.168.1.30] con 32 byte di dati:
Risposta da 192.168.1.30: byte=32 durata<1ms TTL=64
Mistery!!!

Re: Problem with hostnames resolution
Posted: 30. Nov 2020, 08:38
by BillG
Sounds like an old story, not a mystery. Never overlook the obvious. Similar to the first helpdesk answer to a Windows question. "Did you reboot the machine?"
Re: Problem with hostnames resolution
Posted: 30. Nov 2020, 10:19
by VerbaL