Skip to content

Instantly share code, notes, and snippets.

@cscashby
Created March 28, 2021 19:29
Show Gist options
  • Save cscashby/15ccac2ab646f9dc881469a278042bd2 to your computer and use it in GitHub Desktop.
Save cscashby/15ccac2ab646f9dc881469a278042bd2 to your computer and use it in GitHub Desktop.
/interface ethernet
set [ find default-name=ether1 ] name=cam1
set [ find default-name=ether2 ] name=cam2
set [ find default-name=ether3 ] name=cam3
set [ find default-name=ether4 ] name=cam4
/interface list
add name=CAMERAS
/routing table
add fib name=cam1
add fib name=cam2
add fib name=cam3
add fib name=cam4
/interface bridge port
add bridge=bridge interface=ether5
/interface list member
add interface=cam1 list=CAMERAS
add interface=cam2 list=CAMERAS
add interface=cam3 list=CAMERAS
add interface=cam4 list=CAMERAS
/ip address
add address=192.168.88.11/24 interface=bridge network=192.168.88.0
add address=192.168.88.12/24 interface=bridge network=192.168.88.0
add address=192.168.88.13/24 interface=bridge network=192.168.88.0
add address=192.168.88.14/24 interface=bridge network=192.168.88.0
/ip dhcp-client
add disabled=no interface=cam1
add disabled=no interface=cam2
add disabled=no interface=cam3
add disabled=no interface=cam4
/ip firewall filter
add action=accept chain=forward out-interface-list=CAMERAS
/ip firewall mangle
add action=mark-connection chain=prerouting dst-address=192.168.88.11 \
new-connection-mark=cam1
add action=mark-connection chain=prerouting dst-address=192.168.88.12 \
new-connection-mark=cam2
add action=mark-connection chain=prerouting dst-address=192.168.88.13 \
new-connection-mark=cam3
add action=mark-connection chain=prerouting dst-address=192.168.88.14 \
new-connection-mark=cam4
add action=mark-routing chain=prerouting connection-mark=cam1 \
new-routing-mark=cam1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cam2 \
new-routing-mark=cam2 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cam3 \
new-routing-mark=cam3 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cam4 \
new-routing-mark=cam4 passthrough=no
/ip firewall nat
add action=dst-nat chain=dstnat dst-address=192.168.88.11 dst-port=7070 \
protocol=udp to-addresses=192.168.8.1
add action=dst-nat chain=dstnat dst-address=192.168.88.12 dst-port=7070 \
protocol=udp to-addresses=192.168.8.1
add action=dst-nat chain=dstnat dst-address=192.168.88.13 dst-port=7070 \
protocol=udp to-addresses=192.168.8.1
add action=dst-nat chain=dstnat dst-address=192.168.88.14 dst-port=7070 \
protocol=udp to-addresses=192.168.8.1
add action=masquerade chain=srcnat out-interface=cam1
add action=masquerade chain=srcnat out-interface=cam2
add action=masquerade chain=srcnat out-interface=cam3
add action=masquerade chain=srcnat out-interface=cam4
/ip route
add distance=1 dst-address=192.168.8.0/24 gateway=cam1 routing-table=cam1
add distance=1 dst-address=192.168.8.0/24 gateway=cam2 routing-table=cam2
add distance=1 dst-address=192.168.8.0/24 gateway=cam3 routing-table=cam3
add distance=1 dst-address=192.168.8.0/24 gateway=cam4 routing-table=cam4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment