Installation of mDNSResponder
Contents of mDNSResponder
mDNSResponder takes care of two basic things:
- multicast DNS, for resolving of hostnames
- DNS-SD for Service Discovery using DNS
It will not take care of link-local IP addresses. For that, please use
ZCIP∞ or
zeroconf∞.
Alternative implementations of mDNS (and DNS-SD) include
tmdns∞,
howl∞,
Avahi∞,
Liaison∞ and
pyZeroConf∞.
Download
First of all, download mDNSResponder. Depending on your OS:
Installation
tar xzf
cd mDNSResponder-58.8/mDNSPosix
make os=linux
make install os=linux
Note that the mDNSResponder installer in mDNSPosix only installs the daemon (along with init.d script and libnss_mdns), but not user-level applications, like mDNSResponderClient and mDNSIdentify.
Testing
On vangogh8:
build/mDNSResponderPosix -n vangogh8
On vangogh7:
build/mDNSIdentify vangogh8.local
Result:
vangogh8.local. Addr 195.169.124.42
vangogh8.local. Addr 169.254.131.94
Host has no HINFO record; Best guess is Jaguar version of mDNSResponder with no IPv6 support
Enable Bonjour in Applications
Bonjour contains a multicast DNS server, which listens on (multicast) IP address 224.0.0.251 (as well as on FF02::FB), port 5353. Now, if your application wants to make specific use of DNS service discovery (DNS-SD), you just hook up to the API found in /usr/include/dns-sd.h. However, if you don't care about service discovery, but only in name resolution, you will not use that API, but instead just want to use gethostbyaddr() and gethostbyname(). In fact, you probably want that all existing applications which already use these two functions in the socket library are not changed, but fully automatically can map from mycomputer.local. to 169.254.13.68 and back.
There are two ways to modify the behaviour of gethostbyaddr() and gethostbyname to do just that:
- Add mDNS to the Name Service Switch
- Install a DNS server at localhost, and forward mDNS queries to port 5353
Add mDNS to the Name Service Switch
NSS_MDNS (mDNS for Name Service Switch) library
A great thing about mDNSResponder is, that it not only installs the mdns daemon (called mdnsd rather then mDNSResponder on linux), but also a library called libnss_mdns, which takes care that the appropriate lookups by gethostbyname() and gethostbyaddr() are handled by mdns, rather then by dns. It does so, by modifying /etc/nsswitch.conf to list "hosts: files mdns dns" instead of "hosts: files dns".
Install a DNS server at localhost, and forward mDNS queries to port 5353
(to be written)
Categories
CategoryZeroconf
There are no comments on this page. [Add comment]