Mikrotik แยกกลุ่มผู้ใช้ออกเน็ตคนละเส้น

มีเน็ตหลายเส้น สามารถให้ผู้ใช้วงเครือข่ายเดียวกันออกเน็ตคนละเส้นได้

เนื่องจากเน็ตโรงเรียนมี 2 สาย คือ UNINET 100/100Mbps และ TOT ECO Lease Line 10/10Mbps จึงไม่สามารถทำเป็น Load Balance ได้เหมาะ จึงใช้ TOT เป็นสายสำรอง (Fail Over) แต่ถ้าไม่ใช้เลยก็เสียดาย จึงได้กำหนดกลุ่มผู้ใช้ออกมาส่วนหนึ่งให้ออกเน็ตสาย TOT เลย

ขั้นตอน

WAN1_USERS_LIST = 192.168.2.6
WAN2_USERS_LIST = 192.168.2.7

WAN1 Router IP = 192.168.5.1
WAN2 Router IP = 192.168.6.1

ขั้นตอนดังนี้

STEP#1: First we will create ADDRESS-LIST, and add our users in the list,
STEP#2: Then We have to add two IP Firewall Mangle rules to mark the packets originated from user 1 and user2.
STEP#3: Then we should specify two default routes (destination 0.0.0.0/0) with appropriate routing marks and gateways.
STEP#4: Then simple add one NAT rule for local ip series and Action masquerade.

==============SCRIPT=================

/ip address
add address=192.168.2.1/24 disabled=no interface=LAN network=192.168.2.0
add address=192.168.5.1/24 disabled=no interface=WAN1 network=192.168.5.0
add address=192.168.6.1/24 disabled=no interface=WAN2 network=192.168.6.0
/ip firewall address-list
add address=192.168.2.6 disabled=no list=DSL1_USERS_LIST
add address=192.168.2.7 disabled=no list=DSL2_USERS_LIST
/ip firewall mangle
add action=mark-routing chain=prerouting disabled=no new-routing-mark=wan1_user passthrough=no src-address-list=DSL1_USERS_LIST
add action=mark-routing chain=prerouting disabled=no new-routing-mark=wan2_user passthrough=no src-address-list=DSL2_USERS_LIST
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.5.2 routing-mark=wan1_user scope=30 target-scope=10
add disabled=no distance=2 dst-address=0.0.0.0/0 gateway=192.168.6.2 routing-mark=wan2_user scope=30 target-scope=10
/ip firewall nat
add action=masquerade chain=srcnat disabled=no src-address=192.168.2.0/24

=====================================

ทดสอบ

สามารถทดสอบได้โดยการเข้าไป COMMAND (CMD)
C:\tracert -d 8.8.8.8

ที่มา:
By  Syed Jahanzaib: https://aacable.wordpress.com/2011/10/27/mikrotik-policy-routing-based-on-client-ip-address/

ใส่ความเห็น

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องข้อมูลจำเป็นถูกทำเครื่องหมาย *