|
| 1 | +# Applying VLAN tagging to physical networks |
| 2 | + |
| 3 | +IncusOS can assign automatic VLAN tagging for one or more VLANs to any configured interface or bond. |
| 4 | + |
| 5 | +This tutorial will assume the network interface is named `enp5s0` and the VLAN ID we want to set is `1234`. |
| 6 | + |
| 7 | +To assign the VLAN tagging, we need to make sure the interface is assigned both the `instances` [role](../reference/system/network.md) and that the `vlan_tags` property consists of a list of desired VLAN ID(s). This can be done by running `incus admin os system edit network` and edit the configuration like follows: |
| 8 | + |
| 9 | +``` |
| 10 | +config: |
| 11 | + interfaces: |
| 12 | + - addresses: |
| 13 | + - dhcp4 |
| 14 | + - slaac |
| 15 | + hwaddr: 10:66:6a:d2:32:18 |
| 16 | + lldp: false |
| 17 | + name: enp5s0 |
| 18 | + required_for_online: "no" |
| 19 | + roles: |
| 20 | + - instances |
| 21 | + vlan_tags: |
| 22 | + - 1234 |
| 23 | +``` |
| 24 | + |
| 25 | +After the configuration change is applied, a new unmanaged bridge will appear: |
| 26 | + |
| 27 | +``` |
| 28 | +gibmat@futurfusion:~$ incus network list |
| 29 | ++----------+--------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 30 | +| NAME | TYPE | MANAGED | IPV4 | IPV6 | DESCRIPTION | USED BY | STATE | |
| 31 | ++----------+--------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 32 | +| enp5s0 | bridge | NO | | | | 0 | | |
| 33 | ++----------+--------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 34 | +| incusbr0 | bridge | YES | 10.148.244.1/24 | fd42:15d0:aec3:c78d::1/64 | Local network bridge (NAT) | 1 | CREATED | |
| 35 | ++----------+--------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 36 | +
|
| 37 | +``` |
| 38 | + |
| 39 | +Create a managed network for VLAN `1234`: |
| 40 | + |
| 41 | +``` |
| 42 | +gibmat@futurfusion:~$ incus network create enp5s0.1234 parent=enp5s0 vlan=1234 --type=physical |
| 43 | +Network enp5s0.1234 created |
| 44 | +gibmat@futurfusion:~$ incus network list |
| 45 | ++-------------+----------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 46 | +| NAME | TYPE | MANAGED | IPV4 | IPV6 | DESCRIPTION | USED BY | STATE | |
| 47 | ++-------------+----------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 48 | +| enp5s0 | bridge | NO | | | | 1 | | |
| 49 | ++-------------+----------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 50 | +| enp5s0.1234 | physical | YES | | | | 0 | CREATED | |
| 51 | ++-------------+----------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 52 | +| incusbr0 | bridge | YES | 10.148.244.1/24 | fd42:15d0:aec3:c78d::1/64 | Local network bridge (NAT) | 1 | CREATED | |
| 53 | ++-------------+----------+---------+-----------------+---------------------------+----------------------------+---------+---------+ |
| 54 | +``` |
| 55 | + |
| 56 | +Now, you can configure an instance to use VLAN `1234`: |
| 57 | + |
| 58 | +``` |
| 59 | +gibmat@futurfusion:~$ incus launch images:debian/13 debian --network enp5s0.1234 |
| 60 | +Launching debian |
| 61 | +gibmat@futurfusion:~$ incus list |
| 62 | ++--------+---------+-----------------------+------------------------------------------------+-----------+-----------+ |
| 63 | +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | |
| 64 | ++--------+---------+-----------------------+------------------------------------------------+-----------+-----------+ |
| 65 | +| debian | RUNNING | 10.234.136.199 (eth0) | fd42:3cfb:8972:3990:1266:6aff:fe71:14e0 (eth0) | CONTAINER | 0 | |
| 66 | ++--------+---------+-----------------------+------------------------------------------------+-----------+-----------+ |
| 67 | +``` |
| 68 | + |
| 69 | +You can also make this network the default for all instances: |
| 70 | + |
| 71 | +``` |
| 72 | +gibmat@futurfusion:~$ incus profile device set default eth0 network=enp5s0.1234 |
| 73 | +``` |
0 commit comments