# DNS and *.local



## sumsidumm (Mar 7, 2014)

Hi all,

I have a problem with my DNS. My DNS is a FritzBox router.  If I try to ping for example google.com the ping runs without a problem. But If I try to ping a host that is in the local network and has a name like printer.local the ping returns:

```
ping: cannot resolve printer.local: Unknown host
```

From another system it runs without problems. 

`cat /etc/resolv.conf` returns:

```
# Generated by resolvconf
search local
nameserver 10.0.0.1
```

The DNS address is right. Where is the problem? How can I fix this?

Greetings,
sumsi


----------



## junovitch@ (Mar 7, 2014)

I would suggest reading http://en.wikipedia.org/wiki/.local regarding multicast DNS.  My guess is that the "other system" you mentioned isn't querying that name server but using multicast DNS properly.  Can you provide more details on that system?  I don't believe you should need to have the search statement in your /etc/resolv.conf as it interferes with multicast DNS working properly.


----------



## wblock@ (Mar 8, 2014)

Maybe the .local entries have been entered in the other computer's /etc/hosts rather than on the DNS server.


----------



## sumsidumm (Mar 8, 2014)

Thx Thanks. It seems that the other systems are configured properly. The hosts file does not contain any of those addresses. Which information do you need from the system that I can get mDNS working?

Greetings,
Sumsi


----------



## J65nko (Mar 9, 2014)

You could check with dig whether the correct nameserver, the one in your /etc/resolv.conf is being used.

`$ dig printer.local`

```
; <<>> DiG 9.4.2-P2 <<>> printer.local
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 18105
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;printer.local.                 IN      A

;; Query time: 7 msec
;; SERVER: 192.168.222.10#53(192.168.222.10)
;; WHEN: Sun Mar  9 00:56:01 2014
;; MSG SIZE  rcvd: 31
```
In my case this name is not found either, but it shows that in the "SERVER" line that the  192.168.222.10 nameserver was used. And that server is mentioned in my /etc/resolv.conf file:
`$ grep nameserver /etc/resolv.conf`

```
nameserver 192.168.222.10
```

BTW In case your 10.0.0.1 name server is not being used, you also can tell dig to use a specific nameserver, and thus override the one(s) mentioned in/etc/resolv.conf: `$ dig printer.local @10.0.0.1`. If you are using FreeBSD 10, where dig is not part of the base system any more, see Digging for hosts on FreeBSD 10 for some alternative tools or a pointer how to get dig.


----------



## sumsidumm (Mar 11, 2014)

I have no `dig` on this system. How can I get this? `pkg_add git` means 

```
pkg_add: can't stat package file 'dig'
```

My system is: 9.1-RELEASE-p5 FreeBSD 9.1-RELEASE-p5 #0


----------



## SirDice (Mar 11, 2014)

You need to enter the hostname and IP address somewhere in your router. Your router is acting as a local DNS server and anything local you want to resolve has to be entered there. I'm sure it's manual has something about adding hostnames to it's DNS.


----------



## sumsidumm (Mar 11, 2014)

No. There is no section to enter hostnames. The problem is that I need to run the mDNS. Than it should work. But I don't know howto.


----------



## J65nko (Mar 11, 2014)

sumsidumm said:
			
		

> I have no `dig` on this system. How can I get this? `pkg_add git` means
> 
> ```
> pkg_add: can't stat package file 'dig'
> ...



On a 9.1 system you should have  dig. It is part of the FreeBSD base system :

```
$ uname -a ; which dig

FreeBSD clone-1s.test 9.1-RELEASE-p10 FreeBSD 9.1-RELEASE-p10 #0: Sun Jan 12 20:11:23 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

/usr/bin/dig
```


----------



## junovitch@ (Mar 11, 2014)

I know it's supposed to be Avahi.  I've never set it up manually.  A quick search online lead to this.  http://www.alexforencich.com/wiki/en/freebsd/installing_avahi


----------



## kpa (Mar 11, 2014)

There's a lighter alternative to avahi that works quite ok, net/mDNSResponder.


----------



## gqgunhed (Mar 13, 2014)

Hi sumsi,

have you changed the domain part of your Fritz!Box? Because as default it uses the *.box* domain.
If your clients get IPs and DNS info from the Fritz!Box, the Fritz!Box will append its own domain suffix.
So it's more likely that it will answer a request for "printer.box" than for "printer.local".

Have you tried:
`# dig printer.local`
or more specific
`# dig @10.0.0.1 printer.local`
to force a DNS query to 10.0.0.1.

And what does a reverse DNS lookup tell you?
e.g. if the IP of your printer is 10.0.0.73 you must query your DNS like so:
`# dig -x 10.0.0.73`
and look at the returned DNS hostname, and especially the domain part of it.

Additional DNS domains with corresponding DNS servers/resolvers can be defined on the Fritz!Box under Advanced Settings/Network/... (sorry, dont' have access to one at the moment so I cant' give the exact location).


----------



## kpa (Mar 13, 2014)

Do not use .local domain with the traditional DNS, it's strictly reserved for mDNS host name resolution and service advertisement. Use the Avahi or the other solution I posted above for .local. If you want to use a local made up domain name you can use something like .mylan as the domain name assuming you have a local DNS server/forwarder that serves names from that domain.


----------



## sumsidumm (Mar 15, 2014)

```
uname -a ; which dig
```


```
FreeBSD nas.local 9.1-RELEASE-p5 FreeBSD 9.1-RELEASE-p5 #0 r254466M: Sat Aug 17 22:54:02 CEST 2013     root@dev.nas4free.org:/usr/obj/nas4free/usr/src/sys/NAS4FREE-i386  i386
dig: Command not found.
```


----------

