Network printing at home, over-engineered.

Compared to most other home networks, mine is a bit more complicated. I admit networking has always been an interest of mine, so I run my own OpenBSD firewall/router/vpn-endpoint, which itself runs the ISC Dhcpd v3 and BIND. With these together, I am able to run dynamic DNS. But some background first.

Insert my 11-year old HP2100m printer that I have outfitted with an HP Jetdirect 610N 10/100 internal print server. This allows me to stick this printer on my network and print away, no intermediary required. What does this save? The printer is not tied to one computer’s parallel/USB port. I can shut off my main desktop, and still print over the network.

The next problem: Who wants to print to 10.10.0.205? Hard coding an IP address into the printer config is just asking for bad news, especially with DHCP involved. Better yet, if I shut off the printer for a week, its DHCP lease could expire, and upon restarting the printer, it could grab 10.10.0.215. Now I have to go around and fix my printer config, my wife’s, and all the other devices.

Enter dynamic DNS:

Snippet from /etc/dhcpd.conf:

# Dynamic Updates ddns-updates on; ddns-update-style interim;  host hp2100m { hardware ethernet 00:01:e6:23:df:4f; ddns-hostname "hp2100m"; } 

Here we see I have specified the MAC address of the print server and the dynamic dns host name. According to the page which I stole most of the information from, you can specify a ddns-domain-name as well. When trying to do that, I recieved the following error:

/etc/dhcpd.conf line 60: semicolon expected.   ddns-domain-name "home.foobar.net" 

Even with the semicolons present, I still need to tinker around with that line and figure out why I can’t set the domain name explicitly. I can only assume the domain name is deduced according to the layer 3 subnet which the printer is on.

Now you need the BIND configuration from named.conf

zone "home.foobar.net" IN { type master; file "master/db.home.foobar.net"; allow-update { key "ddns-key"; }; };  zone "0.10.10.in-addr.arpa" IN { type master; file "master/db.10.10.0"; allow-update { key "ddns-key"; }; }; 

These are the forward and reverse DNS respectively. Using a shared key, this enables only the allowed DHCPd to enable DNS records on this particular BIND server.

Snippet from daemon log:

Sep 24 08:29:12 formangate dhcpd: DHCPDISCOVER from 00:01:e6:23:df:4f via vr1 Sep 24 08:29:13 formangate dhcpd: DHCPOFFER on 10.10.0.205 to 00:01:e6:23:df:4f (hp2100m) via vr1 Sep 24 08:29:18 formangate dhcpd: Added new forward map from hp2100m.home.foobar.net to 10.10.0.205 Sep 24 08:29:18 formangate dhcpd: added reverse map from 205.0.10.10.in-addr.arpa to hp2100m.home.foobar.net Sep 24 08:29:18 formangate dhcpd: DHCPREQUEST for 10.10.0.205 (10.10.0.1) from 00:01:e6:23:df:4f (hp2100m) via vr1 Sep 24 08:29:18 formangate dhcpd: DHCPACK on 10.10.0.205 to 00:01:e6:23:df:4f (hp2100m) via vr1 

This shows the DHCP server interacting with the printer, and then sending the new forward and reverse DNS mappings to the DNS server.

I can now ping hp2100m from machines at home, and configure all printing to use that hostname, no matter what IP address it points to.

jforman@server1f:~$ ping hp2100m PING hp2100m.home.foobar.net (10.10.0.205) 56(84) bytes of data. 64 bytes from hp2100m.home.foobar.net (10.10.0.205): icmp_seq=1 ttl=64 time=5.69 ms 

*Note: The configuration snippets above are not complete, and will require other information to complete this roll out and enable Dynamic DNS.