DHCP Servers and VoIP

When running a VoIP PBX, Dynamic Host Configuration Protocol (DHCP) servers play an important part in the configuration of the network and of the IP phones. We'll by start discussing the basic operation of DHCP.

VoIP and DHCP

DHCP is used to dynamically assign IP addresses to devices on the network. Why would we want to do this? It makes it much easier to manage the network if you have multiple users with portable devices moving around the physical network.

The alternative is to manually assign static IP addresses to each device and then when it moves to another location, reassign another static IP address. This would be a lot of work for mobile devices such as cellphones, laptops, PDAs, iPads, iPods and WiFi devices.

How does DHCP work?

When a device, like a PC, first connects to a network it follows this process:

  • DHCP Discovery : The PC sends out a DHCP Discovery broadcast asking if there is a DHCP server present on the network and can it get an IP address.
  • DHCP Offer: The DHCP server responds with a DHCP offer which consists of an IP address, subnet mask and default gateway.
  • DHCP Request: The PC then accepts the offer by responding with a DHCP request containing the offer IP address. The DHCP Request will also contain any DHCP options specific to it. For IP Phones, they will request the Option 66 or 150 or a special option number to find out the tftp server's IP address.
  • DHCP Acknowleged: The DHCP server provides the information that is requested and the IP address is leased for a specific amount of time. When the lease expires, the PC has to make another request to re-lease the IP address and the process starts all over.

The IP addresses are pulled from a pool of IP addresses that the network administrator has assigned to that particular network. The pool excludes static IP addresses that would be assigned to network devices that are always on such as routers, switches, wireless access points and servers.

Why lease IP addresses?

The lease time can be any length of time from a few minutes to several days, weeks or permanently. In the post secondary institute that I work at. The lease time is 50 minutes which corresponds to one "hour" of class time. This prevents the IP pool from being used up for any one classroom.

Another reason would be to make it more difficult for rogue servers to be setup where there is public access. It is difficult (but not impossible) to access a server if the IP address is changing every 50 minutes.

DHCP Options

Basic DHCP assigns:

  • IP Address
  • Network Mask
  • Default Gateway
  • DNS server(s)
DHCP is capable of assigning more than just the IP address through the DHCP options feature. This allows you to provide specific information for end devices to function properly. The options can be end device specific or end user specific. In our case, we are interested in options specific to VoIP.

When an IP phone boots up, it contacts a DHCP server to receive an IP address and information specfic to the network that it is on. You have a choice with an IP phone to manually configure the phone either through a web interface or through a user interface (LCD). This would work fine if you have a small phone system with a couple of phones. But what if you had 100s of phones and you had to make a change or update firmware? This is where DHCP shines!

One of the options that DHCP can assign to an IP phone is the IP address of a tftp server (Option 66 or 150). The tftp server holds the PBX configuration information for the phone and the firmware that the phone should load. PBX software such as the Endpoint Manager module in FreePBX, allows you to remotely configured your IP phone, tell it to reboot and load a new configuration or even new firmware. And you can reconfigure all the phones in your network at the same time. It is a great time saver!

DHCP Options

When creating a DHCP server, you are allowed to configure extra "options" that can be passed to clients. One that was mentioned early is option 66 or 150 which is the IP address of a tftp server that can hold the configuration files for an IP phone. Other options can be a NTP server's IP address, the PBX's IP address, etc.. Whether the client receives this information depends on if it requests it.

tftp Option Gotchas

If you have a DHCP server that is giving out option 66 or 150 and attempt to "test" if it is working by sniffing the network using a PC and Wireshark, the capture will not work. A PC does not request a tftp server IP address and the DHCP server will not "automatically" send out information not requested. Most IP phones will provide status logs that you can browse to see if they are receiving the correct network information.

While most IP phones look for DHCP option 66 for the tftp server address, Cisco phones look for option 150 which allows you to list two tftp servers: the primary and secondary. Sometimes the format of the tftp option at the DCHP server can cause problems. This happens when you are running multiple brands of IP phones. For example, Cisco phones expect that option 150 will share the tftp IP address as a hexadecimal number while Aastra phones expect the IP address as ASCII characters. In this example, the Aastra phones failed to receive the tftp server IP address.

When configuring a Cisco router or switch as a DHCP server, the tftp option line would be:

option 150 ip 192.168.0.1  - for a Cisco phone
option 150 ascii "192.168.0.1"  - for an Aastra phone
Fortunately, Aastra phones can be configured to check several different DHCP options for the tftp server.

Besides the tftp server's IP address, you can designate the IP address of the PBX and many other options that depend on the phone system that you are running. The RFC Sourcebook has an excellent detailed reference on DHCP Options.

If this page has helped you, please consider donating $1.00 to support the cost of hosting this site, thanks.

Return to

TelecomWorld 101

Copyright July 2013 Eugene Blanchard