Last Updated on 2015-12-30.
You have a local network configured as 192.168.1.x/24 (subnet 255.255.255.0) and a remote location like 192.168.2.x/24, connected e.g. via VPN.
The limit of your network “1” is nearly reached, so you would like to move all your VoIP phones (Asterisk PBX) to a new range 192.168.3.x/24.
In most cases, it would be a simple solution to only change the subnet mask to e.g. 255.255.0.0, so every local device can reach each other, but the problem here is the “2” network which is on a remote location.
DHCP server should work for network “1” and “3”, but the Snom devices need special TFTP parameters for auto-provisioning, like Start server hostname, Start filename etc.
Solution approach 1
The VoIP phones (e.g. Snom 7xx) only need to connect to the Asterisk server, so the first task is to create an additional IP address for Asterisk, e.g. 192.168.3.10.
In Ubuntu, /etc/network/interfaces, add:
auto eth0:0 iface eth0:0 inet static address 192.168.3.10 netmask 255.255.255.0
The next step is to configure your DHCP server, in this example with Windows 2012 R2 (2008 R2 does not offer DHCP policies).
Add a new IP range “192.168.3.0”.
Create DHCP options for this range “3” like you did for network “1”, which are important for the phones, like “066 Hostname Startserver”, “067 Start Filename”, “042 NTP Server”.
Create a range group for network “1” and “3”. This seems to be important, otherwise the server does not lease IPs with this multi-range configuration.
In range “3”, add a new policy which only allows MAC addresses of your VoIP phone manufacturer. E.g. a useful value for Snom would be “000413*”.
Do this step vice versa for range “1”, so this one does not accept Snom devices.
Important: Both policies need to have set also the same IP range explicitely, exactly like the one set in the scope! With this step you make sure the range is only applied if the policy is accepted.
Activate the new range and test it.
Solution approach 2
The solution above might not be the best one, as you need at least Windows 2012 for the policies feature. Additionally, you might get event log warnings like “DHCP Server, 1342, no more IP addresses available for this range” (because you have reserved the whole IP range for the policy), which can be misleading in this case.
Another solution would be to set a Deny filter on your existing Windows DHCP (e.g. 2008 R2) and then create another DHCP server, e.g. on your Ubuntu / Asterisk machine.
First, create the 192.168.3.10 IP for Asterisk like in solution 1.
Then open the existing Windows DHCP server, enable the Deny list. For Snom, add “000413*” (wildcards are allowed).
On your Asterisk machine, install and configure a new DHCP server according to this tutorial. As interface, choose “eth0:0”, as IP range 192.168.3.x. Set the filter to only accept MACs like “000413*”. You might also want to set a lease delay of a few milliseconds for this server.