WAN : 9 WAN (PPPoE) to LAN
คำถาม
Router จากผู้ให้บริการเซตบริดจ์โหมดเรียบร้อยแล้ว
ต้องการคอนฟิก Mikrotik เพื่อทำ Loadbalance 9 เส้น
Port1 - wan 1 ( PPPoE Client) (30m/10m)
Port2 - wan 2 ( PPPoE Client) (30m/10m)
Port3 - wan 3 ( PPPoE Client) (30m/10m)
Port4 - wan 4 ( PPPoE Client) (30m/10m)
Port5 - wan 5 ( PPPoE Client) (30m/10m)
Port6 - wan 6 ( PPPoE Client) (30m/10m)
Port7 - wan 7 ( PPPoE Client) (30m/10m)
Port8 - wan 8 ( PPPoE Client) (100m/30m)
Port9- wan 9 ( PPPoE Client) (100m/30m)
Port10 - Lan (IP : 192.168.10.1/24 , dhcp 100-200)
คำตอบ
1. Remove Default Configuration / Reset clear config
1.1 -
ติดตั้งโปรแกรม Winbox เรียบร้อยแล้ว
1.2 เข้าโปรแกรม Winbox
- โดยปกติ mikrotik บางรุ่นจะมี default Config มาให้ ซึ่ง IP จะเป็น 192.168.88.1 (ถ้าไม่มีคอนฟิกใดๆจะเป็น 0.0.0.0)
- คลิกเลือกตัวอุปกรณ์ใน list
- เราจะไม่ใช้ default config ให้เลือก Remove Configuration
- หรือทำการ Reset ทั้งหมด โดย
เมนู System > Reset Configuration (เลือก No default Configuration)
กด Yes
(Mikrotik จะรีเซตและ รีบูทตัวเอง 1 รอบ)
1.3 เข้าโปรแกรม Winbox ใหม่อีกรอบ (สังเกตุ IP จะเป็น 0.0.0.0 แสดงว่ารีเซตเรียบร้อย)
2. WAN - สร้าง PPPoE
2.1 ทำการสร้าง PPPoE Client
เมนู PPP > แท็ป Interface กด " + " เพื่อสร้าง PPPoE Client
2.2 ที่แท็ป General
-ใช้ชื่อ default ที่มีมาให้ "pppoe-out1"
-Interface เลือก ether1
2.3 ที่แท็ป Dial Out
-ป้อน User, Password ของ PPPoE
- ติ๊กเลือก Use Peer DNS
2.4 ตรวจสอบการเชื่อมต่อ PPPoE Client
- สถานะตรงมุมขวาล่างของ PPPoE จะต้องแสดงเป็น connected
(ถ้าไม่ขึ้นแสดงว่า user,pass อาจผิดพลาด, สาย LAN หรือ ฝั่งจ่ายจากทางผู้ให้บริการมีปัญหาต้องกลับไปย้อนเช็คต้นทาง)
- เมนู IP > Address ใน address list จะต้องมีขึ้น IP ขา wan ที่ได้รับมา
- เมนู New Terminal
(ทดสอบ ping sys2u.online เพื่อเช็คว่าออกเน็ตได้ไหม)
2.5 ทำการสร้าง PPPoE Client ตามสเต็ปเดียวกันนี้จนครบ 9 wan
2.6 ทำการก็อป Code
/ip firewall mangle
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_1 passthrough=no per-connection-classifier=both-addresses-and-ports:13/0
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_2 passthrough=no per-connection-classifier=both-addresses-and-ports:13/1
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_3 passthrough=no per-connection-classifier=both-addresses-and-ports:13/2
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_4 passthrough=no per-connection-classifier=both-addresses-and-ports:13/3
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_5 passthrough=no per-connection-classifier=both-addresses-and-ports:13/4
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_6 passthrough=no per-connection-classifier=both-addresses-and-ports:13/5
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_7 passthrough=no per-connection-classifier=both-addresses-and-ports:13/6
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_8 passthrough=no per-connection-classifier=both-addresses-and-ports:13/7
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_8 passthrough=no per-connection-classifier=both-addresses-and-ports:13/8
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_8 passthrough=no per-connection-classifier=both-addresses-and-ports:13/9
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_9 passthrough=no per-connection-classifier=both-addresses-and-ports:13/10
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_9 passthrough=no per-connection-classifier=both-addresses-and-ports:13/11
add action=mark-routing chain=prerouting dst-address-type=!local new-routing-mark=wan_9 passthrough=no per-connection-classifier=both-addresses-and-ports:13/12
/ip firewall nat
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out1
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out2
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out3
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out4
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out5
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out6
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out7
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out8
add action=masquerade chain=srcnat dst-address-type=!local out-interface=pppoe-out9
*อธิบายเพิ่มเติม.
จากโค้ดจะเห็นได้ว่า wan8 และ wan9 จะมีวนเพิ่มอีกอย่างละ 3 ครั้ง ทั้งที่ wan อื่นๆ แค่ครั้งเดียว
นั่นเพราะว่า wan อื่นวิ่ง 30m เท่ากันหมด แต่ wan8 กับ wan9 มาเป็น 100m เลยต้องหั่นให้ใกล้เคียงกับ 30 m
เวลาที่อุปกรณ์วิ่งออกเน็ต ก็จะได้เฉลี่ยวิ่งออก ได้เต็มที่เต็มประสิทธิภาพมากที่สุด
2.7 เมนู Terminal ทำการ Paste
- เช็คค่าที่ได้หลังจากใส่ Code
3. สร้าง Bridge เพื่อสะดวกต่อการแก้ไขหรือเปลี่ยน Interface พร้อมกำหนด DNS ให้ตัวอุปกรณ์
3.1 เมนู Bridge แท็ป Bridge กด " + "
- ตั้งชื่อ bridge-lan กด OK
- เลือก Interface ที่ต้องการ ให้เข้ามาอยู่ในกลุ่ม Bridge ที่สร้างไว้แล้ว "bridge-lan"
ตัวอย่าง เลือก port10 เข้ามาให้ก่อน (สามารถเพิ่มหรือเปลี่ยนเป็น interface อื่นๆได้)
3.2 ใส่ DNS Server
-ปกติ Mikrotik จะ dynamic ดึง ip มาให้อัตโนมัติให้อยู่แล้ว แต่ก็สามารถกำหนดเพิ่มเองได้
ตัวอย่างใส่เป็น IP ของ google (8.8.8.8, 8.8.4.4)
-ติ๊กเลือก Allow Remote Requests
4. LAN - (สร้าง Network โดยกำหนด IP : 192.168.10.1/24 , dhcp 100-200)
(Hotspot Setup จะมีการสร้าง NAT, Route, IP, DHCP, Pool ฯลฯ ให้อัตโนมัติ ซึ่งสะดวกและรวดเร็วกว่าการ add เองมาก
หากเราไม่ต้องการ hotspot เราก็เพียง disable หรือลบ hotspot ออกทีหลังได้ โดยค่า config ออกเน็ตอื่นๆ ก็ยังอยู่เหมือนเดิม ใช้งานออกเน็ตได้ปกติ)
4.1 สร้าง Hotspot Setup
- เมูน IP > Hotspot
-แท็ป Server กดปุ่ม Hotspot Setup แล้วเลือก Interface "bridge-lan" กด Next
- กำหนด IP Network กด Next
(ตัวอย่างเป็น วง 192.168.10.1 sub 255.255.255.0)
- กำหนด rank DHCP ที่แจ้ง กด Next
(ตัวอย่าง แจก 192.168.10.100 - 200)
- Certificate เลือก none กด Next
(ถ้ามีการติดตั้ง Certificate จะทำให้ hotspot รองรับ login ผ่าน https:// ได้ และจะมี List ขึ้นมาให้เลือก)
- กด Next
- DNS Server จะขึ้นให้อัตโนมัติ กด Next
- DNS Name (ปล่อยว่าง) กด Next
(ปกติ hotspot จะแสดงเป็น IP แต่ถ้ากำหนดชื่อในส่วนนี้ ก็จะเป็น NAME แทน)
- Local user hotspot ใช้ default กด Next
(เป็น user ที่ใช้ login เข้า hotspot ปกติจะเป็น admin ไม่มีพาส)
- สร้าง hotspot เสร็จสิ้น กด OK
4.2 ทำการ disable Hotspot ที่สร้าง เพื่อให้ใช้งาน เชื่อมต่อ lan ได้ปกติไม่ต้องมี login hotspot
- หลังจาก diable แล้ว ก็จะขึ้นเป็นสีเทาๆ
5. ทดสอบ เชื่อมต่อ LAN ผ่าน Port 10
แล้วเทสสปีดตรวจสอบความเร็วที่ได้ว่ารวมให้ได้จริงไหม
จบบทความ
Back to XPERT ZONE