Sysnet Board คู่มือ การใช้งานอุปกรณ์ Network

การ Config อุปกรณ์ เครือข่าย Network Device => อุปกรณ์ Mikrotik Router => หัวข้อที่ตั้งโดย: yod เมื่อ วันที่ 13 พฤษภาคม 2011, 23:18:06

ชื่อ: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 13 พฤษภาคม 2011, 23:18:06

การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing



สวัสดีครับ หัวข้อนี้จะเป็นวิธีการทำ Load Balancing แบบ NTH ครับ

ข้อดีของ Load Balance แบบนี้คือจะแยกแต่ละ IP ของเครื่อง Client ที่ Connect เข้ามา ให้วิ่งออก Wan เส้นใดเส้นนึงโดยตรงเลยครับ เช่นเข้ามาคนแรกก็กำหนดไปเลยให้ออก Wan1 เข้ามาคนที่ 2 ก็ออก Wan 2 พอเข้ามาคนที่ 3 ก็ออก Wan1 ประมาณนี้อะครับ เพราะฉะนั้นจะไม่มีปัญหาเรื่องสลับเส้น Wan ไปมา ทำให้ฝั่ง Server ทำการ Disconnect เครื่องเราออก ซึ่งจะเกิดปัญหาบ่อยเมื่อเล่นเกมส์ Online หรือ MSN


ในตัวอย่างนี้ จะเป็นการทำ Load Balance 2 WAN ครับ ให้ลองทดสอบเล่นก่อนนะครับ โดย Backup ค่าเดิมที่ Set ไว้ก่อน

(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/nth-loadbalancing.gif)


ผมได้จำลอง RouterBoard อีกตัวให้เป็น Mode PPPoE Server ซึ่งจะเปรียบเหมือนกับ ISP ส่วน RouterBoard ที่ใช้ทดสอบ จะได้ IP จาก PPPoE Server โดย IP ที่ pppoe-out1 เป็น 192.168.88.232 และ IP ที่ pppoe-out2 เป็น 192.168.88.230 ส่วน IP ขา Lan ที่ Router Board จะเป็น 192.168.10.1

จากนั้นก็ Connect ผ่าน Lan ได้ IP: 192.168.10.2 และ Connect ผ่าน Wireless ได้ IP: 192.168.10.3


Script ด้านล่างจะให้ Interface Ether1 เป็น pppoe-out1 และ Interface Ether2 เป็น pppoe-out2 ส่วน Ether3 เป็นขา Lan ของ RouterBoard ครับ

หลักการทำงาน เมื่อมีการ Connect จากเครื่อง Client เข้ามา มันจะ Mark Connection เป็น odd หรือ even ไว้ ส่วน IP Route ด้านล่างสุด ก็จะเลือกว่า Mark ที่เป็น odd ให้ออก ppoe-out1 และ Mark ที่เป็น even ออก pppoe-out2 ที่เหลือไว้ในกรณีเส้นใดเส้นนึงหลุดครับ

แก้ไข user/password ใน pppoe-out แต่ละเส้นให้ตรงกับทาง isp ด้วยนะครับ


/interface pppoe-client
add user=sysnet1@isp password=1234 interface=ether1 disabled=no
add user=sysnet2@isp password=1234 interface=ether2 disabled=no

/ ip firewall mangle
add chain=prerouting src-address-list=odd in-interface=ether3 action=mark-connection new-connection-mark=odd passthrough=yes
add chain=prerouting src-address-list=odd in-interface=ether3 action=mark-routing new-routing-mark=odd passthrough=no
add chain=prerouting src-address-list=even in-interface=ether3 action=mark-connection new-connection-mark=even passthrough=yes
add chain=prerouting src-address-list=even in-interface=ether3 action=mark-routing new-routing-mark=even passthrough=no

add chain=prerouting in-interface=ether3 connection-state=new nth=2,1 action=mark-connection new-connection-mark=odd passthrough=yes
add chain=prerouting in-interface=ether3 action=add-src-to-address-list address-list=odd address-list-timeout=1d connection-mark=odd passthrough=yes
add chain=prerouting in-interface=ether3 connection-mark=odd action=mark-routing new-routing-mark=odd passthrough=no

add chain=prerouting in-interface=ether3 connection-state=new nth=2,2 action=mark-connection new-connection-mark=even passthrough=yes
add chain=prerouting in-interface=ether3 action=add-src-to-address-list address-list=even address-list-timeout=1d connection-mark=even passthrough=yes
add chain=prerouting in-interface=ether3 connection-mark=even action=mark-routing new-routing-mark=even passthrough=no

/ ip firewall nat
add chain=srcnat out-interface=pppoe-out1 action=masquerade
add chain=srcnat out-interface=pppoe-out2 action=masquerade

/ ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10 routing-mark=odd
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10 routing-mark=even
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10


หลังจาก add script แล้ว จะอยู่ใน Firewall --> Mangle


(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-001.gif)

IP ที่ Connect เข้ามา ทั้ง Card Wireless และ Card Lan จากเครื่อง Notebook ผม


(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-003.gif)

IP ที่ได้ของ Card Lan จะเป็น 192.168.10.2


(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-004.gif)

IP ที่ได้ของ Card Wireless จะเป็น 192.168.10.3


(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-002.gif)

IP ที่เข้ามาจะโดน mark เอาไว้ครับ 192.168.10.3 เป็น even และ 192.168.10.2 เป็น odd


ผมลองถอดสาย Lan ออก จากนั้น Trace route ไปที่ www.pantip.com (http://www.pantip.com) จะเห็นว่า Package มันออกทาง IP: 192.168.88.230 ซึ่งเป็นขา pppoe-out2 โดย connection ที่ mark ไว้เป็น even ซึ่งก็คือบังคับให้ออก pppoe-out2 ครับ (ดูจาก scrip ในส่วน /ip route)

(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-005.gif)


ทีนี้ผมลอง Disable Wirless Card  จากนั้น Trace route ไปที่
www.pantip.com (http://www.pantip.com) อีกทีจะเห็นว่าคราวนี้ Package มันวิ่งออกทาง IP: 192.168.88.232 แทน ซึ่งเป็นขา pppoe-out1 โดย connection ที่ mark ไว้เป็น odd ซึ่งก็คือบังคับให้ออก pppoe-out1 ครับ (ดูจาก scrip ในส่วน /ip route)

(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-006.gif)


จากนั้นผมลองทดสอบเผื่อกรณีที่ ISP1 ล่ม โดยการถอดสาย ที่ Wan1 (ether1) ออก ลอง trace route อีกที Package มันจะวิ่งออกIP: 192.168.88.230 ซึ่งก็คือ pppoe-out2 อีกครั้ง

(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-007.gif)


สำหรับ 3 Wan ผมยังไม่ได้ลองนะครับ  ::)





เรียบร้อยครับ ลองเล่นกันดูนะครับ ;D ;D
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: masteryon เมื่อ วันที่ 14 พฤษภาคม 2011, 18:31:55
แล้วผมต้องแก้ยังไงครับคุณยอด  ถ้าเป็นแบบ ECMP ต้องการเปลี่ยนเป็น NTH Load Balancing  และมีเน็ต 3 เส้น
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 14 พฤษภาคม 2011, 22:12:28


Backup ค่า config ไว้ก่อนครับ จากนั้นเข้า new terminal พิมพ์ /system reset-configuration แล้วตอบ y ครับ หรือ disable ตามรายการ script ที่สร้างไว้ที่หัวข้อ
การ Config Router Board ให้เป็น LoadBalance (ตัวอย่าง 3 Wan) (https://www.sysnetcenter.com/board/index.php/topic,537.0/)


3 Wan ผมยังไม่ได้ลองครับ ต้อง modify code และ test เพิ่มเติมครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: masteryon เมื่อ วันที่ 15 พฤษภาคม 2011, 11:22:47



ถ้า 3 เส้น ต้องเพิ่มสีแดงมาใช่ไหมครับ ส่วนบรรทัดสีเขียวนี้ผมไม่รู้ว่าต้องแก้ยังไงครับเพราะไม่เข้าใจความหมาย
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 15 พฤษภาคม 2011, 13:08:58
สำหรับ 3 Wan ครับ

Script ด้านล่างในกรณียังไม่ได้ตั้ง pppoe client หรือเพิ่ง reset ใหม่ๆเลย  :)

/interface pppoe-client
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether1 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out1 password=1234 profile=default \
   service-name="" use-peer-dns=yes user=sysnet1@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether2 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out2 password=1234 profile=default \
   service-name="" use-peer-dns=no user=sysnet2@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether3 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out3 password=1234 profile=default \
   service-name="" use-peer-dns=no user=sysnet3@isp

/ip address
add address=192.168.20.1/24 broadcast=192.168.20.255 comment="" disabled=no interface=ether4 network=192.168.20.0

/ip pool
add name=dhcp_pool2 ranges=192.168.20.2-192.168.20.254

/ip dhcp-server
add address-pool=dhcp_pool2 authoritative=after-2sec-delay bootp-support=static disabled=no interface=ether4 lease-time=3d name=dhcp1

/ip dhcp-server network
add address=192.168.20.0/24 comment="" dns-server=192.168.20.1 gateway=192.168.20.1



ในกรณีที่เป็นรุ่น rb450g ส่วนใหญ่จะทำ bridge กันไว้ ให้ไปลบ port ether2 และ ether3 ออกจาก bridge (เข้า menu bridge และไปที่ tab ports ให้ลบ ether2 และ 3 ออกได้เลยครับ)
แต่ถ้าเป็นรุ่น rb750 มักจะทำ ether2 เป็น master ส่วน ether3,4 และ 5 เป็น slave ของ 2 ให้เข้า menu interface และ double click ที่ ether3 เลือก master port เป็น none ส่วน ether4 และ ether5 ก็เหมือนกัน

ใส่ script ตามด้านล่างครับ



/ ip firewall mangle
add chain=prerouting src-address-list=mrk1 in-interface=ether4 action=mark-connection new-connection-mark=mrk1 passthrough=yes
add chain=prerouting src-address-list=mrk1 in-interface=ether4 action=mark-routing new-routing-mark=mrk1 passthrough=no

add chain=prerouting src-address-list=mrk2 in-interface=ether4 action=mark-connection new-connection-mark=mrk2 passthrough=yes
add chain=prerouting src-address-list=mrk2 in-interface=ether4 action=mark-routing new-routing-mark=mrk2 passthrough=no

add chain=prerouting src-address-list=mrk3 in-interface=ether4 action=mark-connection new-connection-mark=mrk3 passthrough=yes
add chain=prerouting src-address-list=mrk3 in-interface=ether4 action=mark-routing new-routing-mark=mrk3 passthrough=no

add chain=prerouting in-interface=ether4 connection-state=new nth=3,1 action=mark-connection new-connection-mark=mrk1 passthrough=yes
add chain=prerouting in-interface=ether4 action=add-src-to-address-list address-list=mrk1 address-list-timeout=1d connection-mark=mrk1 passthrough=yes
add chain=prerouting in-interface=ether4 connection-mark=mrk1 action=mark-routing new-routing-mark=mrk1 passthrough=no

add chain=prerouting in-interface=ether4 connection-state=new nth=3,2 action=mark-connection new-connection-mark=mrk2 passthrough=yes
add chain=prerouting in-interface=ether4 action=add-src-to-address-list address-list=mrk2 address-list-timeout=1d connection-mark=mrk2 passthrough=yes
add chain=prerouting in-interface=ether4 connection-mark=mrk2 action=mark-routing new-routing-mark=mrk2 passthrough=no

add chain=prerouting in-interface=ether4 connection-state=new nth=3,3 action=mark-connection new-connection-mark=mrk3 passthrough=yes
add chain=prerouting in-interface=ether4 action=add-src-to-address-list address-list=mrk3 address-list-timeout=1d connection-mark=mrk3 passthrough=yes
add chain=prerouting in-interface=ether4 connection-mark=mrk3 action=mark-routing new-routing-mark=mrk3 passthrough=no

/ ip firewall nat
add chain=srcnat out-interface=pppoe-out1 action=masquerade
add chain=srcnat out-interface=pppoe-out2 action=masquerade
add chain=srcnat out-interface=pppoe-out3 action=masquerade

/ ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10 routing-mark=mrk1
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10 routing-mark=mrk2
add dst-address=0.0.0.0/0 gateway=pppoe-out3 scope=255 target-scope=10 routing-mark=mrk3

add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out3 scope=255 target-scope=10



ผมลองทดสอบ 3wan

วิธี test เข้า Menu IP --> Firewall

รูปนี้ออก Wan 2 ครับ

(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-3wan-01.jpg)


ออก Wan 1

(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-3wan-02.jpg)


ออก Wan 3

(https://www.sysnetcenter.com/board/images/routerboard/nth-loadbalance/mikrotik-nth-loadbalance-3wan-03.jpg)


ลองทดสอบเล่นกันดูครับ ยังไม่ต้องตั้ง hotspot server ก่อนก็ดีนะครับ เพื่อความชัวร์  ;D ;D



ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: masteryon เมื่อ วันที่ 16 พฤษภาคม 2011, 12:31:15
ขอถามเพื่อความแน่ใจครับ คุณยอด
หลังจาก Reset แล้ว
ขั้นตอนที่ 1.
/interface pppoe-client add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether1 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out1 password=1234 profile=default \
   service-name="" use-peer-dns=yes user=sysnet1@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether2 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out2 password=1234 profile=default \
   service-name="" use-peer-dns=no user=sysnet2@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether3 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out3 password=1234 profile=default \
   service-name="" use-peer-dns=no user=sysnet3@isp

/ip address
add address=192.168.20.1/24 broadcast=192.168.20.255 comment="" disabled=no interface=ether4 network=192.168.20.0

/ip pool
add name=dhcp_pool2 ranges=192.168.20.2-192.168.20.254

/ip dhcp-server
add address-pool=dhcp_pool2 authoritative=after-2sec-delay bootp-support=static disabled=no interface=ether4 lease-time=3d name=dhcp1

/ip dhcp-server network
add address=192.168.20.0/24 comment="" dns-server=192.168.20.1 gateway=192.168.20.1


ขั้นตอนที่ 2.

/ ip firewall mangle
add chain=prerouting src-address-list=mrk1 in-interface=ether4 action=mark-connection new-connection-mark=mrk1 passthrough=yes
add chain=prerouting src-address-list=mrk1 in-interface=ether4 action=mark-routing new-routing-mark=mrk1 passthrough=no

add chain=prerouting src-address-list=mrk2 in-interface=ether4 action=mark-connection new-connection-mark=mrk2 passthrough=yes
add chain=prerouting src-address-list=mrk2 in-interface=ether4 action=mark-routing new-routing-mark=mrk2 passthrough=no

add chain=prerouting src-address-list=mrk3 in-interface=ether4 action=mark-connection new-connection-mark=mrk3 passthrough=yes
add chain=prerouting src-address-list=mrk3 in-interface=ether4 action=mark-routing new-routing-mark=mrk3 passthrough=no

add chain=prerouting in-interface=ether4 connection-state=new nth=3,1 action=mark-connection new-connection-mark=mrk1 passthrough=yes
add chain=prerouting in-interface=ether4 action=add-src-to-address-list address-list=mrk1 address-list-timeout=1d connection-mark=mrk1 passthrough=yes
add chain=prerouting in-interface=ether4 connection-mark=mrk1 action=mark-routing new-routing-mark=mrk1 passthrough=no

add chain=prerouting in-interface=ether4 connection-state=new nth=3,2 action=mark-connection new-connection-mark=mrk2 passthrough=yes
add chain=prerouting in-interface=ether4 action=add-src-to-address-list address-list=mrk2 address-list-timeout=1d connection-mark=mrk2 passthrough=yes
add chain=prerouting in-interface=ether4 connection-mark=mrk2 action=mark-routing new-routing-mark=mrk2 passthrough=no

add chain=prerouting in-interface=ether4 connection-state=new nth=3,3 action=mark-connection new-connection-mark=mrk3 passthrough=yes
add chain=prerouting in-interface=ether4 action=add-src-to-address-list address-list=mrk3 address-list-timeout=1d connection-mark=mrk3 passthrough=yes
add chain=prerouting in-interface=ether4 connection-mark=mrk3 action=mark-routing new-routing-mark=mrk3 passthrough=no

/ ip firewall nat
add chain=srcnat out-interface=pppoe-out1 action=masquerade
add chain=srcnat out-interface=pppoe-out2 action=masquerade
add chain=srcnat out-interface=pppoe-out3 action=masquerade

/ ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10 routing-mark=mrk1
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10 routing-mark=mrk2
add dst-address=0.0.0.0/0 gateway=pppoe-out3 scope=255 target-scope=10 routing-mark=mrk3

add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out3 scope=255 target-scope=10

เลยใช่ไหมในส่วน Mangle แยกเน็ตแยกเกมส์ต้องเพิ่ม ต้องเพิ่มสคริปส์เข้ามาใน mangle เหมือนใน การทำ ECMP Load balance อยู่หรือปล่าวครับผม
หรือว่าการทำงานในแบบนี้  
pc1 -> Wan1 pc2 -> wan2 pc3 -> Wan3
pc4 -> Wan1 pc6 -> Wan2 pc5 -> Wan3
.....
.....
ตามแต่จะคอนเน็คเข้าตามลำดับใช่ไหมครับ



ขอคำชี้แนะด้วยครับผม
ขอบคุณครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 16 พฤษภาคม 2011, 14:53:00


สวัสดีครับ

ถ้า backup ไว้แล้วอย่าไปกลัวเรื่อง reset ครับ ;D

เลยใช่ไหมในส่วน Mangle แยกเน็ตแยกเกมส์ต้องเพิ่ม ต้องเพิ่มสคริปส์เข้ามาใน mangle เหมือนใน การทำ ECMP Load balance อยู่หรือปล่าวครับผม
หรือว่าการทำงานในแบบนี้ 
pc1 -> Wan1 pc2 -> wan2 pc3 -> Wan3
pc4 -> Wan1 pc6 -> Wan2 pc5 -> Wan3

รูปแบบการทำงานจะไม่ไเหมือนกับแบบ ECMP ครับ อันนั้นมันจะสุ่มออกเอง บางทีออก wan1 เล่นๆไปมันก็ออก wan2 ได้ครับ

แต่รูปแบบในหัวข้อนี้จะ fix ไปเลยตั้งแต่มี connection เข้ามา ตามแบบ pc1 -> Wan1 pc2 -> wan2 pc3 -> Wan3 pc4 -> Wan1 pc6 -> Wan2 pc5 -> Wan3 ถูกต้อวแล้วครับ

ต้องเพิ่มในส่วน mangle และ route ตาม script ด้วยนะครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: masteryon เมื่อ วันที่ 17 พฤษภาคม 2011, 15:45:31
มีวิธี จิ้ม ปุ่ม รีเซ็ต ไหมครับ ผมรีเชตด้วย /system reset-configuration  แล้วก็ลองทำตามสคริปด้านบน
แต่ไ้ด้ GW เป็น 192.168.88.1  เลยไปแก้ไขแล้วก็เข้าไม่ได้ครับ รบกวนด้วยครับ :'( :'( :'( :'(
หรือถ้าจะรบกวนให้คุณยอดรีโมตผ่าน teamview จะรบกวนไปไหมครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 17 พฤษภาคม 2011, 15:51:55


ip default ของ router board จะเป็น 192.168.88.1 ปล่อยมันไว้ก่อนก็ได้ครับ จากนั้นเข้าไปที่ bridge ให้ลบ port ether2 และ ether3 ออก เสร็จแล้วก็ตรวจที่ dhcp ว่าชี้ interface ไปที่ bridge หรือมั้ย แค่นี้แหล่ะครับ ขั้นต้น จากนั้นก็ทำระบบ loadbalance

ถ้าแก้ไข ip แล้วเข้า winbox ไม่ได้ ลองเสียบสาย lan ที่ port อื่นดูครับ รอให้ lan status ที่เครื่องคอมมันหมุนๆจนหยุด แล้ว click ที่ mac address ใน list ของ winbox หรือไม่ก็ต้องใช้สาย serial แล้ว telnet เข้าไปแก้หมายเลข ip หรือ reset ใหม่เลย
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: masteryon เมื่อ วันที่ 17 พฤษภาคม 2011, 17:18:08
ผม รีเชตแล้ว(ผมใช้ RB450G จะทำ 3 wan)
-->new terminal
/interface pppoe-client
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether1 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out1 password=1234 profile=default \
   service-name="" use-peer-dns=yes user=sysnet1@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether2 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out2 password=1234 profile=default \
   service-name="" use-peer-dns=no user=sysnet2@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
   dial-on-demand=no disabled=no interface=ether3 max-mru=1480 \
   max-mtu=1480 mrru=disabled name=pppoe-out3 password=1234 profile=default \
   service-name="" use-peer-dns=no user=sysnet3@isp

/ip address
add address=192.168.20.1/24 broadcast=192.168.20.255 comment="" disabled=no interface=ether4 network=192.168.20.0

/ip pool
add name=dhcp_pool2 ranges=192.168.20.2-192.168.20.254

/ip dhcp-server
add address-pool=dhcp_pool2 authoritative=after-2sec-delay bootp-support=static disabled=no interface=ether4 lease-time=3d name=dhcp1

/ip dhcp-server network
add address=192.168.20.0/24 comment="" dns-server=192.168.20.1 gateway=192.168.20.1


แล้วไปที่ Bride --> Port--> แล้วลบ ether2-local และ ether3-local  มัน Disconnect ทันทีเลยครับ
ผมต่อ Lan ที่ eth5 ครับ

ไฟล์ที่แนบมา  เข้าผ่าน winbox IP 192.168.88.1 ไม่ได้แล้ว
ผมลองเข้าผ่าน macaddress ครับเลยปริ้นสกรีนมาให้ดูครับ ว่าภาพมีส่วนใดผิดไหม

ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 17 พฤษภาคม 2011, 23:29:18
ลบ DHCP Server ที่ Interface เป็น ether4 ออกเลยครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 29 พฤษภาคม 2011, 18:19:13


ในกรณีที่ใช้ 450G แล้ว set port 3,4 และ 5 เป็น Bridge ให้ใช้ Script นี้ครับ

/ ip firewall mangle
add chain=prerouting src-address-list=odd in-interface=bridge action=mark-connection new-connection-mark=odd passthrough=yes
add chain=prerouting src-address-list=odd in-interface=bridge action=mark-routing new-routing-mark=odd passthrough=no
add chain=prerouting src-address-list=even in-interface=bridge action=mark-connection new-connection-mark=even passthrough=yes
add chain=prerouting src-address-list=even in-interface=bridge action=mark-routing new-routing-mark=even passthrough=no

add chain=prerouting in-interface=bridge connection-state=new nth=2,1 action=mark-connection new-connection-mark=odd passthrough=yes
add chain=prerouting in-interface=bridge action=add-src-to-address-list address-list=odd address-list-timeout=1d connection-mark=odd passthrough=yes
add chain=prerouting in-interface=bridge connection-mark=odd action=mark-routing new-routing-mark=odd passthrough=no

add chain=prerouting in-interface=bridge connection-state=new nth=2,2 action=mark-connection new-connection-mark=even passthrough=yes
add chain=prerouting in-interface=bridge action=add-src-to-address-list address-list=even address-list-timeout=1d connection-mark=even passthrough=yes
add chain=prerouting in-interface=bridge connection-mark=even action=mark-routing new-routing-mark=even passthrough=no

/ ip firewall nat
add chain=srcnat out-interface=pppoe-out1 action=masquerade
add chain=srcnat out-interface=pppoe-out2 action=masquerade

/ ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10 routing-mark=odd
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10 routing-mark=even
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: noomza เมื่อ วันที่ 18 กรกฎาคม 2012, 03:28:10
 ทำตามคู่มือที่ให้มาในกล่องใช้งานได้ดีเลยครับที่ทางร้านเซตมาให้ แต่คราวนี้จะทำ NTH Load Balancing เส้นที่ใช้อยู่ 6m แล้วได้ 4m เพิ่มขึ้นมา
ผมทำตามในกระทู้ แล้วผมงงว่า ทำไมผมปรับเป็น 1d ไม่ได้ครับ มันเป็น 00:00:00 แบบนี้ครับ ผมต้องปรับอย่างไร แล้ว connection-state=new nth=2,1 ตรง 2,1 ใส่ค่าตรงไหนครับ ผมใส่ค่านี้ลงไปมันเป็นตัวสีแดงแจ้ง error.....
ผมเลยทำไปแบบสุ่มๆ  ;D ตรง1d ผมทำเป็น 24:00:00 แล้วตรง nth=2,1 ผมกรอกค่า nth=2 แล้วค่าอะไรสักอย่างในบรรทัดข้างล่างผมกรอกค่าเป็น 1 แล้วไปลบ bridge ที่ ether2 ออก ทำเป็น pppoe-out2 ...
ผลปรากฏว่า ใช้งานได้ ผมดึงเนทออก สลับไปๆมาๆ ใช้งานได้ดี ...
.......แต่ มันไม่เป็นอย่างที่ต้องการคือ เครื่องที่หนึ่งออก pppoe-out1 เครื่องที่สองออก pppoe-out2 เครื่องสามออกpppoe-out1 แบบนี้ครับ กลายเป็นว่าทุกเครื่องออก pppoe-out1 อย่างเดียว จนกว่าเส้นpppoe-out1 ใช้งานไม่ได้ ค่อยจะได้ใช้ pppoe-out2 ครับ  ???
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 20 กรกฎาคม 2012, 07:30:28


ต้องลบ script เดิมออกไปก่อนนะครับ เพราะถ้าใส่ script เข้าไปใหม่มันจะเป็นการเพิ่มครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: komkrish4210 เมื่อ วันที่ 11 กุมภาพันธ์ 2013, 20:46:21
RB450G ตัวนี้ใช้สคริปนี้ได้ไหมครับ ยังไม่ได้เทสครับ แต่รันไว้แล้ว จะไปลองเทสดูครับ...... ;D

/interface pppoe-client add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
    dial-on-demand=no disabled=no interface=ether1 max-mru=1480 \
    max-mtu=1480 mrru=disabled name=pppoe-out1 password=1234 profile=default \
    service-name="" use-peer-dns=yes user=sysnet1@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
    dial-on-demand=no disabled=no interface=ether2 max-mru=1480 \
    max-mtu=1480 mrru=disabled name=pppoe-out2 password=1234 profile=default \
    service-name="" use-peer-dns=no user=sysnet2@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
    dial-on-demand=no disabled=no interface=ether3 max-mru=1480 \
    max-mtu=1480 mrru=disabled name=pppoe-out3 password=1234 profile=default \
    service-name="" use-peer-dns=no user=sysnet3@isp

/ip address
add address=192.168.1.1/24 broadcast=192.168.1.255 comment="" disabled=no interface=ether5

network=192.168.1.0

/ip pool
add name=dhcp_pool1 ranges=192.168.1.2-192.168.1.254

/ip dhcp-server
add address-pool=dhcp_pool1 authoritative=after-2sec-delay bootp-support=static disabled=no

interface=ether5 lease-time=3d name=dhcp1

/ip dhcp-server network
add address=192.168.1.0/24 comment="" dns-server=192.168.1.1 gateway=192.168.1.1





/ ip firewall mangle
add chain=prerouting src-address-list=mrk1 in-interface=ether5 action=mark-connection new-connection-

mark=mrk1 passthrough=yes
add chain=prerouting src-address-list=mrk1 in-interface=ether5 action=mark-routing new-routing-mark=mrk1

passthrough=no

add chain=prerouting src-address-list=mrk2 in-interface=ether5 action=mark-connection new-connection-

mark=mrk2 passthrough=yes
add chain=prerouting src-address-list=mrk2 in-interface=ether5 action=mark-routing new-routing-mark=mrk2

passthrough=no

add chain=prerouting src-address-list=mrk3 in-interface=ether5 action=mark-connection new-connection-

mark=mrk3 passthrough=yes
add chain=prerouting src-address-list=mrk3 in-interface=ether5 action=mark-routing new-routing-mark=mrk3

passthrough=no

add chain=prerouting in-interface=ether5 connection-state=new nth=3,1 action=mark-connection new-

connection-mark=mrk1 passthrough=yes
add chain=prerouting in-interface=ether5 action=add-src-to-address-list address-list=mrk1 address-list-

timeout=1d connection-mark=mrk1 passthrough=yes
add chain=prerouting in-interface=ether5 connection-mark=mrk1 action=mark-routing new-routing-mark=mrk1

passthrough=no

add chain=prerouting in-interface=ether5 connection-state=new nth=3,2 action=mark-connection new-

connection-mark=mrk2 passthrough=yes
add chain=prerouting in-interface=ether5 action=add-src-to-address-list address-list=mrk2 address-list-

timeout=1d connection-mark=mrk2 passthrough=yes
add chain=prerouting in-interface=ether5 connection-mark=mrk2 action=mark-routing new-routing-mark=mrk2

passthrough=no

add chain=prerouting in-interface=ether5 connection-state=new nth=3,3 action=mark-connection new-

connection-mark=mrk3 passthrough=yes
add chain=prerouting in-interface=ether5 action=add-src-to-address-list address-list=mrk3 address-list-

timeout=1d connection-mark=mrk3 passthrough=yes
add chain=prerouting in-interface=ether5 connection-mark=mrk3 action=mark-routing new-routing-mark=mrk3

passthrough=no

/ ip firewall nat
add chain=srcnat out-interface=pppoe-out1 action=masquerade
add chain=srcnat out-interface=pppoe-out2 action=masquerade
add chain=srcnat out-interface=pppoe-out3 action=masquerade

/ ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10 routing-mark=mrk1
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10 routing-mark=mrk2
add dst-address=0.0.0.0/0 gateway=pppoe-out3 scope=255 target-scope=10 routing-mark=mrk3

add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10
add dst-address=0.0.0.0/0 gateway=pppoe-out3 scope=255 target-scope=10
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 11 กุมภาพันธ์ 2013, 21:42:01



ได้ครับ แต่อย่าลืมลบ interface 2 และ 3 ออกจาก bridge1 นะครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: komkrish4210 เมื่อ วันที่ 15 กุมภาพันธ์ 2013, 11:44:35
ตรง modem ที่ทำ bridge ที่ 3 wan ต้องเปลี่ยนไอพีอุปกรณ์ไหมครับ เช่น 192.168.1.1,192.168.2.1,192.168.3.1
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 15 กุมภาพันธ์ 2013, 13:35:22


ไม่ต้องครับ แต่ห้ามเปิด dhcp client ที่ตัว routerboard ที่ ether1,2 และ 3 นะครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: asawin เมื่อ วันที่ 26 กุมภาพันธ์ 2013, 22:10:32
เอาไปให้พี่เซตให้เลยได้มั้ยครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: yod เมื่อ วันที่ 27 กุมภาพันธ์ 2013, 12:22:22


ได้ครับ แต่นัดล่วงหน้านิดนึงนะครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: asawin เมื่อ วันที่ 28 กุมภาพันธ์ 2013, 19:45:07
ได้ครับ
ขอบคุณครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: Bonn121 เมื่อ วันที่ 26 ตุลาคม 2013, 00:42:19
อันนี้ wan1 wan2 สามารถทำแบบ DHCP ได้ไหมครับ
คือไม่สะดวกใช้แบบ PPPoe ทั้งสองเส้นเลย ตัวโมเด็มอยู่ไกลครับ เพราะขึ้นกริดแล้วยิงมาอีกที

หรือถ้าใช้แบบ PCC อีกกระทู้นึงมันจะมีปัญหาเรื่องการสลับ wan ไปมากับพวกเกมออนไลน์ไหมครับ

รบกวนด้วยนะครับ
ขอบคุณครับ
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: nirut456 เมื่อ วันที่ 29 กรกฎาคม 2015, 23:44:21
แล้วถ้าใช้สคิปนี้2wanอยู่แล้วเพิ่มความเร็วเร็วขึ้นมาแค่แวนเดียวปรับยังไงครับเดิม20mbสองเส้น ตอนนี้20mbกับ40mbปรับตรงไหนครับ
แวน1แบบ pppoe ความเร็ว40mb   แวน2รับมาจากเร้าเตอร์แบบdhcp 20 m  ปรับยังไงครับช่วยหน่อย
ชื่อ: Re: การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
โดย: nirut456 เมื่อ วันที่ 9 สิงหาคม 2015, 20:14:57
 รอฟังอยู่ครับ??? ??? ???

Users found this pages searching for: