Config Hotspot Server and Loadbalancing Failover method PCC on Mikrotik

Config Hotspot Server and Loadbalancing Failover method PCC on Mikrotik

* Vài lưu ý trước khi vào nội dung chính mình cần chia sẻ :
  • 1. Bài viết này mang tính chất là dành cho cá nhân để lưu trữ kiến thức cũng như kinh nghiệm bản thân đã trải qua.
  • 2. Bài viết chia sẻ phi lợi nhuân.
  • 3. Bài viết có thể làm vài bạn sẽ biểu môi rằng đơn giản thế này ai chẳng biết, post lên làm gì ==> thì nhìn lại mục "1" nhé.
  • 4. Bài viết có lấy hình ảnh và một vài nội dung trên internet, nên nếu có gì vi phạm, cảm phiền các bạn báo lại giúp mình

      Với Mikrotik thì việc cấu hình Loadbalancing Failover đã quá quen thuộc với hầu hết chúng ta và việc đó được thực hiện 1 cách nhanh chóng và dễ dàng. Nhưng việc cấu hình Loadbalancing Failover method PCC (Per Connection Classifier) chung với Server Hotspot sẽ xảy ra 1 trong các trường hợp như: User active hotspot nhưng không thể truy cập Internet hoặc nghiêm trọng hơn là không hiển thị trang Login...

      Để giải quyết các vấn đề đó, hôm nay mình sẽ share code phần liên quan đến Loadbalancing Failover và Hotspot.


Code
/interface bridge settings
set use-ip-firewall=yes use-ip-firewall-for-pppoe=yes

/ip hotspot
add address-pool=dhcp_pool0 disabled=no interface=bridge1 name=hotspot1 profile=hsprof1

/ip firewall mangle
add action=accept chain=prerouting dst-address-list=LAN
add action=mark-connection chain=input in-interface=pppoe-out1 new-connection-mark=wan1_conn passthrough=yes
add action=mark-connection chain=input in-interface=pppoe-out2 new-connection-mark=wan2_conn passthrough=yes
add action=mark-routing chain=output connection-mark=wan1_conn new-routing-mark=to-wan1 out-interface=pppoe-out1 passthrough=yes
add action=mark-routing chain=output connection-mark=wan2_conn new-routing-mark=to-wan2 out-interface=pppoe-out2 passthrough=yes
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local hotspot=auth in-interface=bridge1 new-connection-mark=WAN1-CONN passthrough= yes per-connection-classifier=both-addresses-and-ports:2/0
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local hotspot=auth in-interface=bridge1 new-connection-mark=WAN2-CONN passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1
add action=mark-routing chain=prerouting connection-mark=WAN1-CONN in-interface=bridge1 new-routing-mark=WAN1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=WAN2-CONN in-interface=bridge1 new-routing-mark=WAN2 passthrough=no

/ip firewall nat
add action=masquerade chain=srcnat out-interface=pppoe-out1
add action=masquerade chain=srcnat out-interface=pppoe-out2
add action=accept chain=pre-hotspot dst-address-type=!local hotspot=auth

/ip route
add check-gateway=ping distance=1 gateway=pppoe-out1 routing-mark=WAN1
add check-gateway=ping distance=1 gateway=pppoe-out2 routing-mark=WAN2

Chúc các bạn thành công!

Đặt quảng cáo của bạn ở đây

Nhận xét