Attached network diagram. The traffic flow requirements are as follows:
1. VLAN 10, 20, 30 and 60 access to internet
2. VLAN no intercommunication with the exceptions:
a) VLAN 10 access to VLAN 40 for IP Camera and NAS
b) VLAN 30 access to VLAN 10 for printer services
3. VLAN 10, 20, 30 routed to WAN LTE19, which is on VLAN 50
4. VLAN 60 routed to WAN VDSL2 modem (KPN)
5. VLAN 10 needs local access to Mikrotik router, switch and access points.
6. VLAN 10 needs access to VLAN 50 for management purposes of the LTE19 modem.
7. No fail-over routes needed.
Added 02 June 2024: 8. Queues: VLAN 20 Internet of Things to get little bandwidth (500k/500k sufficient?). VLAN 10 Internal_LAN and VLAN 30 Work_Devices to be able to share the LTE WAN bandwith dynamically equal, which is I think PCQ method.
I moved away from IP Firewall Mangle routes and went to Policy Routing. But I struggle.
Issue is on item 3, at least as far I tested, VLAN 10 is not routed to WAN LTE19 but to WAN VDSL2, unless I disable the WAN VDSL2 modem (KPN). I am obviously missing something in my setup.
I have another issue with scripts, but I want to tackle one issue at the time.
Code: Select all
# 2024-05-31 08:27:44 by RouterOS 7.15
# software id = LRF1-VRV8
#
# model = RB5009UPr+S+
# serial number =
/interface bridge
add frame-types=admit-only-vlan-tagged name=bridge1 vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] mtu=1508 poe-out=off
set [ find default-name=ether2 ] poe-out=off
set [ find default-name=ether3 ] poe-out=off
set [ find default-name=ether5 ] poe-out=off
set [ find default-name=ether6 ] poe-out=off
set [ find default-name=ether7 ] poe-out=off
set [ find default-name=ether8 ] poe-out=off
set [ find default-name=sfp-sfpplus1 ] disabled=yes
/interface vlan
add interface=bridge1 name=IPTV vlan-id=60
add interface=bridge1 name=IP_camera_nas vlan-id=40
add interface=bridge1 name=Internal_LAN vlan-id=10
add interface=bridge1 name=Internet_of_Things vlan-id=20
add interface=bridge1 name=LTE19 vlan-id=50
add interface=bridge1 name=Work_Devices vlan-id=30
add interface=ether1 mtu=1508 name=vlan6 vlan-id=6
/interface list
add name=WAN
add name=VLAN
/ip pool
add name=Internal_LAN ranges=192.168.1.100-192.168.1.200
add name=Internet_of_Things ranges=10.0.20.100-10.0.20.200
add name=Work_Devices ranges=10.0.30.100-10.0.30.200
add name=IP_camera_nas ranges=10.0.40.100-10.0.40.200
add name=IPTV ranges=10.0.60.100-10.0.60.200
/ip dhcp-server
add address-pool=Internal_LAN interface=Internal_LAN lease-time=1d name=\
Internal_LAN
add address-pool=Internet_of_Things interface=Internet_of_Things lease-time=\
1d name=Internet_of_Things
add address-pool=Work_Devices interface=Work_Devices lease-time=1d name=\
Work_Devices
add address-pool=IP_camera_nas interface=IP_camera_nas lease-time=1d name=\
dhcp1
add address-pool=IPTV interface=IPTV lease-time=1d name=dhcp2
/ppp profile
set *FFFFFFFE on-up=pppoe_gateway only-one=yes use-upnp=no
/interface pppoe-client
add add-default-route=yes disabled=no interface=vlan6 keepalive-timeout=30 \
max-mru=1500 max-mtu=1500 name=pppoe-out1 password=strongpassword profile=\
default-encryption use-peer-dns=yes user=user
/queue type
add kind=pcq name=pcq-download pcq-classifier=dst-address
add kind=pcq name=pcq-upload pcq-classifier=src-address
/queue simple
add max-limit=130M/25M name=queue1 queue=pcq-download/pcq-upload target=LTE19
add max-limit=70M/30M name=queue2 queue=pcq-download/pcq-upload target=\
pppoe-out1
/routing table
add disabled=no fib name=to_KPN
add disabled=no fib name=to_LTE19
/interface bridge port
add bridge=bridge1 frame-types=admit-only-vlan-tagged interface=ether3
add bridge=bridge1 frame-types=admit-only-vlan-tagged interface=ether4
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether5 pvid=10
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether6 pvid=10
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether7 pvid=10
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=sfp-sfpplus1 pvid=10
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether2 pvid=60
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether8 pvid=10
/ipv6 settings
set accept-router-advertisements=yes
/interface bridge vlan
add bridge=bridge1 tagged=bridge1,ether3,ether4 untagged=\
ether2,ether5,ether6,ether7,sfp-sfpplus1,ether8 vlan-ids=\
10,20,30,40,50,60
/interface list member
add interface=Internal_LAN list=VLAN
add interface=Internet_of_Things list=VLAN
add interface=Work_Devices list=VLAN
add interface=IP_camera_nas list=VLAN
add interface=pppoe-out1 list=WAN
add interface=LTE19 list=WAN
add interface=ether1 list=WAN
/ip address
add address=10.0.10.2/24 interface=ether1 network=10.0.10.0
add address=192.168.1.1/24 interface=Internal_LAN network=192.168.1.0
add address=10.0.20.1/24 interface=Internet_of_Things network=10.0.20.0
add address=10.0.30.1/24 interface=Work_Devices network=10.0.30.0
add address=10.0.40.1/24 interface=IP_camera_nas network=10.0.40.0
add address=192.168.8.2/24 interface=LTE19 network=192.168.8.0
add address=10.0.60.1/24 interface=IPTV network=10.0.60.0
/ip dhcp-client
add interface=LTE19
/ip dhcp-server network
add address=10.0.20.0/24 gateway=10.0.20.1
add address=10.0.30.0/24 gateway=10.0.30.1
add address=10.0.40.0/24 gateway=10.0.40.1
add address=10.0.60.0/24 gateway=10.0.60.1
add address=192.168.1.0/24 gateway=192.168.1.1
/ip dns
set allow-remote-requests=yes
/ip firewall address-list
add address=192.168.1.0/24 list=connected_subnets
add address=10.0.20.0/24 list=connected_subnets
add address=10.0.30.0/24 list=connected_subnets
add address=10.0.40.0/24 list=connected_subnets
add address=192.168.8.0/24 list=connected_subnets
add address=10.0.10.0/24 list=connected_subnets
add address=10.0.60.0/24 list=commected_subnets
/ip firewall filter
add action=accept chain=input comment="Allow established, related, untracked" \
connection-state=established,related,untracked
add action=reject chain=input comment="drop dns resolver" dst-port=53 \
in-interface-list=WAN protocol=udp reject-with=icmp-network-unreachable
add action=reject chain=input comment="drop dns resolver" dst-port=53 \
in-interface-list=WAN protocol=tcp reject-with=icmp-network-unreachable
add action=accept chain=input comment="accept icmp" protocol=icmp
add action=drop chain=input comment="drop all not coming from VLAN" \
in-interface-list=!VLAN
add action=drop chain=input comment="drop invalid" connection-state=invalid
add action=fasttrack-connection chain=forward comment=fasttrack \
connection-mark=no-mark hw-offload=yes
add action=accept chain=forward comment=\
"accept established, related, untracked" connection-state=\
established,related,untracked
add action=accept chain=forward comment=\
"Allow access to IP camera from Internal LAN" dst-address=10.0.40.64 \
in-interface=Internal_LAN out-interface=IP_camera_nas
add action=accept chain=forward comment=\
"Allow access to NAS surveillance from Internal LAN" dst-address=\
10.0.40.182 in-interface=Internal_LAN out-interface=IP_camera_nas
add action=accept chain=forward comment=\
"allow access to printer from Work Devices" dst-address=192.168.1.5 \
dst-address-list="" in-interface=Work_Devices out-interface=Internal_LAN
add action=drop chain=forward comment=\
"no outside access to IP_camera_nas VLAN" in-interface=IP_camera_nas \
out-interface-list=WAN
add action=accept chain=forward comment="VLAN internet access only" \
connection-state=new in-interface-list=VLAN out-interface-list=WAN
add action=drop chain=forward comment="VLAN no inter communication" \
in-interface=all-vlan out-interface=all-vlan
add action=drop chain=forward comment="drop all from WAN not DSTNATed" \
connection-nat-state=!dstnat in-interface-list=WAN
add action=drop chain=forward comment="drop invalid" connection-state=invalid
/ip firewall mangle
add action=change-ttl chain=postrouting new-ttl=set:64 out-interface=LTE19 \
passthrough=yes
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WAN
/ip route
add comment=to_KPN disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
195.190.228.96 routing-table=to_KPN scope=30 suppress-hw-offload=no \
target-scope=10
add comment=to_LTE19 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
10.0.0.1 routing-table=to_LTE19 scope=30 suppress-hw-offload=no \
target-scope=10
/ip service
set telnet disabled=yes
set ftp disabled=yes
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/ipv6 address
add from-pool=ipv6_pool interface=Internal_LAN
add from-pool=ipv6_pool interface=Work_Devices
add from-pool=ipv6_pool interface=Internet_of_Things
/ipv6 dhcp-client
add interface=pppoe-out1 pool-name=ipv6_pool request=prefix
/ipv6 firewall address-list
add address=fe80::/10 comment="defconf: RFC6890 Linked-Scoped Unicast" list=\
no_forward_ipv6
add address=ff00::/8 comment="defconf: multicast" list=no_forward_ipv6
add address=::1/128 comment="defconf: RFC6890 lo" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: RFC6890 IPv4 mapped" list=\
bad_ipv6
add address=2001::/23 comment="defconf: RFC6890" list=bad_ipv6
add address=2001:db8::/32 comment="defconf: RFC6890 documentation" list=\
bad_ipv6
add address=2001:10::/28 comment="defconf: RFC6890 orchid" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: RFC6890 Discard-only" list=\
not_global_ipv6
add address=2001::/32 comment="defconf: RFC6890 TEREDO" list=not_global_ipv6
add address=2001:2::/48 comment="defconf: RFC6890 Benchmark" list=\
not_global_ipv6
add address=fc00::/7 comment="defconf: RFC6890 Unique-Local" list=\
not_global_ipv6
add address=::/128 comment="defconf: unspecified" list=bad_dst_ipv6
add address=::/128 comment="defconf: unspecified" list=bad_src_ipv6
add address=ff00::/8 comment="defconf: multicast" list=bad_src_ipv6
/ipv6 firewall filter
add action=accept chain=input comment="defconf: accept ICMPv6 after RAW" \
protocol=icmpv6
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=accept chain=input comment="defconf: accept UDP traceroute" \
dst-port=33434-33534 protocol=udp
add action=accept chain=input comment=\
"defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
protocol=udp
add action=accept chain=input comment="defconf: accept IPSec AH" protocol=\
ipsec-ah
add action=accept chain=input comment="defconf: accept IPSec ESP" protocol=\
ipsec-esp
add action=drop chain=input comment="defconf: drop all not coming from VLAN" \
in-interface-list=!VLAN
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 bad forward IPs" \
src-address-list=no_forward_ipv6
add action=drop chain=forward comment="defconf: drop bad forward IPs" \
dst-address-list=no_forward_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6 after RAW" \
protocol=icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept AH" protocol=\
ipsec-ah
add action=accept chain=forward comment="defconf: accept ESP" protocol=\
ipsec-esp
add action=accept chain=forward comment=\
"defconf: accept all that matches IPSec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
"defconf: drop everything else not coming from VLAN" in-interface-list=\
!VLAN
/ipv6 nd
set [ find default=yes ] advertise-dns=no disabled=yes hop-limit=64 \
managed-address-configuration=yes other-configuration=yes ra-preference=\
low reachable-time=5m
add advertise-dns=no interface=pppoe-out1 ra-lifetime=none ra-preference=low \
reachable-time=5m
add dns=2a02:a47f:e000::54,2a02:a47f:e000::53 interface=Internal_LAN \
other-configuration=yes ra-preference=high reachable-time=5m
add dns=2a02:a47f:e000::54,2a02:a47f:e000::53 interface=Work_Devices \
other-configuration=yes ra-preference=high reachable-time=5m
add dns=2a02:a47f:e000::54,2a02:a47f:e000::53 interface=Internet_of_Things \
other-configuration=yes ra-preference=high reachable-time=5m
/routing rule
add action=lookup-only-in-table comment="route VLAN10 to Mikrotik router" \
disabled=no dst-address=192.168.1.0/24 src-address=192.168.1.0/24 table=\
main
add action=lookup-only-in-table comment="route VLAN30 to VLAN10 printer" \
disabled=no dst-address=192.168.1.0/24 src-address=10.0.30.0/24 table=\
main
add action=lookup-only-in-table comment="route VLAN10 to VLAN50 modem" \
disabled=no dst-address=192.168.8.0/24 src-address=192.168.1.0/24 table=\
main
add action=lookup-only-in-table comment="route VLAN10 to VLAN40" disabled=no \
dst-address=10.0.40.0/24 src-address=192.168.1.0/24 table=main
add action=lookup-only-in-table comment="route VLAN10 to ISP LTE19" disabled=\
no src-address=192.168.1.0/24 table=to_LTE19
add action=lookup-only-in-table comment="route VLAN20 to ISP LTE19" disabled=\
no src-address=10.0.20.0/24 table=to_LTE19
add action=lookup-only-in-table comment="route VLAN30 to ISP LTE19" disabled=\
no src-address=10.0.30.0/24 table=to_LTE19
add action=lookup-only-in-table comment="route VLAN60 to ISP KPN" disabled=no \
src-address=10.0.60.0/24 table=to_KPN
/system clock
set time-zone-name=Europe/Amsterdam
/system clock manual
set dst-delta=+01:00 dst-end="2024-10-27 03:00:00" dst-start=\
"2024-03-31 02:00:00" time-zone=+01:00
/system identity
set name=Router
/system note
set show-at-login=no
/system ntp client
set enabled=yes
/system ntp server
set broadcast=yes enabled=yes manycast=yes multicast=yes
/system ntp client servers
add address=0.nl.pool.ntp.org
add address=1.nl.pool.ntp.org
add address=2.nl.pool.ntp.org
add address=3.nl.pool.ntp.org
/system scheduler
add interval=1m name=schedule1 on-event=lte19_gateway policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=2024-05-30 start-time=18:30:00
/system script
add dont-require-permissions=no name=pppoe_gateway owner=liviu policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\
local pppoenewgw [/ip address get [find interface=\"pppoe-out1\"] network]\
;\r\
\n:local pppoeroutegw [/ip route get [find comment=\"to_KPN\"] gateway];\r\
\n:if (\$pppoenewgw != \$pppoeroutegw) do={\r\
\n /ip route set [find comment=\"to_KPN\"] gateway=\$pppoenewgw;\r\
\n /ip firewall connection {:foreach r in=[find] do={remove \$r}};\r\
\n}"
add dont-require-permissions=no name=lte19_gateway owner=liviu policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\
local newgw [ip dhcp-client get [find interface=\"LTE19\"] gateway];\r\
\n:local routegw [/ip route get [find comment=\"to_LTE19\"] gateway];\r\
\nif (\$newgw != \$routegw) do={\r\
\n /ip route set [find comment=\"to_LTE19\"] gateway=\$newgw;\r\
\n /ip firewall connection {:foreach r in=[find] do={remove \$r}};\r\
\n}"