# Very slow connection when using mdns



## wombat (Apr 6, 2014)

I've just installed FreeBSD 10 on one of my machines and I've been experiencing very slow speeds connecting to my machine through ssh for the initial connection. Here is some more info:


The network is mostly composed of Mac OS X machines and a bunch of linux boxes, everything uses mdns(Bonjour and Avahi) for host resolution. IP and DNS server is set via DHCP.
DNS points to ASUS router
FreeBSD machine has avahi and nss_mdns installed and configured. _mdns_ was added to nsswitch.conf after _files_
FreeBSD machine can ping itself or any host via _hostname_ and _hostname_.local. All machines on the network can ping the FreeBSD machine likewise

From my Macbook Air I try to connect to FreeBSD using `ssh hostname` is almost instantaneous, but attempting `ssh hostname.local` is extremely slow by comparison. Any ideas on what is going on? While searching through the forums, there was a suggestion to also use 
	
	



```
useDNS=false
```
 in _sshd_config_ but that made no difference for me.


----------



## wblock@ (Apr 6, 2014)

Modifying sshd_config will only affect sshd(8), not ssh(1).

Compare the output from `ssh -v -v -v hostname` with that from `ssh -v -v -v hostname.local`.


----------



## wombat (Apr 6, 2014)

Right, but that's the thing, it's sshd that seems to be holding up things on the server side for some reason. None of my other machines show this issue, it always happens when connecting to FreeBSD.

I forgot to mention that I already tried to run with the verbose options and couldn't see a difference. Unfortunately there are no timings that show where exactly the client is being held up.

I should also have mentioned that I use certificates, although that shouldn't make a difference.


----------



## wblock@ (Apr 6, 2014)

Because vague variable names make it really hard to see what is going on, let's just make sure of the details:

Running ssh(1) on the Mac.
Running sshd(8) on FreeBSD.

The Mac can ping the FreeBSD system as both freebsdname and freebsdname.local.

What does the Mac show as the name of the FreeBSD system from `nslookup [i]freebsd-ip-address[/i]`?


----------



## wombat (Apr 6, 2014)

Everything you said is correct. 

The output of the `nslookup freebsd-ip-address` shows:


```
freebsd-ip-address.in-addr.arpa	name = freebsdname.
```

The ip address matches the expected value.


----------



## trh411 (Apr 6, 2014)

wombat said:
			
		

> The output of the `nslookup freebsd-ip-address` shows:


And what do you get when you substitute the actual IP address of the FreeBSD server (e.g., 10.0.1.25) for "_freebsd-ip-address_" when executing the `nslookup` command?


----------



## wombat (Apr 7, 2014)

OK, fair enough, I see that my use of variables is confusing everybody and it'a not like I'm using an external facing server running the CIAs network  :e, so let me clarify this

FreeBSD machine = wallaby 
MacOS X machine = bandicoot

From bandicoot: `ping wallaby`

```
PING wallaby (192.168.1.174): 56 data bytes
64 bytes from 192.168.1.174: icmp_seq=0 ttl=64 time=0.966 ms
64 bytes from 192.168.1.174: icmp_seq=1 ttl=64 time=3.029 ms
64 bytes from 192.168.1.174: icmp_seq=2 ttl=64 time=2.913 ms
```

From bandicoot: `ping wallaby.local`

```
PING wallaby.local (192.168.1.174): 56 data bytes
64 bytes from 192.168.1.174: icmp_seq=0 ttl=64 time=0.966 ms
64 bytes from 192.168.1.174: icmp_seq=1 ttl=64 time=3.029 ms
64 bytes from 192.168.1.174: icmp_seq=2 ttl=64 time=2.913 ms
```

from bandicoot: `nslookup 192.168.1.174`

```
Server:		192.168.1.1
Address:	192.168.1.1#53

174.1.168.192.in-addr.arpa	name = wallaby.
```


----------



## wombat (Apr 12, 2014)

Still no luck in my investigation. I have an easy workaround of just using the hostname, but at this point I'm just curious why it's not working with avahi. As far as I can tell, I didn't use to get this issue when using Linux where I also used avahi, but I might just never have noticed.

If anybody has any ideas on how to investigate this on the server side, that would be greatly appreciated.


----------

