MAAS 3.1 has been released. Find out what’s new in 3.1.

How to use network tags

This article will show you:

How to create and assign network interface tags

To assign a tag to a network interface, use the following procedure:

  • Go to the machine list and select the machine where that interface resides, by clicking on that machine’s name:

  • Click on the “Network” tab:

  • Choose the interface you’d like to tag, by selecting the checkbox next to its name:

The checkbox isn’t strictly needed to apply the tag, but it helps prevent you from choosing the wrong one when multiple interfaces are available.

  • Select the drop-down under “ACTIONS” at the end of the row, and select “Edit Physical” to edit the parameters of the physical interface:

  • Edit the “Tags” field as desired.

  • Be sure to select the “Tag machine” button to apply your changes to the interface for that machine.

Note that different machines may have the same physical interface name, but different MAC addresses, so it’s not typical that interface tags carry over from one machine to the next – so auto complete menus will be sparse or non-existent most of the time for these tag types.

How to remove and delete network interface tags

To remove a tag from a network interface, use the following procedure:

  • Go to the machine list and select the machine where that interface resides, by clicking on that machine’s name:

  • Click on the “Network” tab:

  • Choose the interface you’d like to un-tag, by selecting the checkbox next to its name:

The checkbox isn’t strictly needed to apply the tag, but it helps prevent you from choosing the wrong one when multiple interfaces are available.

  • Select the drop-down under “ACTIONS” at the end of the row, and select “Edit Physical” to edit the parameters of the physical interface:

  • Edit the “Tags” field as desired.

  • Be sure to select the “Tag machine” button to apply your changes to the interface for that machine.

Note that different machines may have the same physical interface name, but different MAC addresses, so it’s not typical that interface tags carry over from one machine to the next – so auto complete menus will be sparse or non-existent most of the time for these tag types.

How to view network interface tags

To view the tags associated with a network interface, use the following procedure:

  • Go to the machine list and select the machine where that interface resides, by clicking on that machine’s name:

  • Click on the “Network” tab:

  • Choose the interface you’d like to see, by selecting the checkbox next to its name:

The checkbox isn’t strictly needed to apply the tag, but it helps prevent you from choosing the wrong one when multiple interfaces are available.

  • Select the drop-down under “ACTIONS” at the end of the row, and select “Edit Physical” to edit the parameters of the physical interface:

  • Be sure to cancel the operation when you’re done.

Note that different machines may have the same physical interface name, but different MAC addresses, so it’s not typical that interface tags carry over from one machine to the next.

How to discover the ID of your network interface

You can use a command of the following form to identify the interfaces associated with a particular device on your MAAS:

maas $PROFILE interfaces read $SYSTEM_ID \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t

For example:

maas admin interfaces read xn8taa \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t

This would produce output similar to the following:

mac_address        type      id  tags
-----------        ----      --  ----
00:16:3e:18:7f:ee  physical  9   andrpko  plinko  cochise

How to assign tags to a network interface

To assign a tag to a network interface, using both the device system ID and the interface ID, use a command of the following form:

maas $PROFILE interface add-tag $SYSTEM_ID $INTERFACE_ID tag=$TAG_NAME

For example:

maas admin interface add-tag xn8taa 9 tag=farquar

This command, if successful, will produce a long sequence of JSON describing the interface, including the changes introduced by the command above. You can also check your work by listing the tags associated with the device.

How to remove tags from a network interface

To remove a tag from a network interface, use both the device system ID and the interface ID in a command similar to this one:

maas $PROFILE interface remove-tag $SYSTEM_ID $INTERFACE_ID tag=$TAG_NAME

For example:

maas admin interface remove-tag xn8taa 9 tag=farquar

This command, if successful, will produce a long sequence of JSON describing the interface, including the changes introduced by the command above. You can also check your work by listing the tags associated with the device.

How to list tags for all network interfaces

To list all the tags for a given network interface on a given device, use a command like this one:

maas $PROFILE interfaces read $SYSTEM_ID \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t

For example:

maas admin interfaces read xn8taa \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t

This would produce output similar to the following:

mac_address        type      id  tags
-----------        ----      --  ----
00:16:3e:18:7f:ee  physical  9   andrpko  plinko  cochise  farquar

How to view tags for one network interface

To view tags for one particular network interface on a specific device, try a command formulated like this:

maas $PROFILE interface read $SYSTEM_ID $INTERFACE_ID \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),([.mac_address,.type,.id,.tags[]])
|@tsv'| column -t

For example:

maas admin interface read xn8taa 9 \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),([.mac_address,.type,.id,.tags[]])
|@tsv'| column -t

Typical output might look like this:

mac_address        type      id  tags
-----------        ----      --  ----
00:16:3e:18:7f:ee  physical  9   andrpko  plinko  cochise

Last updated 18 days ago.