Management of DHCP and IP ranges is a key element of configuring and managing MAAS:
If needed, you can review an explanation of MAAS DHCP before undertaking to manage or set MAAS DHCP parameters.
This article will help you learn:
How to enable MAAS-managed DHCP
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
[note] You must enable DHCP for PXE booting on the 'untagged' VLAN. [/note]
You will also need to set a default gateway:
maas $PROFILE subnet update $SUBNET_CIDR gateway_ip=$MY_GATEWAY
How to extend a reserved dynamic IP range
To extend a dynamic IP range:
Go to Subnets.
Select the relevant subnet.
Reserve a dynamic range.
DHCP will be enabled automatically.
To relay from one VLAN (source) to another VLAN (target):
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.
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
How to customise MAAS with DHCP snippets
How to create a global DHCP snippet
To create a global snippet:
maas $PROFILE dhcpsnippets create name=$DHCP_SNIPPET_NAME \
value=$DHCP_CONFIG description=$DHCP_SNIPPET_DESCRIPTION \
global_snippet=true
How to create a subnet DHCP snippet
To create a subnet snippet:
maas $PROFILE dhcpsnippets create name=$DHCP_SNIPPET_NAME \
value=$DHCP_CONFIG description=$DHCP_SNIPPET_DESCRIPTION \
subnet=$SUBNET_ID
How to create a node DHCP snippet
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.
How to enable or disable a DHCP snippet
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.
It is possible to set DNS parameters using the MAAS CLI, using the following instructions.
How to create an A or AAAA record in DNS
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
How to create an alias (CNAME) record in DNS
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
How to create a Mail Exchange pointer record in DNS
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
This section gives specific instructions about creating and managing IP ranges; it will help you learn:
See the glossary for an explanation of the two kinds of reserved IP ranges MAAS uses.
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'
How to create a range of IP addresses not used by MAAS
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'
How to reserve a single IP address that will not be used by MAAS
To reserve a single IP address that will not be used by MAAS:
maas $PROFILE ipaddresses reserve ip_address=$IP_STATIC_SINGLE
How to remove a single reserved IP address
To remove such a single reserved IP address:
maas $PROFILE ipaddresses release ip=$IP_STATIC_SINGLE
How to edit an existing IP range
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.