How to make mDNSResponder to resolve local domain names?

eonil

New Member


Messages: 16

I installed mDNSResponder from port.

Code:
cd /usr/ports
portmaster net/mDNSResponder
echo 'mdnsd_enable="YES"' >> /etc/rc.conf
service mdnsd restart

After that, I modified /etc/nsswitch.conf to add mdns to host: entry.

It works well. My OSX box can find FreeBSD box via name. But, FreeBSD box cannot find OSX box with name. It also cannot find other FreeBSD box too. I think there's some problem on resolving name to IP address feature.


Code:
root@freebsd9:~ # mDNSIdentify freebsd9.local
freebsd9.local. Addr 192.168.0.105
freebsd9.local has no HINFO record
mDNS_PurgeCacheResourceRecord: Lock not held! mDNS_busy (0) mDNS_reentrancy (0)
mDNS_PurgeCacheResourceRecord: Lock not held! mDNS_busy (0) mDNS_reentrancy (0)

^Croot@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
curl: (6) Could not resolve host: freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://localhost
curl: (7) Failed connect to localhost:80; Connection refused
root@freebsd9:~ #


So, name advertising is working well, but name resolution doesn't work.
How can make it to work?
 

kpa

Beastie's Twin

Reaction score: 1,848
Messages: 6,318

Do you have dns/nss_mdns installed? Also is the line in your /etc/nsswitch.conf something like this:

Code:
hosts: files mdns_minimal [NOTFOUND=return] dns mdns
 
OP
eonil

eonil

New Member


Messages: 16

That solved the issue. Thanks.

Anyway, nss_mdns has a hard dependency on Avahi, so it installs Avahi. I chose mDNSResponder to avoid the heavy dependencies of Avahi, so actually this avoids my intention :(

So I decided just to go Avahi.
 
OP
eonil

eonil

New Member


Messages: 16

Oh looks nice.

Anyway, I am not currently on the mDNS stuff, so currently I can't test it.
But if I get another chance I will try it.

Thanks for information.
 

kpa

Beastie's Twin

Reaction score: 1,848
Messages: 6,318

@Mazhe, you have to support staging in your new port to have it accepted to the ports tree, the attached patch should do the job. It modifies the Makefile and the pkg-plist files.
 

Attachments

  • dns-mDNSResponder_nss-stage.diff.txt
    1.4 KB · Views: 164
Last edited by a moderator:

Mazhe

New Member

Reaction score: 3
Messages: 2

kpa said:
@Mazhe, you have to support staging in your new port to have it accepted to the ports tree, the attached patch should do the job. It modifies the Makefile and the pkg-plist files.

Thanks, people wanting to try the last version can do so: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/178052&getpatch=4

But yet there's a problem inside of mDNSResponder which makes every query answer be 0.0.0.0 or ::0 (when network frames seems to be OK). It is even not FreeBSD-specific as it happens under also under GNU/Linux, so...
 
Last edited by a moderator:
Top