Welcome to Sysnet Board คู่มือ การใช้งานอุปกรณ์ Network. Please log in or sign up.
สมาชิกทั้งหมด
17,595
กระทู้ทั้งหมด
10,026
หัวข้อทั้งหมด
4,711

  • การ Set Load Balance บน RouterBoard แบบ NTH Load Balancing
    เริ่มโดย yod
    Read 29,343 times
0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้
yod

 

 
ลบ DHCP Server ที่ Interface เป็น ether4 ออกเลยครับ

yod


ในกรณีที่ใช้ 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

 ทำตามคู่มือที่ให้มาในกล่องใช้งานได้ดีเลยครับที่ทางร้านเซตมาให้ แต่คราวนี้จะทำ 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 ครับ  ???

yod


ต้องลบ script เดิมออกไปก่อนนะครับ เพราะถ้าใส่ script เข้าไปใหม่มันจะเป็นการเพิ่มครับ

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

yod



ได้ครับ แต่อย่าลืมลบ interface 2 และ 3 ออกจาก bridge1 นะครับ

ตรง modem ที่ทำ bridge ที่ 3 wan ต้องเปลี่ยนไอพีอุปกรณ์ไหมครับ เช่น 192.168.1.1,192.168.2.1,192.168.3.1

yod


ไม่ต้องครับ แต่ห้ามเปิด dhcp client ที่ตัว routerboard ที่ ether1,2 และ 3 นะครับ

เอาไปให้พี่เซตให้เลยได้มั้ยครับ

yod


ได้ครับ แต่นัดล่วงหน้านิดนึงนะครับ