1

I've setup dnsmasq on a Linux box and setup the DNS address on another Linux by adding its IP to /etc/resolv.conf file.

$ cat /etc/resolv.conf
nameserver 192.168.9.105
nameserver 8.8.8.8

Now I can ping to any internal ip, as follows:

$ ping cca
PING cca (192.168.9.102) 56(84) bytes of data.
64 bytes from cca-erik (192.168.9.102): icmp_seq=1 ttl=64 time=0.017 ms
64 bytes from cca-erik (192.168.9.102): icmp_seq=2 ttl=64 time=0.024 ms
^C
--- cca ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.017/0.020/0.024/0.005 ms

However, on Windows I'm having some issues. I set the nameserver as follows:

netsh interface ip set dns name="aea-tap" static 192.168.9.105
ipconfig /flushdns 

nslookup seems to resolve a domain name correctly:

C:\Users\cca>nslookup cca
Server:   aktos-1-vpn
Address:  192.168.9.105

Name:     cca
Address:  192.168.9.102

But ping doesn't work:

C:\Users\cca>ping cca
Ping request could not find host cca. Please check the name and try again.

How can I fix this on Windows so I can ping cca?

  • Have you added the DNS suffix on the address in Windows? Control Panel -> Network and Sharing Center -> Change Adapter Settings -> Adapter Properties -> Internet Protocol Version 4 Properties -> Advanced -> DNS -> DNS suffix for this connection; Register this connection's addresses in DNS; Use this connection's DNS suffix in DNS registration. – user5870571 May 28 '16 at 14:25
1

If you are using dnsmasq as your DHCP server, you can push the DNS domain, DNS search list, and router to the clients. This should resolve your issue.

dhcp-option=3,192.0.2.1             # Router
dhcp-option=6,192.0.2.              # DNS servers
dhcp-option=15,example.com          # Domain
dhcp-option=119,example.com,com,org # Domain search list (clients may not support)

If you have neither a domain nor a search list, then the address searched for would be cca. This is unlikely to ever have an IP address.

However, if you have a netbios name server serving the name, this would be a valid address. ping cca would likely work on Windows in this case.

The standby is to configure the name and IP in /etc/hosts. Windows relocates the file, but still uses it.

| improve this answer | |
  • No, the DHCP server is not under my control, it's all done by OpenVPN server itself and I'm not sure if I can control it or not... – ceremcem May 28 '16 at 18:16
  • Well, I got dnsmasq working as my DHCP server. When I try to connect to vpn, the dnsmasq assigns an ip from specified range. Now nslookup cca 192.168.9.105 also fails on Windows, even the same command runs successfully on Linux. – ceremcem May 28 '16 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.