Skip to content

VLANs

Create a vlan

/interface vlan add interface=ether3 name=e3.20 vlan-id=20

Other devices (routers, switches) between the router and the computer must be configured appropriately.

Add an IP address for the vlan interface (optional)

/ip address add address=192.168.0.1/24 interface=e3.20

Two interfaces one vlan

Create the vlans for the interfaces

/interface vlan add interface=ether4 name=e4.20 vlan-id=20
/interface vlan add interface=ether5 name=e5.20 vlan-id=20

Create the bridge and add the previously created vlans

/interface bridge add name=b20
/interface bridge port add bridge=b.20 interface=e4.20
/interface bridge port add bridge=b.20 interface=e5.20

Add an IP address to the interface if needed.

/ip address add address=192.168.0.1/24 interface=b20

Access port

Vlan 20 on ether5 tagged and ether4 untagged.

/interface vlan add interface=ether5 name=e5.20 vlan-id=20
/interface bridge add name=b20
/interface bridge port add bridge=b20 interface=e5.20
/interface bridge port add bridge=b20 interface=ether4

Example

Vlan with DHCP

/interface vlan add arp=enabled disabled=no loop-protect=off name=e4.110 interface=ether4 vlan-id=110
/ip address add address=10.0.11.1/24 comment=vlan110 network=10.0.11.0 interface=e4.110
/ip pool add name=e4.110 range=10.0.11.200-10.0.11.240
/ip dhcp-server add address-pool=e4.110 interface=e4.110 lease-time=1d name=e4.110
/ip dhcp-server network add address=10.0.11.0/24 comment=e4.110 gateway=10.0.11.1 netmask=24 dns-server=1.1.1.1

Notes

The DHCP server goes on the bridge.