*Errors or typos? Topics missing? Hard to read? Let us know.
This page explains how to manage DHCP for MAAS. If you’re new to the subject, you might find it helpful to first read an overview of MAAS DHCP.
To enable MAAS-managed DHCP via the MAAS UI:
Select Subnets >
Enter a Start IP address and an End IP address.
Select Reserve > Configure DHCP. You will see a new screen.
The options MAAS provides DHCP and Provide DHCP from a rack controller will be pre-selected.
If you accept these options, you may need to choose a Rack controller.
If you choose Relay to another VLAN, you will need to choose the target VLAN.
Under Reserved dynamic range, you may have to select a subnet from the drop-down.
Select Configure DHCP for your changes to be registered with MAAS.
To create an IP range:
Select Subnets.
In the SUBNET column, choose the subnet for which you want to create an IP range.
Scroll down to Reserved ranges.
Select Reserve range and choose either Reserve range or Reserve dynamic range. Note that if you choose a dynamic range, MAAS will automatically provide DHCP for enlistment and commissioning provided that the associated VLAN has DHCP enabled.
A window will appear, allowing you to enter a Start IP address and *End IP address
If you didn’t select a dynamic range, you may optionally enter a Purpose for the range.
Select Reserve to register your choices with MAAS.
Select Menu at the far right of the row corresponding to the subnet in question.
Select Edit reserved range from the menu that appears.
Edit the fields as desired.
Select Save to register your changes.
To delete an IP range, select Menu at the far right of the subnet row; then choose Remove range > Save.
To extend a dynamic IP range, select Subnets > subnet > Reserve dynamic range. DHCP will be enabled automatically.
To enable DHCP on a VLAN in a certain fabric, enter the following command:
maas $PROFILE vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True \
primary_rack=$PRIMARY_RACK_CONTROLLER
To enable DHCP HA, you will need both a primary and a secondary controller:
maas $PROFILE vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True \
primary_rack=$PRIMARY_RACK_CONTROLLER \
secondary_rack=$SECONDARY_RACK_CONTROLLER
Pro tip: You must enable DHCP for PXE booting on the ‘untagged’ VLAN.
You will also need to set a default gateway:
maas $PROFILE subnet update $SUBNET_CIDR gateway_ip=$MY_GATEWAY
Via the MAAS UI, you can set up a DHCP relay from one VLAN (source) to another VLAN (target) as follows:
Ensure the target VLAN has DHCP enabled.
Set up the external relay. This relay is set up independently from MAAS. See DHCP relay for software suggestions.
Configure MAAS-managed DHCP as normal.
Navigate to the source VLAN page.
Select the Relay DHCP action.
Fill in the fields in the resulting form. Note that the crucial setting is the target VLAN (Relay VLAN).
Select Relay DHCP to finish.
To use the MAAS CLI to relay DHCP traffic for a VLAN (source) through another VLAN (target):
maas $PROFILE vlan update $FABRIC_ID $VLAN_VID_SRC relay_vlan=$VLAN_ID_TARGET
For example, to relay VLAN with vid 0 (on fabric-2) through VLAN with id 5002 :
maas $PROFILE vlan update 2 0 relay_van=5002
To manage snippets via the MAAS UI as an administrator, select Settings >> DHCP snippets.
To search DHCP snippets, enter the text to match in Search DHCP snippets. MAAS will progressively update the list of snippets as you type your search terms.
To add a snippet:
Select Add snippet.
Enter the Snippet name.
Optionally, check Enabled to enable the snippet now. Note that MAAS will not apply the snippet unless it is enabled.
Optionally, enter a Description for the snippet.
Optionally, choose a Type for the snippet from the drop-down (defaults to Global). This parameter sets the scope of the snippet. Note that if you choose a type other than global, you may need to choose the specific scope. For example, if you choose the Subnet type, you must identify the specific subnet to which this snippet applies.
Enter the DHCP snippet. This is not validated on entry.
Select Save snippet to register your changes with MAAS
To edit a snippet, select the pencil icon to the right of the snippet row and edit the fields as desired.
To delete a snippet, select the trash can icon to the right of the snippet. You will be asked to confirm; be aware that once confirmed, this action cannot be undone.
To create a global snippet:
maas $PROFILE dhcpsnippets create name=$DHCP_SNIPPET_NAME \
value=$DHCP_CONFIG description=$DHCP_SNIPPET_DESCRIPTION \
global_snippet=true
To create a subnet snippet:
maas $PROFILE dhcpsnippets create name=$DHCP_SNIPPET_NAME \
value=$DHCP_CONFIG description=$DHCP_SNIPPET_DESCRIPTION \
subnet=$SUBNET_ID
To create a node snippet:
maas $PROFILE dhcpsnippets create name=$DHCP_SNIPPET_NAME \
value=$DHCP_CONFIG description=$DHCP_SNIPPET_DESCRIPTION \
node=$NODE_ID
To list all snippets (and their characteristics) in the MAAS:
maas $PROFILE dhcpsnippets read
To list a specific snippet:
maas $PROFILE dhcpsnippet read id=$DHCP_SNIPPET_ID
The snippet name can also be used instead of its ID:
maas $PROFILE dhcpsnippet read name=$DHCP_SNIPPET_NAME
To update a DHCP snippet attribute:
maas $PROFILE dhcpsnippet update $DHCP_SNIPPET_ID <option=value>
You can also use a snippet name instead of its ID.
Enabling and disabling a snippet is considered a snippet update and is done via a Boolean option (‘true’ or ‘false’). You can disable a snippet like this:
maas $PROFILE dhcpsnippet update $DHCP_SNIPPET_ID enabled=false
When you disable a snippet, MAAS removes the text you added to the dhcpd.conf file when you created the snippet.
To delete a snippet:
maas $PROFILE dhcpsnippet delete $DHCP_SNIPPET_ID
You can also use a snippet name in place of its ID.
To create a range of dynamic IP addresses that will be used by MAAS for node enlistment, commissioning, and possibly deployment:
maas $PROFILE ipranges create type=dynamic \
start_ip=$IP_DYNAMIC_RANGE_LOW end_ip=$IP_DYNAMIC_RANGE_HIGH \
comment='This is a reserved dynamic range'
To create a range of IP addresses that will not be used by MAAS:
maas $PROFILE ipranges create type=reserved \
start_ip=$IP_STATIC_RANGE_LOW end_ip=$IP_STATIC_RANGE_HIGH \
comment='This is a reserved range'
To reserve a single IP address that will not be used by MAAS:
maas $PROFILE ipaddresses reserve ip_address=$IP_STATIC_SINGLE
To edit an IP range:
maas admin ipranges read
maas admin iprange update $ID start_ip="<start ip>" end_ip="<end ip>" comment="freeform comment"
This command will update the IP range associated with $ID.
You can delete a range of IP addresses by deleting the addresses one by one. To remove a single reserved IP address:
maas $PROFILE ipaddresses release ip=$IP_STATIC_SINGLE
An administrator can create an A record when creating a DNS resource with an IPv4 address:
mass $PROFILE dnsresources create fqdn=$HOSTNAME.$DOMAIN ip_addresses=$IPV4ADDRESS
An administrator can also create an AAAA record when creating a DNS resource with an IPv6 address:
mass $PROFILE dnsresources create fqdn=$HOSTNAME.$DOMAIN ip_addresses=$IPV6ADDRESS
An administrator can set a DNS Alias (CNAME record) to an already existing DNS entry of a machine:
mass $PROFILE dnsresource-records create fqdn=$HOSTNAME.$DOMAIN rrtype=cname rrdata=$ALIAS
For example, to set webserver.maas.io
to alias to www.maas.io
:
maas $PROFILE dnsresource-records create fqdn=webserver.maas.io rrtype=cname rrdata=www
An administrator can set a DNS Mail Exchange pointer record (MX and value) to a domain:
maas $PROFILE dnsresource-records create fqdn=$DOMAIN rrtype=mx rrdata='10 $MAIL_SERVER.$DOMAIN'
For example, to set the domain.name managed by MAAS to have an MX record and that you own the domain:
maas $PROFILE dnsresource-records create fqdn=maas.io rrtype=mx rrdata='10 smtp.maas.io'
To set a DNS forwarder:
maas $PROFILE maas set-config name=upstream_dns value=$MY_UPSTREAM_DNS