You are on page 1of 3

/ip address

add address=192.168.15.2/24 interface=ether1


add address=192.168.25.2/24 interface=ether2
add address=192.168.35.2/24 interface=ether3
add address=192.168.45.2/24 interface=ether4
add address=192.168.55.2/24 interface=ether5
add address=192.168.65.2/24 interface=ether6
add address=192.168.75.2/24 interface=ether7
add address=192.168.85.2/24 interface=ether8
add address=192.168.95.2/24 interface=ether9

add address=10.10.10.1/24 interface=ether10

/ip firewall nat


add chain=srcnat out-interface=ether1 action=masquerade
add chain=srcnat out-interface=ether2 action=masquerade
add chain=srcnat out-interface=ether3 action=masquerade
add chain=srcnat out-interface=ether4 action=masquerade
add chain=srcnat out-interface=ether5 action=masquerade
add chain=srcnat out-interface=ether6 action=masquerade
add chain=srcnat out-interface=ether7 action=masquerade
add chain=srcnat out-interface=ether8 action=masquerade
add chain=srcnat out-interface=ether9 action=masquerade

/ip route
add gateway=192.168.15.1 check-gateway=ping distance=1
add gateway=192.168.25.1 check-gateway=ping distance=2
add gateway=192.168.35.1 check-gateway=ping distance=3
add gateway=192.168.45.1 check-gateway=ping distance=4
add gateway=192.168.55.1 check-gateway=ping distance=5
add gateway=192.168.65.1 check-gateway=ping distance=6
add gateway=192.168.75.1 check-gateway=ping distance=7
add gateway=192.168.85.1 check-gateway=ping distance=8
add gateway=192.168.95.1 check-gateway=ping distance=9

/ip firewall mangle


add chain=prerouting in-interface=ether1 connection-state=new new-connection-
mark=ether1_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether2 connection-state=new new-connection-
mark=ether2_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether3 connection-state=new new-connection-
mark=ether3_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether4 connection-state=new new-connection-
mark=ether4_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether5 connection-state=new new-connection-
mark=ether5_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether6 connection-state=new new-connection-
mark=ether6_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether7 connection-state=new new-connection-
mark=ether7_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether8 connection-state=new new-connection-
mark=ether8_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=ether9 connection-state=new new-connection-
mark=ether9_conn action=mark-connection passthrough=yes
add chain=output connection-mark=ether1_conn new-routing-mark=to_ether1
action=mark-routing passthrough=yes
add chain=output connection-mark=ether2_conn new-routing-mark=to_ether2
action=mark-routing passthrough=yes
add chain=output connection-mark=ether3_conn new-routing-mark=to_ether3
action=mark-routing passthrough=yes
add chain=output connection-mark=ether4_conn new-routing-mark=to_ether4
action=mark-routing passthrough=yes
add chain=output connection-mark=ether5_conn new-routing-mark=to_ether5
action=mark-routing passthrough=yes
add chain=output connection-mark=ether6_conn new-routing-mark=to_ether6
action=mark-routing passthrough=yes
add chain=output connection-mark=ether7_conn new-routing-mark=to_ether7
action=mark-routing passthrough=yes
add chain=output connection-mark=ether8_conn new-routing-mark=to_ether8
action=mark-routing passthrough=yes
add chain=output connection-mark=ether9_conn new-routing-mark=to_ether9
action=mark-routing passthrough=yes

/ip firewall mangle


#Parte A
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/0 action=mark-connection new-
connection-mark=ether1_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/1 action=mark-connection new-
connection-mark=ether2_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/2 action=mark-connection new-
connection-mark=ether3_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/3 action=mark-connection new-
connection-mark=ether4_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/4 action=mark-connection new-
connection-mark=ether5_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/5 action=mark-connection new-
connection-mark=ether6_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/6 action=mark-connection new-
connection-mark=ether7_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/7 action=mark-connection new-
connection-mark=ether8_conn passthrough=yes
add chain=prerouting in-interface=ether10 connection-state=new dst-address-type=!
local per-connection-classifier=both-addresses:9/8 action=mark-connection new-
connection-mark=ether9_conn passthrough=yes

#Parte B
add chain=prerouting in-interface=ether10 connection-mark=ether1_conn action=mark-
routing new-routing-mark=to_ether1 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether2_conn action=mark-
routing new-routing-mark=to_ether2 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether3_conn action=mark-
routing new-routing-mark=to_ether3 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether4_conn action=mark-
routing new-routing-mark=to_ether4 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether5_conn action=mark-
routing new-routing-mark=to_ether5 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether6_conn action=mark-
routing new-routing-mark=to_ether6 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether7_conn action=mark-
routing new-routing-mark=to_ether7 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether8_conn action=mark-
routing new-routing-mark=to_ether8 passthrough=yes
add chain=prerouting in-interface=ether10 connection-mark=ether9_conn action=mark-
routing new-routing-mark=to_ether9 passthrough=yes

/ip firewall mangle


add chain=prerouting dst-address=192.168.15.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.25.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.35.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.45.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.55.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.65.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.75.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.85.0/24 action=accept in-
interface=ether10
add chain=prerouting dst-address=192.168.95.0/24 action=accept in-
interface=ether10

/ip route
add gateway=192.168.15.1 routing-mark=to_ether1 check-gateway=ping
add gateway=192.168.25.1 routing-mark=to_ether2 check-gateway=ping
add gateway=192.168.35.1 routing-mark=to_ether3 check-gateway=ping
add gateway=192.168.45.1 routing-mark=to_ether4 check-gateway=ping
add gateway=192.168.55.1 routing-mark=to_ether5 check-gateway=ping
add gateway=192.168.65.1 routing-mark=to_ether6 check-gateway=ping
add gateway=192.168.75.1 routing-mark=to_ether7 check-gateway=ping
add gateway=192.168.85.1 routing-mark=to_ether8 check-gateway=ping
add gateway=192.168.95.1 routing-mark=to_ether9 check-gateway=ping

You might also like