Nerdy Drunk

Drunk on technology

User Tools

Site Tools


ubiquiti:usg-dhcp

Ubiquiti USG DHCP Options

To test the configuration, SSH to your USG and set the DHCP server global parameters to associate the DHCP option code to an alias and define the option codes type (int, string, bool, etc.).

set service dhcp-server global-parameters "option mitel-125 code 125 = text;"
set service dhcp-server global-parameters "option mitel-43 code 043 = text;"

To test the configuration, SSH to your USG and set the DHCP server shared network name and subnet to define the options for the previously created DHCP option code aliases. Since the DHCP option required that the string be quoted you will need to use the “"” to provide the nested quotes.

set service dhcp-server shared-network-name net_Voice_192.168.1.0-24 subnet 192.168.1.0/24 subnet-parameters "option mitel-43 "id:ipphone.mitel.com;sw_tftp=192.168.1.2;call_srv=192.168.1.2;dscp=46";"
set service dhcp-server shared-network-name net_Voice_192.168.1.0-24 subnet 192.168.1.0/24 subnet-parameters "option mitel-125 "id:ipphone.mitel.com;sw_tftp=192.168.1.2;call_srv=192.168.1.2;dscp=46";"

If you are using an EdgeRouter you can do a commit and save and you are done. If you are using a USG device you will need to continue on if you wish for the changes to be persistent.

commit
save

If you wish to make the changes persistent across reboots and re-provisions of the USG you will need to SSH to the USG and export the current configuration in JSON and extract the relevant portions.

mca-ctrl -t dump-cfg

Here is an example of the DHCP config exported in JSON format.

{
	"service": {
		"dhcp-server": {
			"global-parameters": [
				"option mitel-125 code 125 = text;",
				"option mitel-43 code 043 = text;"
			],
			"shared-network-name": {
				"net_Voice_192.168.1.0-24": {
					"subnet": {
						"192.168.1.0/24": {
							"subnet-parameters": [
								"option mitel-43 "id:ipphone.mitel.com;sw_tftp=192.168.1.2;call_srv=192.168.1.2;dscp=46";",
								"option mitel-125 "id:ipphone.mitel.com;sw_tftp=192.168.1.2;call_srv=192.168.1.2;dscp=46";"
							]
						}
					}
				}
			}
		}
	}
}

SSH to your Cloud Key and create/edit the config.gateway.json file and add the extracted config options to make the changes persistent across reboots and re-provisions of the USG.

vi /srv/unifi/data/sites/default/config.gateway.json
ubiquiti/usg-dhcp.txt · Last modified: 2022/07/21 10:41 by 127.0.0.1