How to customise MAAS networks

Errors or typos? Topics missing? Hard to read? Let us know.

Network discovery

Network discovery scans your environment to identify all connected devices, including non-deployable devices such as routers and switches.

UI

  1. In MAAS 3.4++ UI:

    • Navigate to Networking > Network discovery > Configuration.
    • In the Network discovery drop-down, choose “Enabled” or “Disabled”.
    • Save your changes.
  2. All other versions:

    • Navigate to Canonical MAAS > Configuration.
    • In the Network discovery drop-down, choose “Enabled” or “Disabled”.
    • Save your changes.

CLI

To enable network discovery via CLI:

maas $PROFILE maas set-config name=network_discovery value="enabled"

Static routes

Static routes allow traffic between different subnets or through specific gateways.

UI

  1. In MAAS 3.4++ UI:

    • Navigate to Networking > Subnets > Subnet summary > Add static route.
    • Enter Gateway IP address, Destination subnet, and routing Metric.
    • Save your changes.
  2. For older versions:

    • Navigate to Subnets > Add static route.
    • Enter the Gateway IP address, Destination subnet, and routing Metric.
    • Click Add to save the route.

CLI

To create a static route via CLI:

maas admin static-routes create source=$SOURCE_SUBNET destination=$DEST_SUBNET gateway_ip=$GATEWAY_IP

Configure loopback

Configuring the loopback interface (lo) is essential for advanced networking tasks such as Free Range Routing (FRR) and BGP.

  1. Manually add the loopback interface:

    • After commissioning a node, manually add the loopback interface in MAAS.
    • You may use a placeholder MAC address (e.g., 00:00:00:00:00:00) for the loopback interface.
  2. Use post-deployment scripts:

    • If needed, use tools like cloud-init to configure the loopback interface after deployment.

Bridging

Bridges enable multiple network interfaces to act as one.

UI

  1. In MAAS UI:
    • Navigate to Machines > machine > Network > Create bridge.
    • Configure details and save the interface.

CLI

  1. Create a bridge via CLI:
    INTERFACE_ID=$(maas $PROFILE machine read $SYSTEM_ID | jq .boot_interface.id)
    BRIDGE_ID=$(maas $PROFILE interfaces create-bridge $SYSTEM_ID name=br0 parent=$INTERFACE_ID | jq .id)
    SUBNET_ID=$(maas $PROFILE subnets read | jq -r '.[] | select(.cidr == "10.0.0.0/24" and .managed == true).id')
    maas $PROFILE interface link-subnet $SYSTEM_ID $BRIDGE_ID subnet=$SUBNET_ID mode="STATIC" ip_address="10.0.0.101"
    

Bridging with Netplan

Netplan configurations can be used to set up bridges outside of MAAS.

  1. Open the Netplan config file (/etc/netplan/50-cloud-init.yaml or similar).
  2. Modify the file to add a bridge:
    network:
        bridges:
            br0:
                addresses:
                - 10.0.0.101/24
                gateway4: 10.0.0.1
                interfaces:
                - enp1s0
                macaddress: 52:54:00:39:9d:f9
    
  3. Apply the new configuration:
    sudo netplan apply
    

Configure two NICs on one machine

To set up a machine with two NICs—one for a private subnet and one for the public internet—follow these steps.

UI

  1. Detect both NICs:

    • Ensure MAAS detects both network interfaces (e.g., ens18 and ens19).
  2. Private NIC (ens18):

    • Set to DHCP on the private subnet (e.g., 192.168.10.0/24).
  3. Public NIC (ens19):

    • Manually configure or use DHCP for the public subnet (e.g., 192.168.1.0/24).

Netplan Example

network:
    version: 2
    ethernets:
        ens18:
            addresses:
            - 192.168.10.5/24
            gateway4: 192.168.10.1
        ens19:
            addresses:
            - 192.168.1.10/24
            gateway4: 192.168.1.1
            nameservers:
                addresses:
                - 8.8.8.8
                - 8.8.4.4

VLANs

Create VLANs (CLI)

To create a VLAN:

maas admin vlans create $FABRIC_ID name=$VLAN_NAME vid=$VLAN_ID

Assign VLAN to an interface (CLI)

To assign a VLAN to an interface:

maas admin interfaces create-vlan $SYSTEM_ID vlan=$VLAN_ID parent=$INTERFACE_ID

Delete VLANs (CLI)

To delete a VLAN:

maas $PROFILE vlan delete $FABRIC_ID $VLAN_ID

Set the default gateway

CLI

To set the default gateway for a subnet:

maas $PROFILE subnet update $SUBNET_CIDR gateway_ip=$MY_GATEWAY

Set up DNS

CLI

To configure DNS servers:

maas $PROFILE subnet update $SUBNET_CIDR dns_servers=$MY_DNS_SERVER

Create bonds

Bonds allow multiple network interfaces to act together for redundancy or performance.

UI

  1. Select multiple interfaces and choose Create bond.
  2. Choose a bond mode such as:
    • balance-rr: Round-robin transmission.
    • active-backup: Only one active follower; failover to another upon failure.
    • balance-xor: Transmit based on hash policy.

CLI

To create a bond via CLI:

maas $PROFILE interfaces create-bond $SYSTEM_ID name=$BOND_NAME parents=$IFACE1_ID,$IFACE2_ID bond_mode=$BOND_MODE

Managing NTP

Use external NTP

  1. UI:

    • Go to Settings > Network services > NTP.
    • Select External Only and enter your desired NTP server.
  2. CLI:

    maas $PROFILE maas set-config name=ntp_servers value=$NTP_IP_ADDRESS
    maas $PROFILE maas set-config name=ntp_external_only value=true
    

Netplan static IP configuration

To configure a static IP with Netplan:

  1. Open the Netplan configuration file:

    sudo nano /etc/netplan/50-cloud-init.yaml
    
  2. Modify the configuration:

    network:
        version: 2
        ethernets:
            ens160:
                addresses:
                - 192.168.0.100/24
                gateway4: 192.168.0.1
                nameservers:
                    addresses:
                    - 8.8.8.8
                    - 8.8.4.4
    

Last updated 9 hours ago.