Installing The DHCP Server on Freenas
This article provides details on how to install the ISC DHCP Server on a FreeNAS 8.x RELEASE server.
Before you begin enable SSH service in freenas
Download putty to your PC : http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Installation Steps
- Logon to the FreeNAS Server through SSH as the root user using putty
- Mount the root partition as read / write by executing the following command
mount -urw /
- Change directory to the tmp directory by executing the following command
cd /tmp
- Install the package by executing the following command
pkg_add -r isc-dhcp31-server
The installation is now complete and the next article explains how to create a basic configuration and start the DHCP Server.
Now download a windows SFTP client called WINSCP : http://winscp.net/download/winscp439.zip
create a file called dhcpd.conf with following contents
# File content starts
# Below is an example of the above using the 192.168.0.0 IP Subnet with a netmask of 255.255.255.0
ddns-update-style ad-hoc;
log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.20 ;
default-lease-time 600;
max-lease-time 7200;
}
# file content ends here
Now using winscp copy the above file to /conf/base/etc/local/dhcpd.conf
Now again use putty to execute following scripts.
- Copy the isc-dhcpd daemon to the /conf/base/etc/local/rc.d folder by executing the following command :-
cp /etc/local/rc.d/isc-dhcpd /conf/base/etc/local/rc.d/.
- Copy the rc.conf file to the /conf/base/etc folder by executing the following command :-
cp /etc/rc.conf /conf/base/etc/.
- Copy the dhcpd.conf file to /conf/base/etc folder by executing the following command :-
cp /etc/local/dhcpd.conf /conf/base/etc/local/.
Once the package finishes installing you then need to create the dhcpd user and group on the server. This has to be done through the web console so that the changes remain persistent after a reboot.
To create the dhcp user and group perform the following steps :-
- Logon to the FreeNAS Servers Web Console as the admin user
- Expand the Account branch in the Left Hand pane
- Expand the Users branch in the Left Hand pane and then click on View All Users
- Click on the Group tab and then click on Add New Group
- Create the dhcpd group as follows :-
Group ID – 136
Group Name – dhcpd
- Click on OK to the create the group
- Next click on the Users tab and then click on Add New User
- Create the dhcpd user as follows :-
User ID – 136
Username – dhcpd
Primary Group – dhcpd
Shell – nologin
Full Name – DHCP Daemon
Password – password
- Click on OK to the create the user
Now use WINSCP and edit following file and add these 2 lines
enable the DHCP server in /etc/rc.conf, i.e., by adding:
dhcpd_enable="YES" dhcpd_ifaces="dc0"
above dc0 is the name of the interface.
Now go to freenas interface and add static IP from above range to the interface dc0
Finally you can start the DHCP server usning this command in putty : /usr/local/etc/rc.d/isc-dhcpd start
This worked for me !!!
Hope useful for others tooo……..
—