PDA

View Full Version : [SOLVED] DNS not working via command line



Mike_Gruszka
January 11th, 2015, 10:44 PM
Hello, I just installed my first server. I appreciate your help and patience.

My server is directly connected to a Comcast cable modem and receiving its IP address via dhcp. I have a second NIC installed serving IPs to my LAN devices via the installed dhcp server. My LAN devices are working fine; they can receive an address and browse the web without issue. Via command line, however, I am having issues.

I noticed this when trying to update via apt-get and received resolution errors:

Could not resolve 'us.archive.ubuntu.com'
Could not resolve 'security.ubuntu.com'


My resolv.conf file is appropriately showing the DNS servers provided by Comcast.


freshjerky@rose:~$ more /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 75.75.75.75
nameserver 75.75.76.76
search hsd1.pa.comcast.net


And I can resolve the IP address using host.

freshjerky@rose:~$ host us.archive.ubuntu.com 75.75.75.75
Using domain server:
Name: 75.75.75.75
Address: 75.75.75.75#53
Aliases:


us.archive.ubuntu.com has address 91.189.91.15
us.archive.ubuntu.com has address 91.189.91.24
us.archive.ubuntu.com has address 91.189.91.23
us.archive.ubuntu.com has address 91.189.91.13
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::13
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::17
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::16
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::15

I cannot ping the site by name.

freshjerky@rose:~$ ping us.archive.ubuntu.com
ping: unknown host us.archive.ubuntu.com


Yet, I can ping the site by its IP address.


freshjerky@rose:~$ ping 91.189.91.15
PING 91.189.91.15 (91.189.91.15) 56(84) bytes of data.
64 bytes from 91.189.91.15: icmp_seq=1 ttl=54 time=27.0 ms
64 bytes from 91.189.91.15: icmp_seq=2 ttl=54 time=27.3 ms
64 bytes from 91.189.91.15: icmp_seq=3 ttl=54 time=29.8 ms
64 bytes from 91.189.91.15: icmp_seq=4 ttl=54 time=26.8 ms
^C
--- 91.189.91.15 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 26.889/27.799/29.885/1.214 ms

I appreciate any help and guidance you can provide. Here are some additional configurations you may ask for:


freshjerky@rose:~$ more /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).


# The loopback network interface
auto lo
iface lo inet loopback


# The primary network interface
auto WAN
iface WAN inet dhcp


# The internal network interface
auto LAN
iface LAN inet static
address 10.10.10.1
netmask 255.255.255.0
post-up iptables-restore < /etc/iptables.up.rules



freshjerky@rose:~$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 73.30.32.1 0.0.0.0 UG 0 0 0 WAN
10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 LAN
73.30.32.0 0.0.0.0 255.255.248.0 U 0 0 0 WAN


freshjerky@rose:~$ sudo iptables --list --verbose
Chain INPUT (policy ACCEPT 12944 packets, 2225K bytes)
pkts bytes target prot opt in out source destination


Chain FORWARD (policy ACCEPT 52303 packets, 42M bytes)
pkts bytes target prot opt in out source destination


Chain OUTPUT (policy ACCEPT 8568 packets, 1282K bytes)
pkts bytes target prot opt in out source destination

sanderj
January 11th, 2015, 11:57 PM
All these tests are done on the Ubuntu Server?

Which version of Ubuntu?

Post result of:


host us.archive.ubuntu.com

and


nslookup us.archive.ubuntu.com

Mike_Gruszka
January 12th, 2015, 12:05 AM
This is a new install with 14.04. Both host and nslookup return successfully.



freshjerky@rose:~$ host us.archive.ubuntu.com
us.archive.ubuntu.com has address 91.189.91.24
us.archive.ubuntu.com has address 91.189.91.13
us.archive.ubuntu.com has address 91.189.91.15
us.archive.ubuntu.com has address 91.189.91.23
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::16
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::17
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::13
us.archive.ubuntu.com has IPv6 address 2001:67c:1562::15




freshjerky@rose:~$ nslookup us.archive.ubuntu.com
Server: 75.75.75.75
Address: 75.75.75.75#53
Non-authoritative answer:
Name: us.archive.ubuntu.com
Address: 91.189.91.13
Name: us.archive.ubuntu.com
Address: 91.189.91.24
Name: us.archive.ubuntu.com
Address: 91.189.91.23
Name: us.archive.ubuntu.com
Address: 91.189.91.15

sanderj
January 12th, 2015, 12:18 AM
14.04? How did that info get into /etc/resolv.conf ? Did you do that yourself by hand?

Because on 14.04+ it should look this:


$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search lan

Mike_Gruszka
January 12th, 2015, 12:25 AM
I didn't edit it. I assume it updates automatically based on the information provided by the dhcp server. It's the same information that was previously provided to my router before I put this server in its place. When the server was first behind my router, it showed nameserver 192.168.1.1, which was the internal address of my router. I didn't touch the file in either case.

Mike_Gruszka
January 12th, 2015, 03:46 AM
I was able to solve this problem by retracing the work I did today. As part of a setup to enable the server as a time machine destination, I needed to edit the hosts line of /etc/nsswitch.conf to "files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns". I had left a typo of "files mdns4_minimal [NOTFOUND=return] dn mdns4 mdns". This managed to make pings and apt-get fail dns lookups.

As for why my resolv.conf file looked funny, I also figured this out. It was due to bind not yet being configured. After reconfiguration, my resolv.conf file looks like yours.

Thanks for the assistance.

sanderj
January 12th, 2015, 07:48 AM
Great it works!