Adding vlan tags

I must be missing something. Just to test I want to add vlan tag 34 to anything coming in port 2 that is not tagged and and treat port1 like a trunk port.



 
/interface ethernet
set 0 arp=enabled auto-negotiation=yes bandwidth=unlimited/unlimited comment=\
    "" disabled=no full-duplex=yes l2mtu=1524 mac-address=00:0C:42:70:7B:7A \
    master-port=none mtu=1500 name=ether1 speed=100Mbps
set 1 arp=enabled auto-negotiation=yes bandwidth=unlimited/unlimited comment=\
    "" disabled=no full-duplex=yes l2mtu=1524 mac-address=00:0C:42:70:7B:7B \
    master-port=ether1 mtu=1500 name=ether2 speed=100Mbps

...



/interface ethernet switch
set switch1 mirror-source=none mirror-target=none name=switch1
/interface ethernet switch port
set (unknown) vlan-mode=secure
set (unknown) vlan-mode=secure
set (unknown) vlan-mode=fallback
set (unknown) vlan-mode=fallback
set (unknown) vlan-mode=fallback
/interface ethernet switch rule
add copy-to-cpu=no disabled=no mirror=no new-vlan-id=34 ports=ether2 \
    redirect-to-cpu=no switch=switch1 vlan-header=not-present
/interface ethernet switch vlan
add disabled=no ports=ether2,ether1 switch=switch1 vlan-id=34
add disabled=no ports=ether1 switch=switch1 vlan-id=0

What am I missing? How do I add vlan tags to packets?

ether1 = trunk for vlan34
ether2 = traffic untagged leaving there, but “connected” to vlan34

# Create vlan on ether1 for trunking
/interface vlan
add interface=ether1 vlan-id=34 name=vlan34_Iface
# Create a bridge
/interface bridge
add name=vlan34_bridge
# Add ports to the bridge
/interface bridge ports
# ether2 is untagged
add bridge=vlan34_bridge interface=ether2
# add the tagged interface
add bridge=vlan34_bridge interface=vlan34_Iface

Traffic LEAVING the router on ether2 is untagged, traffic ENTERING on ether2 will be bridged to vlan34 and will be tagged when it leaves the router.

Thanks.

I knew I could do this on the router’s CPU as well but for some reason unknown to myself I want to do this on this switch chip. Though it looks like I will probably end up doing it this way or actually routing with the router.

Thanks for the pointers :smiley:

Rob

How do I add multiple ports to the same vlan?

Add additional ports to the bridge.