03. DHCP Configuration

DHCP Service

For Asterisk Noojee Provision to operate you must have a DHCP server present on the network. The DHCP server must have a tftp-server-name record which points handsets to the Noojee Provision service.

Ubuntu

If you are running Ubuntu you may need to install the dhcp daemon. Use the following command:

sudo apt-get install dhcp3-server 

You will need to edit the dhcpd.conf file which can be found at:

/etc/dhcp3/dhcpd.conf

The following is an example DHCP settings file (dhcpd.conf), do not copy this verbatim - it is intended as a guide only.

option ntp-servers 172.16.16.10;
default-lease-time 14400;
ddns-update-style none;
subnet 172.16.16.0 netmask 255.255.255.0
{
    range 172.16.16.100 172.16.16.249;
    default-lease-time 14400;
    max-lease-time 172800;
    option routers 172.16.16.10;
    if substring(hardware, 1, 3) = 00:0B:82 {           # for Grandstream phones
        option tftp-server-name "172.16.16.10";
    } else if substring(hardware, 1, 3) = 00:08:5D {    # for Aastra phones
        option tftp-server-name "172.16.16.10";
    } else if substring(hardware, 1, 3) = 00:0E:08 {    # for Linksys phones
        option tftp-server-name "172.16.16.10";
    } else if substring(hardware, 1, 3) = 00:15:65 { # yealink
        option tftp-server-name "172.16.16.10";
    } else if substring(hardware, 1, 3) = 00:04:f2 { # polycom
        option tftp-server-name "tftp://172.16.16.10";
    } else {
        option tftp-server-name "tftp://172.16.16.10";
    }
}

The above file makes the following assumptions:

  • Your subnet mask is 255.255.255.0
  • The default lease time is 1 month.
  • You are running a time server on 172.16.16.10
  • You DHCP has a NIC bound to an IP address in the range 172.16.16.10
  • The range of IP address to be assigned to handsets (and any other device on your network that uses DHCP) is in the range 172.16.16.100 - 249.
  • The Noojee Provision service is running on IP address 172.16.16.10

Each of the above setting need to be configured to suit your network.

The dhpcd.conf is normally found in /etc/dhcpd.conf. You will need to restart the dhcp service each time you change the above file.

You should also edit /etc/default/dhcp3-server to tell the server which interface(s) to offer DHCP service on.

Playing with the dhcpd.conf file can have catastrophic affects on your network!!!

Starting DHCP on boot

If the Asterisk system is to run the DHCP daemon (dhcpd) then it MUST be configured to start at boot.

You can check the existing status of the dhcpd service by running (as root):

chkconfig dhcpd

If dhcpd is configured to run at boot the above command will respond with:

> dhcpd on

To enable dhcpd to start on boot, run the following command (as root):

chkconfig dhcpd on  

 If you make any changes to dhcp you MUST reboot the system and check that dhcpd is operating as expected.

Cisco

For a Cisco router the configuration should be similar to:

ip dhcp excluded-address 192.168.0.1 192.168.0.49
	ip dhcp excluded-address 192.168.0.56 192.168.0.255
	!
	ip dhcp pool phones
	   network 172.16.16.0 255.255.255.0
	   default-router 172.16.16.1
	   dns-server 172.16.16.2 172.16.16.3
	   domain-name testme.com
	   option 42 ip 172.16.16.10
	   option 66 ascii "http://172.16.16.10:8081"
	   lease 0 4
	!

The above file makes the following assumptions:

  • Your subnet mask is 255.255.255.0
  • The default lease time is 1 month.
  • You are running a time server on 172.16.16.10
  • You DHCP has a NIC bound to an IP address in the range 172.16.16.10
  • The range of IP address to be assigned to handsets (and any other device on your network that uses DHCP) is in the range 172.16.16.100 - 249.
  • The Noojee Provision service is running on IP address 172.16.16.10