Recent Posts

Archives

Topics


« | Main | »

Hacking the ReadyNAS DHCP Server

By dbott | October 1, 2009

The ReadyNAS has a built-in DHCP server that can be configured to provide IP addresses much like a typical home router.  The DHCP server installed on the ReadyNAS x86-based devices is udhcpd:

ReadyNAS-2100:~# apt-cache show udhcpd

Package: udhcpd
Status: install ok installed
Priority: optional
Section: net
Installed-Size: 156
Maintainer: Eric Van Buggenhaut <ericvb@debian.org>
Architecture: i386
Source: udhcp
Version: 0.9.8cvs20050303-2.netgear1
Provides: dhcp3-server
Depends: libc6 (>= 2.3.6-6)
Conffiles:
 /etc/init.d/udhcpd 7765efe3dfa0d9c39821e55eb8ea6138
Description: very small DHCP server
 DHCP is a protocol like BOOTP (actually dhcpd includes much of
 the functionality of BOOTPD!). It assigns IP addresses to clients
 based on lease times.
 This package is primarily geared towards embedded systems. It does however,
 strive to be fully functional, and RFC compliant.
 .
 This is the server-side application.

Package: udhcpd
Priority: optional
Section: net
Installed-Size: 156
Maintainer: Eric Van Buggenhaut <ericvb@debian.org>
Architecture: i386
Source: udhcp
Version: 0.9.8cvs20050303-2
Provides: dhcp3-server
Depends: libc6 (>= 2.3.5-1)
Filename: pool/main/u/udhcp/udhcpd_0.9.8cvs20050303-2_i386.deb
Size: 24412
MD5sum: bacdb88136aea5f430fd14ea970988aa
SHA1: 28ebb1937dd791271cc44f7f1fcd9ce3fbd80939
SHA256: 12b19dd7135e49808d71daac978076c2ea439e4d5f7347e3289b619a0987129e
Description: very small DHCP server
 DHCP is a protocol like BOOTP (actually dhcpd includes much of
 the functionality of BOOTPD!). It assigns IP addresses to clients
 based on lease times.
 This package is primarily geared towards embedded systems. It does however,
 strive to be fully functional, and RFC compliant.
 .
 This is the server-side application.
Tag: interface::daemon, network::server, protocol::dhcp, role::program

At work, I have 3 ReadyNAS 2100 devices providing an online, distributed, disk-based backup solution.  I have a primary ReadyNAS 2100 that maintains a backup of each server on the network (consisting of about a dozen Windows & RedHat servers) and 2 ReadyNAS 2100’s installed at a couple of our remote sites.  Each night, I generate a snapshot of the primary ReadyNAS and then use rsync to distribute a copy of the backups to each remote site.

Before I purchased the ReadyNAS 2100 units, I used to have a couple of old Windows NT 4 servers installed at the remote sites to provide DHCP & print services, as well as provide a bit of local storage for software distribution.  Part of my upgrade to the ReadyNAS was to retire the old NT servers and use the 2100 to provide DHCP services.  The only downside was that the UI for the DHCP server only provides limited functionality and lacks the ability to view active leases, make static reservations and a few other options that may be useful.

Adding Additional Options

Simply editting the /etc/udhcp.conf file on the ReadyNAS will allow you to add the missing functionality.  The only downside is that these options are not visible from within Frontview and can only be accessed from the shell.

ReadyNAS-2100:~# cat /etc/udhcpd.conf
# This file is auto-generated.  Do not modify!

auto_time       60
interface       eth0
option wins     192.168.128.25
option dns      192.168.128.25
option dns      192.168.128.35
option domain   mydomain.ca
option lease    604800
option subnet   255.255.255.0
option router   192.168.129.1
start   192.168.129.50
end     192.168.129.199

# Static Lease Map
static_lease 00:60:08:xx:xx:xx 192.168.129.54
static_lease 00:60:08:xx:xx:xx 192.168.129.64

For a list of available options, check the udhcpd man page.

Viewing Active Leases

As mentioned above, you will need SSH access to your ReadyNAS in order to view active DHCP leases.  udhcpd stores the leases in a binary format in the /var/lib/misc/udhcpd.leases file.  To view the binary udhcpd.leases file you need to use the dumpleases program:

ReadyNAS-2100:~# dumpleases -f /var/lib/misc/udhcpd.leases

Mac Address       IP-Address      Expires in
00:13:72:bb:xx:xx 192.168.129.55  6 days, 18 hours, 23 minutes, 24 seconds
00:13:72:b9:xx:xx 192.168.129.53  6 days, 18 hours, 24 minutes, 53 seconds
00:13:72:be:xx:xx 192.168.129.54  6 days, 18 hours, 26 minutes, 8 seconds
00:13:72:bd:xx:xx 192.168.129.67  6 days, 18 hours, 27 minutes, 29 seconds
00:13:72:bb:xx:xx 192.168.129.56  6 days, 18 hours, 31 minutes, 13 seconds
00:21:70:3b:xx:xx 192.168.129.71  6 days, 18 hours, 32 minutes, 29 seconds
00:21:70:3b:xx:xx 192.168.129.61  6 days, 18 hours, 35 minutes, 5 seconds
00:21:70:3b:xx:xx 192.168.129.73  6 days, 18 hours, 39 minutes, 47 seconds
00:21:70:3a:xx:xx 192.168.129.58  6 days, 18 hours, 40 minutes, 45 seconds
00:21:70:3a:xx:xx 192.168.129.69  6 days, 18 hours, 41 minutes, 46 seconds
00:21:70:3a:xx:xx 192.168.129.70  6 days, 18 hours, 43 minutes, 59 seconds
00:0e:a6:99:xx:xx 192.168.129.50  6 days, 18 hours, 56 minutes, 37 seconds
00:0e:a6:99:xx:xx 192.168.129.51  6 days, 18 hours, 49 minutes, 22 seconds
00:0e:a6:c0:xx:xx 192.168.129.66  6 days, 19 hours, 2 minutes, 33 seconds
00:11:d8:5a:xx:xx 192.168.129.63  6 days, 18 hours, 54 minutes, 55 seconds
00:13:72:bb:xx:xx 192.168.129.52  6 days, 18 hours, 58 minutes, 14 seconds
00:13:72:b5:xx:xx 192.168.129.57  6 days, 20 hours, 6 minutes, 18 seconds

Disclaimer: Performing any of the following modifications to your ReadyNAS requires SSH access and may result in Netgear denying you support, or worse, bricking your NAS.  Please make sure you always have a backup of your data. YMMV.

For those interested in using the ReadyNAS for wake-on-lan capabilities, please see this post: http://home.bott.ca/webserver/?p=340

Topics: ReadyNAS, Tech | 3 Comments »

3 Responses to “Hacking the ReadyNAS DHCP Server”

  1. dbott Says:
    December 13th, 2009 at 7:06 pm

    Here’s a post I made showing how to use the ReadyNAS to wake-up computers that support WoL:

    http://www.readynas.com/forum/viewtopic.php?f=31&t=36277&p=203151#p203151

  2. Using the ReadyNAS as a Wake-on-LAN Device | The Bott Blog Says:
    January 30th, 2010 at 12:03 pm

    […] Hacking the ReadyNAS DHCP Server […]

  3. Unofficial ReadyNAS Getting Started Guide | The Bott Blog Says:
    February 2nd, 2010 at 1:01 pm

    […] Hacking the ReadyNAS DHCP Server […]