Hi,
can someone explain me the difference between port based vlan and the possiblilty to add vlans to a bridge. I tried both configs in OS6.42. but I am not sure which one I should use.
Thanks,
Spartacus
/interface bridge
add fast-forward=no name=br_vlan vlan-filtering=yes
/interface vlan
add interface=br_vlan name=vlan1 vlan-id=1
add interface=br_vlan name=vlan10 vlan-id=10
add interface=br_vlan name=vlan20 vlan-id=20
/interface list
add name=WAN
add name=LAN
/ip pool
add name=pool_admin ranges=172.16.1.101-172.16.1.199
add name=pool_vlan10 ranges=172.16.10.100-172.16.10.199
add name=pool_vlan20 ranges=172.16.20.100-172.16.20.199
/ip dhcp-server
add address-pool=pool_admin disabled=no interface=vlan1 name=dhcp_admin
add address-pool=pool_vlan10 disabled=no interface=vlan10 name=dhcp_vlan10
add address-pool=pool_vlan20 disabled=no interface=vlan20 name=dhcp_vlan20
/interface bridge port
add bridge=br_vlan hw=no interface=sfp1
add bridge=br_vlan frame-types=admit-only-untagged-and-priority-tagged interface=ether2
add bridge=br_vlan frame-types=admit-only-vlan-tagged interface=vlan1
add bridge=br_vlan frame-types=admit-only-vlan-tagged interface=vlan10 pvid=10
add bridge=br_vlan frame-types=admit-only-vlan-tagged interface=vlan20 pvid=20
add bridge=br_vlan frame-types=admit-only-untagged-and-priority-tagged interface=ether3 pvid=10
add bridge=br_vlan frame-types=admit-only-untagged-and-priority-tagged interface=ether4 pvid=20
/interface bridge vlan
add bridge=br_vlan tagged=br_vlan,vlan1 untagged=sfp1 vlan-ids=1
add bridge=br_vlan tagged=sfp1,br_vlan,vlan10 untagged=ether3 vlan-ids=10
add bridge=br_vlan tagged=sfp1,br_vlan,vlan10 untagged=ether4 vlan-ids=20
/interface list member
add interface=ether1 list=WAN
add interface=br_vlan list=LAN
/ip address
add address=172.16.1.1/24 interface=vlan1 network=172.16.1.0
add address=172.16.10.1/24 interface=vlan10 network=172.16.10.0
add address=172.16.20.1/24 interface=vlan20 network=172.16.20.0
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=ether1
/ip dhcp-server network
add address=172.16.1.0/24 dns-server=192.168.1.1 domain=admin gateway=172.16.1.1
add address=172.16.10.0/24 dns-server=192.168.1.1 domain=vlan10 gateway=172.16.10.1
add address=172.16.20.0/24 dns-server=192.168.1.1 domain=vlan20 gateway=172.16.20.1
/ip firewall filter
add action=drop chain=forward dst-address=172.16.20.0/24 src-address=172.16.10.0/24
add action=drop chain=forward dst-address=172.16.10.0/24 src-address=172.16.20.0/24
add action=drop chain=forward dst-address=172.16.1.0/24 src-address=172.16.10.0/24
add action=drop chain=forward dst-address=172.16.1.0/24 src-address=172.16.20.0/24
/interface bridge
add fast-forward=no name=br_vlan vlan-filtering=yes
/interface list member
add interface=ether1 list=WAN
add interface=br_vlan list=LAN
/interface vlan
add interface=br_vlan name=vlan1 vlan-id=1
add interface=br_vlan name=vlan10 vlan-id=10
add interface=br_vlan name=vlan20 vlan-id=20
/ip address
add address=172.16.1.1/24 interface=vlan1 network=172.16.1.0
add address=172.16.10.1/24 interface=vlan10 network=172.16.10.0
add address=172.16.20.1/24 interface=vlan20 network=172.16.20.0
/interface bridge port
add bridge=br_vlan hw=no interface=sfp1
add bridge=br_vlan frame-types=admit-only-untagged-and-priority-tagged nterface=ether2
add bridge=br_vlan frame-types=admit-only-vlan-tagged interface=vlan1
add bridge=br_vlan frame-types=admit-only-vlan-tagged interface=vlan10 pvid=10
add bridge=br_vlan frame-types=admit-only-vlan-tagged interface=vlan20 pvid=20
add bridge=br_vlan frame-types=admit-only-untagged-and-priority-tagged interface=ether3 pvid=10
add bridge=br_vlan frame-types=admit-only-untagged-and-priority-tagged interface=ether4 pvid=20
/interface bridge vlan
add bridge=br_vlan tagged=br_vlan,vlan1 untagged=sfp1 vlan-ids=1
add bridge=br_vlan tagged=sfp1,br_vlan,vlan10 untagged=ether3 vlan-ids=10
add bridge=br_vlan tagged=sfp1,br_vlan,vlan10 untagged=ether4 vlan-ids=20
/ip firewall address-list
add address=172.16.1.0/24 list=PrivateSubnets
add address=172.16.10.0/24 list=PrivateSubnets
add address=172.16.20.0/24 list=PrivateSubnets
/ip firewall filter
add action=accept chain=input connection-state=established,related
add action=accept chain=input connection-state="" in-interface=vlan1 src-address=172.16.1.0/24
add action=reject chain=forward dst-address-list=PrivateSubnets in-interface= !ether1 reject-with=icmp-admin-prohibited src-address-list=""
add action=drop chain=input
add bridge=br_vlan tagged=sfp1,br_vlan,vlan10 untagged=ether4 vlan-ids=20
add bridge=br_vlan tagged=sfp1,br_vlan,vlan20 untagged=ether4 vlan-ids=20
add action=accept chain=forward comment="accept established,related, untracked" connection-state=established,related,untracked
/ip firewall filter
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
invalid
add action=accept chain=input comment="defconf: accept ICMP" \
protocol=icmp
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
disabled=yes ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
disabled=yes ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
connection-state=established,related
add action=accept chain=forward comment=\
"defconf: accept established,related, untracked" connection-state=\
established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
connection-state=invalid
add action=drop chain=forward comment=\
"defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
connection-state=new in-interface-list=WAN log=yes log-prefix=!NAT
/ip firewall address-list
add address=172.16.10.0/24 list=VlanFriends
add address=172.16.20.0/24 list=VlanFriends
/ip firewall filter
add action=accept chain=forward comment="Accept VLAN friends" dst-address-list=VlanFriends src-address-list=VlanFriends
add action=drop chain=forward comment="Drop inter-VLAN traffic" dst-address-list=PrivateSubnets src-address-list=PrivateSubnets log=yes log-prefix=InterVLAN
/ip firewall address-list
add address=172.16.10.0/24 list=VlanFriends
add address=172.16.20.0/24 list=VlanFriends
/ip firewall filter
add action=accept chain=forward comment="Accept VLAN friends" dst-address-list=VlanFriends src-address-list=VlanFriends
add action=drop chain=forward comment="Drop inter-VLAN traffic" dst-address-list=PrivateSubnets src-address-list=PrivateSubnets log=yes log-prefix=InterVLAN
/ip firewall address-list
add address=172.16.1.0/24 list=Admin
add address=172.16.10.0/24 list=VlanFriends
add address=172.16.20.0/24 list=VlanFriends
/ip firewall filter
add action=accept chain=forward comment="Accept VLAN Admin" src-address-list=Admin
add action=accept chain=forward comment="Accept VLAN friends" dst-address-list=VlanFriends src-address-list=VlanFriends
add action=drop chain=forward comment="Drop inter-VLAN traffic" dst-address-list=PrivateSubnets src-address-list=PrivateSubnets log=yes log-prefix=InterVLAN
/ip firewall address-list
add address=172.16.1.0/24 list=Admin
add address=172.16.10.0/24 list=VlanFriends
add address=172.16.20.0/24 list=VlanFriends
add address=172.16.1.0/24 list=PrivateSubnets
add address=172.16.10.0/24 list=PrivateSubnets
add address=172.16.20.0/24 list=PrivateSubnets
/ip firewall filter
add action=accept chain=forward comment="Accept VLAN Admin" src-address-list=Admin
add action=accept chain=forward comment="Accept VLAN friends" dst-address-list=VlanFriends src-address-list=VlanFriends
add action=drop chain=forward comment="Drop inter-VLAN traffic" dst-address-list=PrivateSubnets src-address-list=PrivateSubnets log=yes log-prefix=InterVLAN
add action=accept chain=forward comment="Accept established and related connections" connection-state=related,established
/ip firewall address-list
add address=172.16.1.0/24 list=Admin
add address=172.16.10.0/24 list=VlanFriends
add address=172.16.20.0/24 list=VlanFriends
/ip firewall filter
add action=drop chain=forward comment="Drop invalid connections" connection-state=invalid
add action=accept chain=forward comment="Accept established and related connections" connection-state=related,established
add action=accept chain=forward comment="Accept VLAN Admin towards anywhere" src-address-list=Admin
add action=accept chain=forward comment="Accept VLAN friends towards internet" src-address-list=VlanFriends dst-interface=<your WAN interface>
add action=drop chain=forward comment="Drop any other inter-subnet communication"
I wanted to permit clients in vlan10 and 20 to see each other, and clinets in vlan 10 and vlan20 should not see clients in the admin LAN (vlan1).