/ip address
add address=192.168.11.1/24
network=192.168.0.0 broadcast=192.168.0.255 interface=Lan
add address=192.168.11.2/24
network=192.168.1.0 broadcast=192.168.1.255 interface=PUBLIC1
add address=192.168.12.2/24
network=192.168.2.0 broadcast=192.168.2.255 interface=PUBLIC2
add address=192.168.13.2/24
network=192.168.3.0 broadcast=192.168.3.255 interface=PUBLIC3
add address=192.168.14.2/24
network=192.168.4.0 broadcast=192.168.4.255 interface=PUBLIC4
/ip firewall mangle
add chain=input
in-interface=PUBLIC1 action=mark-connection new-connection-mark=PUBLIC1_conn
add chain=input
in-interface=PUBLIC2 action=mark-connection new-connection-mark=PUBLIC2_conn
add chain=input
in-interface=PUBLIC3 action=mark-connection new-connection-mark=PUBLIC3_conn
add chain=input
in-interface=PUBLIC4 action=mark-connection new-connection-mark=PUBLIC4_conn
add chain=output
connection-mark=PUBLIC1_conn action=mark-routing new-routing-mark=to_PUBLIC1
add chain=output
connection-mark=PUBLIC2_conn action=mark-routing new-routing-mark=to_PUBLIC2
add chain=output
connection-mark=PUBLIC3_conn action=mark-routing new-routing-mark=to_PUBLIC3
add chain=output
connection-mark=PUBLIC4_conn action=mark-routing new-routing-mark=to_PUBLIC4
add chain=prerouting
dst-address=192.168.1.0/24 action=accept in-interface=Lan
add chain=prerouting
dst-address=192.168.2.0/24 action=accept in-interface=Lan
add chain=prerouting
dst-address=192.168.3.0/24 action=accept in-interface=Lan
add chain=prerouting
dst-address=192.168.4.0/24 action=accept in-interface=Lan
add chain=prerouting
dst-address-type=!lan in-interface=Lan
per-connection-classifier=both-addresses-and-ports:4/0 action=mark-connection
new-connection-mark=PUBLIC1_conn passthrough=yes
add chain=prerouting
dst-address-type=!lan in-interface=Lan
per-connection-classifier=both-addresses-and-ports:4/1 action=mark-connection
new-connection-mark=PUBLIC2_conn passthrough=yes
add chain=prerouting
dst-address-type=!lan in-interface=Lan
per-connection-classifier=both-addresses-and-ports:4/2 action=mark-connection
new-connection-mark=PUBLIC3_conn passthrough=yes
add chain=prerouting
dst-address-type=!lan in-interface=Lan
per-connection-classifier=both-addresses-and-ports:4/3 action=mark-connection
new-connection-mark=PUBLIC4_conn passthrough=yes
add chain=prerouting
connection-mark=PUBLIC1_conn in-interface=Lan action=mark-routing
new-routing-mark=to_PUBLIC1
add chain=prerouting
connection-mark=PUBLIC2_conn in-interface=Lan action=mark-routing
new-routing-mark=to_PUBLIC2
add chain=prerouting
connection-mark=PUBLIC3_conn in-interface=Lan action=mark-routing
new-routing-mark=to_PUBLIC3
add chain=prerouting
connection-mark=PUBLIC4_conn in-interface=Lan action=mark-routing
new-routing-mark=to_PUBLIC4
/ip route
add
dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_PUBLIC1
check-gateway=ping
add
dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_PUBLIC2
check-gateway=ping
add
dst-address=0.0.0.0/0 gateway=192.168.3.1 routing-mark=to_PUBLIC3
check-gateway=ping
add
dst-address=0.0.0.0/0 gateway=192.168.4.1 routing-mark=to_PUBLIC4
check-gateway=ping
add
dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add
dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0
gateway=192.168.3.1 distance=3 check-gateway=ping
add
dst-address=0.0.0.0/0 gateway=192.168.4.1 distance=4 check-gateway=ping
/ip firewall nat
add chain=srcnat
out-interface=PUBLIC1 action=masquerade
add chain=srcnat
out-interface=PUBLIC2 action=masquerade
add chain=srcnat
out-interface=PUBLIC3 action=masquerade
add chain=srcnat
out-interface=PUBLIC4 action=masquerade
0 komentar:
Post a Comment