DNS does not work - RPi does not advertise itself


11 posts
by gskillas » Thu Jan 10, 2013 7:54 am
Hello all

I have a small home network with 5 computers on WLAN / Ethernet three with SUSE 12.x one Win7 and the RPi. I am using the router to provide DHCP and DNS services which works for all except the Pi. NMAP shows router, SUSE Box and Pi.
Code: Select all
# nmap 192.168.178.0/24

Starting Nmap 6.01 ( http://nmap.org ) at 2013-01-10 08:47 CET
Nmap scan report for speedport.ip (192.168.178.1)
Host is up (0.0023s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
80/tcp   open  http
443/tcp  open  https                                                           
5060/tcp open  sip                                                             
MAC Address: 00:1C:4A:24:26:4F (AVM GmbH)                                       
                                                                               
Nmap scan report for 192.168.178.100                                           
Host is up (0.0014s latency).                                                   
Not shown: 996 closed ports                                                     
PORT     STATE SERVICE                                                         
22/tcp   open  ssh                                                             
80/tcp   open  http                                                             
631/tcp  open  ipp                                                             
6566/tcp open  sane-port                                                       
MAC Address: B8:27:EB:40:D2:9F (Raspberry Pi Foundation)                       
                                                                               
Nmap scan report for chalki (192.168.178.105)                                   
Host is up (0.0000040s latency).                                               
Not shown: 997 closed ports                                                     
PORT    STATE SERVICE                                                           
22/tcp  open  ssh                                                               
80/tcp  open  http                                                             
111/tcp open  rpcbind                                                           
                                                                               
Nmap done: 256 IP addresses (3 hosts up) scanned in 7.45 seconds

doing an DNS lookup shows:
Code: Select all
# nslookup speedport.ip
Server:         192.168.178.1
Address:        192.168.178.1#53

Name:   speedport.ip
Address: 192.168.178.1

# nslookup kos
Server:         192.168.178.1
Address:        192.168.178.1#53

Name:   kos
Address: 192.168.178.104

# nslookup chalki
Server:         192.168.178.1
Address:        192.168.178.1#53

Name:   chalki
Address: 192.168.178.105

# nslookup alimia
Server:         192.168.178.1
Address:        192.168.178.1#53

** server can't find alimia: NXDOMAIN


logging into the Pi works via IP:
Code: Select all
# ssh 192.168.178.100
root@192.168.178.100's password:
Linux alimia 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jan 10 02:08:16 2013 from chalki
root@alimia:~# hostname
alimia


and avahi is installed and running. Also I tried setting some more exotic options of dhclient.conf to no avail. Anybody an idea what goes wrong?

Regards

George
Posts: 6
Joined: Thu Jan 10, 2013 7:41 am
by jamesh » Thu Jan 10, 2013 8:21 am
That's a bit odd - mine works out of the box in this fashion. What is the make of the router? Does it have any logs saying connection refused or similar?
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11743
Joined: Sat Jul 30, 2011 7:41 pm
by terrycarlin » Thu Jan 10, 2013 9:50 pm
Did you remember to put the .local after the RPi's hostname when you tried to connect to it? It must be there. I am not sure dnslookup will use the zeroconf/bonjour protocol to find a host. Can't test it right now, but ssh, ping, and other utilities including the browsers will as long as they are on the same network.
If it ain't broke, take it apart and see how it works.
User avatar
Posts: 70
Joined: Thu Jun 14, 2012 10:42 pm
by gskillas » Thu Jan 10, 2013 10:41 pm
@jamesh: The make of the router is a Fritz Box, custom make for the T-com (german telecom service). It is equivalent to a AVM Fritz Box 7170. It has worked with openSUSE (and windows) without a glitch.

@terrycarlin: If you look at the code posted you will notice that the .home (domain) is not needed. That is what happens with and without using it:
Code: Select all
root@alimia:~# nslookup chalki
Server:         192.168.178.1
Address:        192.168.178.1#53

Name:   chalki
Address: 192.168.178.105

root@alimia:~# nslookup chalki.home
Server:         192.168.178.1
Address:        192.168.178.1#53

Non-authoritative answer:
Name:   chalki.home
Address: 62.X.Y.133
Name:   chalki.home
Address: 80.A.B.78

root@alimia:~# nslookup alimia
Server:         192.168.178.1
Address:        192.168.178.1#53

** server can't find alimia: NXDOMAIN

root@alimia:~# nslookup alimia.home
Server:         192.168.178.1
Address:        192.168.178.1#53

Non-authoritative answer:
Name:   alimia.home
Address: 62.X.Y.133
Name:   alimia.home
Address: 80.A.B.78


Regards

George
Posts: 6
Joined: Thu Jan 10, 2013 7:41 am
by terrycarlin » Thu Jan 10, 2013 11:01 pm
gskillas wrote:@jamesh: The make of the router is a Fritz Box, custom make for the T-com (german telecom service). It is equivalent to a AVM Fritz Box 7170. It has worked with openSUSE (and windows) without a glitch.

@terrycarlin: If you look at the code posted you will notice that the .home (domain) is not needed. That is what happens with and without using it:
Code: Select all
root@alimia:~# nslookup chalki
Server:         192.168.178.1
Address:        192.168.178.1#53

Name:   chalki
Address: 192.168.178.105

root@alimia:~# nslookup chalki.home
Server:         192.168.178.1
Address:        192.168.178.1#53

Non-authoritative answer:
Name:   
Address: 62.X.Y.133
Name:   chalki.home
Address: 80.A.B.78

root@alimia:~# nslookup alimia
Server:         192.168.178.1
Address:        192.168.178.1#53

** server can't find alimia: NXDOMAIN

root@alimia:~# nslookup alimia.home
Server:         192.168.178.1
Address:        192.168.178.1#53

Non-authoritative answer:
Name:   alimia.home
Address: 62.X.Y.133
Name:   alimia.home
Address: 80.A.B.78


Regards

George


Interesting, but did you try to ssh to chalki.home from alimia? I think that when you ssh to chalki.home you will get a connection, but when you ssh to chalki you will not if you don't have chalki in your /etc/hosts file. Make sure chalki is running the avahi-daemon. I use ssh to raspberrypi.local every day from a mac and other raspberrypi(s) and I have never modified anything other than installing avahi-daemon. I do know that if I don't use the .local, the raspberrypi won't be found.
If it ain't broke, take it apart and see how it works.
User avatar
Posts: 70
Joined: Thu Jun 14, 2012 10:42 pm
by Polydnj » Fri Jan 11, 2013 2:16 pm
Should you be able to ping raspberrypi.local right out of the box if the machine is on the local network?
User avatar
Posts: 25
Joined: Wed Oct 10, 2012 1:59 am
by pluggy » Fri Jan 11, 2013 4:15 pm
Polydnj wrote:Should you be able to ping raspberrypi.local right out of the box if the machine is on the local network?


Probably not, is the fair answer. If your router is doing it for you, then yes, but most routers don't. Windows has its own system to do it, but the Pi doesn't have it installed by default. If you installed samba it wold work like the windows system. There are other options, the least painful if you only need a couple of machines to see the pi is to put the pi hostname and IP address in the clients hosts file. All operating systems have them. Windows is usually C:\windows\system32\drivers\etc\hosts or therabouts.
Don't judge Linux by the Pi.......
User avatar
Posts: 2495
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by gskillas » Fri Jan 11, 2013 7:53 pm
terrycarlin wrote:Interesting, but did you try to ssh to chalki.home from alimia? I think that when you ssh to chalki.home you will get a connection, but when you ssh to chalki you will not if you don't have chalki in your /etc/hosts file. Make sure chalki is running the avahi-daemon. I use ssh to raspberrypi.local every day from a mac and other raspberrypi(s) and I have never modified anything other than installing avahi-daemon. I do know that if I don't use the .local, the raspberrypi won't be found.


Ok here you go. chalki is an opensuse box, avahi running out of the box. domain is set to home,
so chalki.home is a FQDN. This is what happens:
Code: Select all
root@alimia:~# nslookup chalki
Server:         192.168.178.1                                                   
Address:        192.168.178.1#53                                               
                                                                               
Name:   chalki                                                                 
Address: 192.168.178.105                                                       
                                                                               
root@alimia:~# nslookup chalki.home
Server:         192.168.178.1
Address:        192.168.178.1#53

Non-authoritative answer:
Name:   chalki.home
Address: 80.156.86.78
Name:   chalki.home
Address: 62.157.140.133

root@alimia:~# ssh chalki                                                       
Warning: Permanently added the ECDSA host key for IP address '192.168.178.105' to the list of known hosts.                                                     
Password:                                                                       
Last login: Mon Dec 24 11:35:39 2012 from 192.168.178.100                       
Have a lot of fun...                                                           
chalki:~ # exit
logout
Connection to chalki closed.
root@alimia:~# ssh chalki.home
ssh_exchange_identification: read: Connection reset by peer

Now chalki.home does not resolve correctly, chalki does. the /etc/hosts is:
Code: Select all
root@alimia:~# cat /etc/hosts
127.0.0.1       localhost alimia.home alimia
127.0.0.2       alimia.home alimia
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

#127.0.1.1      raspberrypi


Regards,

George
Posts: 6
Joined: Thu Jan 10, 2013 7:41 am
by gskillas » Sat Jan 12, 2013 9:03 am
terrycarlin wrote:Did you remember to put the .local after the RPi's hostname when you tried to connect to it? It must be there. I am not sure dnslookup will use the zeroconf/bonjour protocol to find a host. Can't test it right now, but ssh, ping, and other utilities including the browsers will as long as they are on the same network.


Actually using .local does not work:

Code: Select all
chalki:~> nslookup chalki.local
Server:         192.168.178.1
Address:        192.168.178.1#53

** server can't find chalki.local: NXDOMAIN

chalki:~> nslookup alimia.local
Server:         192.168.178.1
Address:        192.168.178.1#53

** server can't find alimia.local: NXDOMAIN



Regards,

George
Posts: 6
Joined: Thu Jan 10, 2013 7:41 am
by efflandt » Sat Jan 12, 2013 5:50 pm
Note that if you have avahi-daemon installed in Linux, and Bonjour in Windows (from Apple, which uses that for zeroconfig), gethostbyname in applications may be able to find names by their hostname.local, even if DNS cannot resolve them:
Code: Select all
efflandt@XPS8100-1204:~$ host raspberrypi.local
host: '.local' is not in legal name syntax (empty label)

efflandt@XPS8100-1204:~$ ping -c2 raspberrypi.local
PING raspberrypi.local (172.16.0.102) 56(84) bytes of data.
64 bytes from raspberrypi.domain_not_set.invalid (172.16.0.102): icmp_req=1 ttl=64 time=92.4 ms
64 bytes from raspberrypi.domain_not_set.invalid (172.16.0.102): icmp_req=2 ttl=64 time=17.3 ms

--- raspberrypi.local ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 17.314/54.874/92.435/37.561 ms

efflandt@XPS8100-1204:~$ ssh raspberrypi.local
Linux raspberrypi 3.6.11+ #348 PREEMPT Tue Jan 1 16:33:22 GMT 2013 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Jan 11 19:18:05 2013 from xps8100-1204.local
efflandt@raspberrypi ~ $
Posts: 359
Joined: Mon Dec 03, 2012 2:47 am
Location: Elgin, IL USA
by gskillas » Sun Jan 13, 2013 10:36 am
@efflandt: Too bad it does not work as advertised:
Code: Select all
chalki:~> ping -c2 alimia.local
ping: unknown host alimia.local


@jamesh: I did solve the issue. It involves using dhcpcd instead of dhclient. How to do this is detailed in:

https://wiki.umiacs.umd.edu/VirtualMeshTest/index.php/Enabling_DHCP_client_with_automatic_hostname_allocation

now everything works as expected (TM).

Regards,

George
Posts: 6
Joined: Thu Jan 10, 2013 7:41 am