PCC Method

Mikrotik Load Balancing (PCC Method)

let’s get started.

/ ip address
add address=10.10.10.1/24 network=10.10.10.0 broadcast=10.10.10.255 interface=ether5-switch
add address=192.168.10.2/24 network=192.168.10.0 broadcast=192.168.10.255 interface=ether1-ISP1
add address=192.168.20.2/24 network=192.168.20.0 broadcast=192.168.20.255 interface=ether2-ISP2

/ ip firewall mangle
add chain=prerouting dst-address=192.168.10.0/24 action=accept in-interface=ether5-switch
add chain=prerouting dst-address=192.168.20.0/24 action=accept in-interface=ether5-switch

add chain=prerouting in-interface=ether1-ISP1 connection-mark=no-mark action=mark-connection \
new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ether2-ISP2 connection-mark=no-mark action=mark-connection \
new-connection-mark=ISP2_conn

add chain=prerouting in-interface=ether5-switch connection-mark=no-mark dst-address-type=!local \
per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ether5-switch connection-mark=no-mark dst-address-type=!local \
per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=ISP2_conn

add chain=prerouting connection-mark=ISP1_conn in-interface=ether5-switch action=mark-routing \
new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=ether5-switch action=mark-routing \
new-routing-mark=to_ISP2
add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2

/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.10.1 routing-mark=to_ISP1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.20.1 routing-mark=to_ISP2 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=192.168.10.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.20.1 distance=2 check-gateway=ping

/ ip firewall nat
add chain=srcnat out-interface=ether1-ISP1 action=masquerade
add chain=srcnat out-interface=ether2-ISP2 action=masquerade

برای آموزش از طریق winbox نیز اینجا را کلیک کنید.