Ubuntu – DNS issues with the ubuntu 14.04

dnsnetworking

I just switched to Ubuntu 14.0.4 from Windows 7 using dual boot mode. I am connecting to my office's network using wireless wlan0. I am experiencing issues when trying to ssh to access several Linux host. The hostname is not resolving to an IP. I checked /etc/resolv.conf and /etc/network/interfaces. There's no static DNS defined. I am obtaining an IP via DHCP. I have did not experience issue with Windows 7 basically.

To workaround I have to manually insert DNS and search domain in the /etc/network/interfaces file. Thereafter I am able to ssh to Linux as the hostname now translates an IP. Confirmed with nslookup.

However the problem comes when I get home on home's network. I noticed upon booting up my laptop into Ubuntu, firefox takes a while to translate a URL and noticeably slow. However once the website loads up it speed up. I did some website benchmark no issues with speed. I am highly suspecting due to DNS settings. When I comment off the DNS servers (which is my office's one), things are back to normal. My ISP indicated that no DNS is required to specify as we are assigned IPs through DHCP.

For the time being, I am doing manual comment/uncomment DNS entries to flick the switch 😛 Not sure if there's a better way to solve this.

Cheers.

Best Answer

Thank you for your help. I managed to solve my problem. My bad. Slapped my wrist.

nmcli dev list iface eth0 returns correct DNS information. My office's DNS is giving correct DNS and IP. What happened was the DNS server returned domain A (local office). However I was trying to connect to another site (domain B). Hence nslookup and ssh without the domain B supplied will return error.

Eg:

ssh hostname (Does not work)
ssh hostname.domainB.com (works) 

This is because even though I am connected successfully to the network. I am with domain A. I figured out that I need to append my dns suffix in /etc/resolvconf/tail to overcome this otherwise I need to specify domainB each time.

To add one more important observation. It took me a while to troubleshoot as nslookup and /etc/resolv.conf always points to 127.0.1.1. It confuses me as to why it goes to local DNS than my DNS server. I found it is the way Ubuntu Desktop uses resolvconf and local DNS and it is specified in /etc/NetworkManager/NetworkManager.conf (entry dns=dnsmasq).

Related Question