Recently I was working on a small test work so I deployed Mikrotik on my home LAN to balance the two ISP which I had at home. One was PTCL and other on Connect Communication, on both links I already have a router/modem which works as a DHCP server.
I used RB750 for this.
I started of by naming the interface for my convenience. ether1=PTCL , ether2=CONNECT, ether5=LAN
Then I enabled DHCP client on both ethernet interface on which PTCL and Connect were terminated.
Using winbox. Attached are screenshot:
After the DHCP is enable on both interfaces, we can verify by check on IP -> DHCP-CLIENT
FOR DHCP server at LAN:
/ip dhcp-server
setup
Select interface to run DHCP server on
dhcp server interface: LAN
Select network for DHCP addresses
dhcp address space: 192.168.100.0/24
Select gateway for given network
gateway for dhcp network: 192.168.100.1
Select pool of ip addresses given out by DHCP server
addresses to give out: 192.168.0.2-192.168.200
Select DNS servers
dns servers: 10.101.10.5 (Connect) , 192.168.1.1 (PTCL)
Select lease time
lease time: 3d
after this mangle rule and routing follows which will be used for balancing the link.
/ip firewall mangle
add chain=input in-interface=CONNECT action=mark-connection new-connection-mark=CONNECT_conn
add chain=input in-interface=PTCL action=mark-connection new-connection-mark=PTCL_conn
add chain=output connection-mark=CONNECT_conn action=mark-routing new-routing-mark=to_CONNECT
add chain=output connection-mark=PTCL_conn action=mark-routing new-routing-mark=to_PTCL
add chain=prerouting dst-address=192.168.0.0/24 action=accept in-interface=LAN
add chain=prerouting dst-address=192.168.1.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=CONNECT_conn 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=CONNECT_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=PTCL_conn passthrough=yes
add chain=prerouting connection-mark=CONNECT_conn in-interface=LAN action=mark-routing new-routing-mark=to_CONNECT
add chain=prerouting connection-mark=PTCL_conn in-interface=LAN action=mark-routing new-routing-mark=to_PTCL
/ip route
add dst-address=0.0.0.0/0 gateway=192.168.0.1 routing-mark=to_CONNECT check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_PTCL check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.0.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=2 check-gateway=ping
/ip firewall nat
add chain=srcnat out-interface=CONNECT action=masquerade
add chain=srcnat out-interface=PTCL action=masquerade
above graph shows the bandwidth aggregated.
There is some tuning with the mikrotik balancing and more testing will be posting as its done.
This can also be implement SOHO environment as well with RB750, RB750GL no need of getting a server and save electricity :D
Reference: http://aacable.wordpress.com/2011/07/27/mikrotik-dual-wan-load-balancing-using-pcc-method-complete-script-by-zaib/
I used RB750 for this.
I started of by naming the interface for my convenience. ether1=PTCL , ether2=CONNECT, ether5=LAN
Then I enabled DHCP client on both ethernet interface on which PTCL and Connect were terminated.
Using winbox. Attached are screenshot:
After the DHCP is enable on both interfaces, we can verify by check on IP -> DHCP-CLIENT
FOR DHCP server at LAN:
/ip dhcp-server
setup
Select interface to run DHCP server on
dhcp server interface: LAN
Select network for DHCP addresses
dhcp address space: 192.168.100.0/24
Select gateway for given network
gateway for dhcp network: 192.168.100.1
Select pool of ip addresses given out by DHCP server
Select DNS servers
dns servers: 10.101.10.5 (Connect) , 192.168.1.1 (PTCL)
Select lease time
lease time: 3d
after this mangle rule and routing follows which will be used for balancing the link.
/ip firewall mangle
add chain=input in-interface=CONNECT action=mark-connection new-connection-mark=CONNECT_conn
add chain=input in-interface=PTCL action=mark-connection new-connection-mark=PTCL_conn
add chain=output connection-mark=CONNECT_conn action=mark-routing new-routing-mark=to_CONNECT
add chain=output connection-mark=PTCL_conn action=mark-routing new-routing-mark=to_PTCL
add chain=prerouting dst-address=192.168.0.0/24 action=accept in-interface=LAN
add chain=prerouting dst-address=192.168.1.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=CONNECT_conn 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=CONNECT_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=PTCL_conn passthrough=yes
add chain=prerouting connection-mark=CONNECT_conn in-interface=LAN action=mark-routing new-routing-mark=to_CONNECT
add chain=prerouting connection-mark=PTCL_conn in-interface=LAN action=mark-routing new-routing-mark=to_PTCL
/ip route
add dst-address=0.0.0.0/0 gateway=192.168.0.1 routing-mark=to_CONNECT check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_PTCL check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.0.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=2 check-gateway=ping
/ip firewall nat
add chain=srcnat out-interface=CONNECT action=masquerade
add chain=srcnat out-interface=PTCL action=masquerade
above graph shows the bandwidth aggregated.
There is some tuning with the mikrotik balancing and more testing will be posting as its done.
This can also be implement SOHO environment as well with RB750, RB750GL no need of getting a server and save electricity :D
Reference: http://aacable.wordpress.com/2011/07/27/mikrotik-dual-wan-load-balancing-using-pcc-method-complete-script-by-zaib/
No comments:
Post a Comment