mDNS Name Resolution
Today I made mDNS name resolution work, but first a little background about my network. I have a desktop PC called eddie, a laptop called hactar, a Netwinder cunning called netwinder, and an iPaq h5500 called ipaq. All of these machines connect to a wireless ADSL router and ask it for an IP address using DHCP, it gives them one and the DNS server, and all is good... until I want to ssh into the Netwinder from my laptop, and then scp files onto the iPaq, as I don't know the IP addresses.
Until now my solution has been to do a broadcast ping with ping -b 192.168.10.255 and try the IPs which respond, but now I've finally found a sane mDNS name resolution plugin for NSS. This is trivially installed and configured (add mdns4 to the hosts line in /etc/nsswitch.conf), but depends on a mDNS responder to be running on each machine. Luckily, Howl is currently in Debian (though not for long), so after quickly installing it on all of the machines to my surprise it Just Worked:
ross@hactar ~
$ getent hosts netwinder.local
192.168.10.104 netwinder.local
$ getent hosts ipaq.local
192.168.10.105 ipaq.local
Excellent!
NP: Vertigo, Groove Armada
dhcpd.conf:
ddns-update-style ad-hoc;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
ddns-updates on;
ddns-domainname "lan";
ddns-rev-domainname "in-addr.arpa";
option domain-name "lan";
option domain-name-servers 192.168.0.2;
default-lease-time 600;
max-lease-time 7200;
key mykey {
algorithm hmac-md5;
// Same secret as in /etc/bind/named.conf
secret "";
};
zone lan. {
primary 192.168.0.2;
key mykey;
}
zone 0.168.192.in-addr.arpa. {
primary 192.168.0.2;
key mykey;
}
range 192.168.0.100 192.168.0.120;
default-lease-time 600;
max-lease-time 7200;
}
named.conf:
<code>
key "mykey" {
algorithm hmac-md5;
// Make the secret below with <some util i can't remember> ;)
secret "";
};
options {
directory "/var/bind";
listen-on-v6 { none; };
auth-nxdomain yes;
pid-file "/var/run/named/named.pid";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "pri/localhost";
allow-update { none; };
notify no;
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "pri/127.0.0";
allow-update { none; };
notify no;
};
zone "lan" {
type master;
file "pri/lan.zone";
allow-update { key mykey; };
};
zone "0.168.192.in-addr.arpa" {
type master;
file "pri/lan.reversed";
allow-update { key mykey; };
};
</code>
Unfortunately, mDNS Responder is licensed under the APSL, and hence it will soon be removed or make the move to non-free (see Bug#289856).
The rest of howl is fine though, so maybe someone (Porchdog?) will bother rewritting it at some point.
I have needed a solution to exactly this problem for months. Looks like all that time idled away reading Planet Gnome has paid off. Thanks!
I have needed a solution to exactly this problem for months. Looks like all that time idled away reading Planet Gnome has paid off. Thanks!