Labels
Mikrotik
Tuesday, May 10, 2016
2.Mikrotik Load Balancing and Fail Over For 2 Static IP WAN (PCC Method)
Simple Diagram:
Script:
/interface ethernet set 0 name=WAN1 set 1 name=WAN2 set 2 name=LAN /ip address add address=192.168.10.2/24 interface=WAN1 add address=192.168.20.2/24 interface=WAN2 add address=192.168.1.1/24 interface=LAN /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4 /ip firewall nat add chain=srcnat out-interface=WAN1 action=masquerade add chain=srcnat out-interface=WAN2 action=masquerade /ip firewall mangle add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=conn1 add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=conn2 add chain=output connection-mark=conn1 action=mark-routing new-routing-mark=To_WAN1 add chain=output connection-mark=conn2 action=mark-routing new-routing-mark=To_WAN2 add chain=prerouting dst-address=192.168.10.0/24 action=accept in-interface=LAN add chain=prerouting dst-address=192.168.20.0/24 action=accept in-interface=LAN add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=conn1 passthrough=yes add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=conn2 passthrough=yes add chain=prerouting connection-mark=conn1 in-interface=LAN action=mark-routing new-routing-mark=To_WAN1 add chain=prerouting connection-mark=conn2 in-interface=LAN action=mark-routing new-routing-mark=To_WAN2 /ip route add dst-address=0.0.0.0/0 gateway=192.168.10.1 routing-mark=To_WAN1 check-gateway=ping add dst-address=0.0.0.0/0 gateway=192.168.20.1 routing-mark=To_WAN2 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
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment