2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

วิธีการติดตั้ง และปรับแต่งอุปกรณ์ Mikrotik
ให้รองรับการทำงานที่หลากหลายความต้องการ
การติดตั้ง HotSpot Server, การติดตั้ว Load Balanced ฯลฯ

2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย jadeson เมื่อ ศุกร์ 16 พ.ย. 2012 3:32 pm

รูปภาพ 2.1.1 ติดตั้ง MikroTik RB750GL แบบ 2 PPPOE to 1 LAN - Load Balanced 2 เส้น + HotSpot Server
บทความสำหรับ: ผู้ที่มีความรู้เกี่ยวกับระบบเครือข่ายในระดับเบื้องต้นถึงปานกลาง (v1.1)
โดย วิทวัส โฉมประเสริฐ, ศุภสิทธิ์ ศิริพานิชกร, เจตน์สันติ์ ยาวิลาศ

คำถาม

ต้องการทำ LoadBalance รวมเน็ตจำนวน 2 เส้น โดยเซ็ตโมเด็มเป็นแบบบริดจ์ทั้งหมด แล้วให้ MikroTik รุ่น RB750GL เป็นสั่งการเชื่อมต่อ PPPOE ต้องทำอย่างไร?

คำตอบ

สืบเนื่องมาจากคู่มือ -> 2.1 ติดตั้ง LoadBalance RB750GL แบบ 4 PPPOE to 1LAN มีหลายท่านต้องการให้ปรับ code มาเป็นแบบ 2 WAN + 1 LAN + HotSpot ดังนั้นทีมงานได้จัดทำ Script สำหรับความต้องการดังนี้นะครับ

Port1 - WAN1 (PPPoE1)
Port2 - WAN2 (PPPoE2)
Port3 - NONE (ไม่ใช้งาน)
Port4 - Loadbalance WAN1,WAN2 + Hotspot (จะไม่รวมเน็ตทั้ง 2 เส้น แต่จะเป็น link backup โดยเวลา link ไหนมีปัญหาก็จะสลับไปอีก link ที่ใช้งานได้ให้อัตโนมัติ)
port5 - Loadbalance WAN1,WAN2 (รวมเน็ตทั้ง 2 เส้น)


    การเซต Loadbalance เข้า port1,2 ออก port5


    1. ดาวน์โหลด Winbox แล้วเสียบสาย LAN ขา Ether5 ของ MikroTik
      เข้าโปรแกรม Winbox แล้วคลิกเลือก mac address MikroTik ที่ broadcast เจอ แล้วกด Connect

      รูปภาพ



    2. จะมี mac address ของขา LAN Mikrotik ที่เราเชื่อมต่ออยู่ ขึ้นมา กด Connect เพื่อเชื่อมต่อ

      รูปภาพ


    3. Winbox กำลังเชื่อมต่อเข้าไปยัง Mikrotik

      รูปภาพ


    4. ปกติแล้ว MikroTik แทบทุกรุ่นจะมี config default ให้ แต่เราจะไม่ใช่ครับ กด Remove Configuration ได้เลย

      รูปภาพ


    5. RB750GL จะทำการ Remove config default ออก แล้วจะ reboot ตัวเอง ถ้าเกิด message เด้งขึ้นมา ก็ไม่ต้องตกใจน่ะครับ

      รูปภาพ


    6. สร้าง Connection PPPOE ผ่านเมนู PPP

      รูปภาพ


    7. ที่เมนู PPP กดปุ่ม + เพื่อสร้าง PPPOE โดยเลือก PPPOE Client

      รูปภาพ


    8. สร้าง pppoe-out1 (3BB-7b)

      รูปภาพรูปภาพ


    9. สร้าง pppoe-out2 (TRUE-7b)

      รูปภาพรูปภาพ

    10. เนื่องด้วยถ้าทำในรูปแบบ Interface นั้นจะต้อง Capture หน้าจอเยอะมาก ผมจึงขอเปลี่ยนไปใช้วิธี code ผ่าน Terminal น่ะครับ
      เข้าเมนู New Terminal > Terminal

      รูปภาพ

      Script : 2 WAN(PPPoE) to 1 LAN
      โค้ด: เลือกทั้งหมด
      #|/ip address
      /ip address add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=ether5 comment="default configuration"

      #|/ip firewall mangle
      /ip firewall mangle add chain=input in-interface=pppoe-out1 action=mark-connection new-connection-mark=ether1_conn
      /ip firewall mangle add chain=input in-interface=pppoe-out2 action=mark-connection new-connection-mark=ether2_conn

      /ip firewall mangle add chain=output connection-mark=ether1_conn action=mark-routing new-routing-mark=to_ether1
      /ip firewall mangle add chain=output connection-mark=ether2_conn action=mark-routing new-routing-mark=to_ether2

      /ip firewall mangle add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=ether1_conn passthrough=yes
      /ip firewall mangle add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=ether2_conn passthrough=yes
      /ip firewall mangle add chain=prerouting connection-mark=ether1_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ether1
      /ip firewall mangle add chain=prerouting connection-mark=ether2_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ether2


      #|/ip route
      /ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_ether1 check-gateway=ping
      /ip route add dst-address=0.0.0.0/0 gateway=pppoe-out2 routing-mark=to_ether2 check-gateway=ping

      /ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=1 check-gateway=ping
      /ip route add dst-address=0.0.0.0/0 gateway=pppoe-out2 distance=2 check-gateway=ping

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

      #| DHCP server is on switch, with address pool 192.168.0.100-192.168.0.200
      /ip pool add name=default-dhcp ranges=192.168.0.100-192.168.0.200
      /ip dhcp-server add name=default address-pool=default-dhcp interface=ether5 disabled=no
      /ip dhcp-server network add address=192.168.0.0/24 gateway=192.168.0.1 dns-server=192.168.0.1 comment="default configuration"

      #| DNS
      /ip dns set allow-remote-requests=yes
      /ip dns static add name=router address=192.168.0.1

      #| Now Configure DNS server so users can resolve hostnames,
      #| Ex.cache-size=5000KiB
      #| DNS Google = 8.8.8.8,8.8.4.4
      #| DNS 3BB = 110.164.252.222,110.164.252.223
      /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000K max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4


    11. หลัง ผมแนะนำให้คัดลอกโค้ดเก็บไว้เป็น Word เพราะถ้าต้องการเปลี่ยน IP หรือเปลี่ยนค่าอื่นๆ เราสามารถใช้ฟังก์ชั่นค้นหาและแทนที่ ได้เลย

      รูปภาพ
      รูปภาพ


    12. คลิกขวา ที่แถบ command บน terminal แล้ว Paste

      รูปภาพ


    13. รูปแสดงตัวอย่างการป้อนโค้ด

      รูปภาพ


    14. หลังจากป้อนโค้ดเสร็จแล้วควรสั่ง Reboot ครั้งหนึ่ง ด้วยคำสั่งบน terminal ดังนี้ system reboot

      รูปภาพ


    15. หลัง Mikrotik reboot เสร็จ ก็ connect เชื่อมต่อใหม่อีกครั้ง (เข้าPort1=WAN1,Port2=WAN2 ออกPort5=Loadbalance)

      รูปภาพ


        การตั้งค่า LAN-HOTSPOT1 SETUP ( port4=Hotspot)


      1. เข้าเมนู IP > Hotspot

        รูปภาพ

      2. แท็ป Server ทำการคลิก Hotspot Setup
        แล้วเลือก HotSpot Interface: ether4

        รูปภาพ

        รูปภาพ

        รูปภาพ

        รูปภาพ

        รูปภาพ

        **ปกติแล้ว MikroTik จะดึงค่า DNS มาให้อัตโนมัติครับ (ตัวอย่างเป็น DNS ของ 3BB)
        รูปภาพ

        รูปภาพ

        รูปภาพ

        รูปภาพ


        การตั้งค่า LoadBalance ให้ Hotspot

      3. เข้าเมนู IP > Firewall
        แท็ป Mangle Rule
        คลิกสร้าง mangle ที่ปุ่ม " + " > (ให้ออก WAN1 ได้)

        แท็ป General
        Chain : prerouting
        Src.Address : IP ของ hotspot (ตัวอย่าง 10.5.50.1)
        In.Interface : Interface ของ hotspot (ตัวอย่างใช้ ether4)
        รูปภาพ

        แท็ป Advanced
        Per Connection Classifier : both addresses and ports 2/0
        (หมายเหตุ. ในตัวอย่างมีอยู่ 2 WAN จะใช้ 2/0 และ 2/1)
        รูปภาพ

        แท็ป Extra
        Address Type เลือกเป็น local ติ๊กถูกที่ Invert
        Hotsport เลือกเป็น auth
        รูปภาพ

        แท็ป Action
        Action : mark connection
        New Connection Mark : เลือก connection ของ wan1( ตัวอย่างใช้ ether1_conn)
        รูปภาพ

      4. คลิกสร้าง mangle ที่ปุ่ม " + " > (ให้ออก WAN2 ได้)

        แท็ป General
        Chain : prerouting
        Src.Address : IP ของ hotspot (ตัวอย่าง 10.5.50.1)
        In.Interface : Interface ของ hotspot (ตัวอย่างใช้ ether4)
        รูปภาพ

        แท็ป Advanced
        Per Connection Classifier : both addresses and ports 2/1
        (หมายเหตุ. ในตัวอย่างมีอยู่ 2 WAN จะใช้ 2/0 และ 2/1)
        รูปภาพ

        แท็ป Extra
        Address Type เลือกเป็น local ติ๊กถูกที่ Invert
        Hotsport เลือกเป็น auth
        รูปภาพ

        แท็ป Action
        Action : mark connection
        New Connection Mark : เลือก connection ของ wan2( ตัวอย่างใช้ ether2_conn)
        รูปภาพ

        แสดง mangle ที่สร้างเพิ่มขึ้นมาให้ Hotspot
        หมายเหตุ: สามารถประยุกต์ใช้กับ 3-5 WAN to 1 LAN(Hotspot) ได้เลย
        ตัวอย่าง 4 WAN จะใช้ Per Connection Classifier (4/0,4/1,4/2,4/3) แล้วก็เลือก connection (etherX_conn) เรียงลำดับกันไปให้ครบ
        รูปภาพ


เพิ่มเติม สำหรับการสร้างหลายๆ Hotspot
สำหรับ admin ท่านใดต้องการใช้แต่ละ Link เกิดประโยชน์สูงสุด ไม่อยากให้เป็นแค่ link backup ก็สามารถสร้างแยกเป็น 1 Hotspot ต่อเน็ต 1 Link ได้
ซึ่งการสร้างหลายๆ hotspot ก็ยังคงสามารถใช้ user,pass ของ profiles และ dhcp เดียวกันได้อยู่

สามารถเลือก Address Pool(dhcp) และ Profile(user,pass) ของ Hotspot ตัวเดียวกัน ใช้งานพร้อมๆกันได้
รูปภาพ
แก้ไขล่าสุดโดย jadeson เมื่อ พุธ 08 มิ.ย. 2016 3:34 pm, แก้ไขแล้ว 2 ครั้ง.
ภาพประจำตัวสมาชิก
jadeson
 
โพสต์: 619
ลงทะเบียนเมื่อ: อังคาร 03 ก.พ. 2009 4:50 pm

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย nirutsawat เมื่อ ศุกร์ 08 มี.ค. 2013 10:52 am

การตั้งค่า LoadBalance ให้ Hotspot

3.เข้าเมนู IP > Firewall
แท็ป Mangle Rule
คลิกสร้าง mangle ที่ปุ่ม " + " > (ให้ออก WAN1 ได้)

แท็ป General
Chain : prerouting
Src.Address : IP ของ hotspot (ตัวอย่าง 10.5.50.1)
In.Interface : Interface ของ hotspot (ตัวอย่างใช้ ether4)

กรณีที่ไม่ได้กำหนดในส่วนนี้ (การตั้งค่า LoadBalance ให้ Hotspot)

เน็ตจะวิ่งออก เส้นไหนครับ? และได้ความเร็วเท่าไหร่?

กรณี ppoe1=10Mb และ ppoe2=10Mb และ
กรณี ppoe1=10Mb และ ppoe2=30Mb
nirutsawat
 
โพสต์: 5
ลงทะเบียนเมื่อ: อาทิตย์ 03 มี.ค. 2013 7:50 am

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย jadeson เมื่อ ศุกร์ 08 มี.ค. 2013 11:22 am

nirutsawat เขียน:การตั้งค่า LoadBalance ให้ Hotspot

3.เข้าเมนู IP > Firewall
แท็ป Mangle Rule
คลิกสร้าง mangle ที่ปุ่ม " + " > (ให้ออก WAN1 ได้)

แท็ป General
Chain : prerouting
Src.Address : IP ของ hotspot (ตัวอย่าง 10.5.50.1)
In.Interface : Interface ของ hotspot (ตัวอย่างใช้ ether4)

กรณีที่ไม่ได้กำหนดในส่วนนี้ (การตั้งค่า LoadBalance ให้ Hotspot)

เน็ตจะวิ่งออก เส้นไหนครับ? และได้ความเร็วเท่าไหร่?

กรณี ppoe1=10Mb และ ppoe2=10Mb และ
กรณี ppoe1=10Mb และ ppoe2=30Mb


Loadbalance ถ้าทำ hotspot ตอนนี้ที่ทางผมทำได้คือจะเป็น Link backup (link ใดมีปัญหาก็สลับอีก link ทีใช้งานได้ให้อัตโนมัติ)
แต่จะไม่เป็นการรวมเน็ตให้แล้วน่ะครับ อย่าง WAN1 วิ่ง10, WAN2 วิ่ง30 มันจะไปวิ่ง WAN1 อย่างเดียว จนกว่า WAN1 ดาวน์ จึงจะสลับไป WAN2 ให้

แต่ถ้าเป็น loadbalance อย่างเดียว อันนี้รวมเน็ตให้เลย 10+30 วิ่งรวมได้ 40Mb
SYS2U.COM 24-Hour Online IT Store
ซิสทูยู เฟสบุ๊ค - http://www.facebook.com/SYS2UOnline

ภาพประจำตัวสมาชิก
jadeson
 
โพสต์: 619
ลงทะเบียนเมื่อ: อังคาร 03 ก.พ. 2009 4:50 pm

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย nirutsawat เมื่อ ศุกร์ 08 มี.ค. 2013 3:32 pm

สามารถ ทำให้ hotspot ออกเน็ต โดย ใช้ loadbalance แบบรวมเน็ต wan1=10Mb+wan2=30Mb ได้มั้ยครับ
nirutsawat
 
โพสต์: 5
ลงทะเบียนเมื่อ: อาทิตย์ 03 มี.ค. 2013 7:50 am

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย jadeson เมื่อ ศุกร์ 08 มี.ค. 2013 3:40 pm

nirutsawat เขียน:สามารถ ทำให้ hotspot ออกเน็ต โดย ใช้ loadbalance แบบรวมเน็ต wan1=10Mb+wan2=30Mb ได้มั้ยครับ


เท่าที่ทดสอบและใช้งาน ตอนนี้ ภายหลังทำ Loadbalance แล้วออก hotspot ยังได้แค่ Link backup รวมความเร็วยังไม่ได้ครับ
SYS2U.COM 24-Hour Online IT Store
ซิสทูยู เฟสบุ๊ค - http://www.facebook.com/SYS2UOnline

ภาพประจำตัวสมาชิก
jadeson
 
โพสต์: 619
ลงทะเบียนเมื่อ: อังคาร 03 ก.พ. 2009 4:50 pm

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย sakhao เมื่อ พฤหัสฯ. 08 ส.ค. 2013 2:17 pm

Admin ครับ ผมเปิดร้านเน็ตอยู่ครับ สนใจใน MikroTik มานานแล้ว (ซื้อมาแล้ว แต่ทาง Sale ไม่ได้ลงระบบมาให้ Y_Y)

จากระบบนี้
Port1 - WAN1 (PPPoE1)
Port2 - WAN2 (PPPoE2)
Port3 - NONE (ไม่ใช้งาน)
Port4 - Loadbalance WAN1,WAN2 + Hotspot (จะไม่รวมเน็ตทั้ง 2 เส้น แต่จะเป็น link backup โดยเวลา link ไหนมีปัญหาก็จะสลับไปอีก link ที่ใช้งานได้ให้อัตโนมัติ)
port5 - Loadbalance WAN1,WAN2 (รวมเน็ตทั้ง 2 เส้น)



ถ้าผมจะทำเป็น

Port1 - WAN1 (PPPoE1)
Port2 - WAN2 (PPPoE2)
Port3 - NONE (ไม่ใช้งาน)
Port4 - Loadbalance WAN1,WAN2 + Hotspot (แยกเน็ต + แยกเกมส์) /* ใช้ตอนเวลาเปิดร้าน */
port5 - Loadbalance WAN1,WAN2 (รวมเน็ตทั้ง 2 เส้น) /* ใช้รวมเน็ตเวลาปิดร้าน*/

ต้องปรับ script ยังไงได้บ้างครับ งมมาหลายวันแล้ว ไปไม่เป็นเลยย

(เน็ตทรู 10m เท่ากันทั้ง 2 เส้นครับ)
sakhao
 
โพสต์: 1
ลงทะเบียนเมื่อ: พฤหัสฯ. 08 ส.ค. 2013 1:45 pm

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย tingchittong เมื่อ พุธ 11 ก.ย. 2013 3:06 pm

Port1 - WAN1 (PPPoE1)
Port2 - WAN2 (Static)
Port3 - NONE (ไม่ใช้งาน)
Port4 - Loadbalance WAN1,WAN2 + Hotspot (จะไม่รวมเน็ตทั้ง 2 เส้น แต่จะเป็น link backup โดยเวลา link ไหนมีปัญหาก็จะสลับไปอีก link ที่ใช้งานได้ให้อัตโนมัติ)
port5 - Loadbalance WAN1,WAN2 (รวมเน็ตทั้ง 2 เส้น)


อยากได้แบบนี้แก้ไขตรงไหนบ้างครับ ขอบคุณ Sys2U ครับ
tingchittong
 
โพสต์: 14
ลงทะเบียนเมื่อ: พุธ 16 ก.พ. 2011 3:52 pm

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย jadeson เมื่อ พฤหัสฯ. 12 ก.ย. 2013 11:41 am

tingchittong เขียน:
Port1 - WAN1 (PPPoE1)
Port2 - WAN2 (Static)
Port3 - NONE (ไม่ใช้งาน)
Port4 - Loadbalance WAN1,WAN2 + Hotspot (จะไม่รวมเน็ตทั้ง 2 เส้น แต่จะเป็น link backup โดยเวลา link ไหนมีปัญหาก็จะสลับไปอีก link ที่ใช้งานได้ให้อัตโนมัติ)
port5 - Loadbalance WAN1,WAN2 (รวมเน็ตทั้ง 2 เส้น)


อยากได้แบบนี้แก้ไขตรงไหนบ้างครับ ขอบคุณ Sys2U ครับ


ให้มองแยกกันระหว่างทำ Loadbalance กับทำ hotspot น่ะครับ

ให้ทำ Loadbalance ซึ่งถ้าต้องการ 1 PPOE + 1 Static ตามตัวอย่างในบอร์ดก็มีให้อยู่แล้ว
2.0 ติดตั้ง LoadBalance RB750GL แบบ 4WAN (Static IP) to 1LAN
2.1 ติดตั้ง LoadBalance RB750GL แบบ 4 PPPOE to 1LAN
2.2 ติดตั้ง LoadBalance RB750GL 2 PPPOE+2 Static IP to 1 LAN

เราก็นำโค้ดหลายนั้นมาดัดแปลงเป็นของเราเองได้เลยครับ

นี่เป็นตัวอย่างโค้ด 1PPOE+1Static to 1 LAN
เข้า port 1,2 ออก port5

หลังทำ loadbalance เสร็จแล้วก็ค่อยทำ hotspot ตามกระทู้ต่อได้เลย

โค้ด: เลือกทั้งหมด
#|/ip address
/ip address add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=ether2
/ip address add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=ether5 comment="default configuration"

#|/ip firewall mangle
/ip firewall mangle add chain=input in-interface=pppoe-out1 action=mark-connection new-connection-mark=ether1_conn
/ip firewall mangle add chain=input in-interface=ether2 action=mark-connection new-connection-mark=ether2_conn

/ip firewall mangle add chain=output connection-mark=ether1_conn action=mark-routing new-routing-mark=to_ether1
/ip firewall mangle add chain=output connection-mark=ether2_conn action=mark-routing new-routing-mark=to_ether2

/ip firewall mangle add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses-and-ports:1/0 action=mark-connection new-connection-mark=ether1_conn passthrough=yes
/ip firewall mangle add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses-and-ports:1/1 action=mark-connection new-connection-mark=ether2_conn passthrough=yes

/ip firewall mangle add chain=prerouting connection-mark=ether1_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ether1
/ip firewall mangle add chain=prerouting connection-mark=ether2_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ether2

#|/ip route
/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_ether1 check-gateway=ping
/ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_ether2 check-gateway=ping

/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=3 check-gateway=ping
/ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping

#|/ip firewall nat
/ip firewall nat add chain=srcnat out-interface=pppoe-out1 action=masquerade
/ip firewall nat add chain=srcnat out-interface=ether2 action=masquerade

#| DHCP server is on switch, with address pool 192.168.0.100-192.168.0.200
/ip pool add name=default-dhcp ranges=192.168.0.100-192.168.0.200
/ip dhcp-server add name=default address-pool=default-dhcp interface=ether5 disabled=no
/ip dhcp-server network add address=192.168.0.0/24 gateway=192.168.0.1 dns-server=192.168.0.1 comment="default configuration"

#| DNS
/ip dns set allow-remote-requests=yes
/ip dns static add name=router address=192.168.0.1

#| Now Configure DNS server so users can resolve hostnames,
#| Ex.cache-size=5000KiB
#| DNS Google = 8.8.8.8,8.8.4.4
#| DNS 3BB = 110.164.252.222,110.164.252.223
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000K max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4
SYS2U.COM 24-Hour Online IT Store
ซิสทูยู เฟสบุ๊ค - http://www.facebook.com/SYS2UOnline

ภาพประจำตัวสมาชิก
jadeson
 
โพสต์: 619
ลงทะเบียนเมื่อ: อังคาร 03 ก.พ. 2009 4:50 pm

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย santi05 เมื่อ ศุกร์ 11 ต.ค. 2013 12:20 am

ถ้าผมต้องการระบบแบบนี้แก้ประมาณไหนบ้างครับ
ผมมีเน็ตสองเน็ตครับ เน็ตแรกทรู 50M เส้นสอง CAT20M
ต่อเข้า mikrotik port1 True DMZ port2CAT pppoe Port 4 vlan office port5vlan hotstop ช่วยแนะนำการทำ load balancing หน่อยครับผมทำไม่สำเร็จ
แนบไฟล์
Untitled.jpg
Untitled.jpg (37.39 KiB) เปิดดู 93315 ครั้ง
santi05
 
โพสต์: 1
ลงทะเบียนเมื่อ: อังคาร 11 ม.ค. 2011 9:20 pm

Re: 2.1.1 ติดตั้ง MikroTik แบบ 2 PPPOE to 1 LAN (LoadBalance+HS)

โพสต์โดย jadeson เมื่อ ศุกร์ 11 ต.ค. 2013 10:00 am

santi05 เขียน:ถ้าผมต้องการระบบแบบนี้แก้ประมาณไหนบ้างครับ
ผมมีเน็ตสองเน็ตครับ เน็ตแรกทรู 50M เส้นสอง CAT20M
ต่อเข้า mikrotik port1 True DMZ port2CAT pppoe Port 4 vlan office port5vlan hotstop ช่วยแนะนำการทำ load balancing หน่อยครับผมทำไม่สำเร็จ


นี่เป็นตัวอย่างโค้ด 1ppoe1static to loadbalance
port1 - wan1 ppoe
port2 - wan2 static
port3 - none
port4 - none
port5 - loadbalance

ลองใช้โค้ดนี้ ทำ loadbalance ออก port 5 เสร็จแล้วก็ค่อยทำ hotspot ออก port 4 อีกทีครับ
วิธีการก็ตามกระทู้ด้านบนได้เลยครับ

โค้ด: เลือกทั้งหมด
#|/ip address
/ip address add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=ether3
/ip address add address=192.168.10.40/24 network=192.168.10.0 broadcast=192.168.10.255 interface=ether5 comment="default configuration"

#|/ip firewall mangle
/ip firewall mangle add chain=input in-interface=pppoe-out1 action=mark-connection new-connection-mark=ether1_conn
/ip firewall mangle add chain=input in-interface=ether3 action=mark-connection new-connection-mark=ether3_conn

/ip firewall mangle add chain=output connection-mark=ether1_conn action=mark-routing new-routing-mark=to_ether1
/ip firewall mangle add chain=output connection-mark=ether3_conn action=mark-routing new-routing-mark=to_ether3

/ip firewall mangle add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=ether1_conn passthrough=yes
/ip firewall mangle add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=ether3_conn passthrough=yes
/ip firewall mangle add chain=prerouting connection-mark=ether1_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ether1
/ip firewall mangle add chain=prerouting connection-mark=ether3_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ether3


#|/ip route
/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_wan1 check-gateway=ping
/ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_ether3 check-gateway=ping

/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=1 check-gateway=ping
/ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=3 check-gateway=ping
#|/ip firewall nat
/ip firewall nat add chain=srcnat out-interface=pppoe-out1 action=masquerade
/ip firewall nat add chain=srcnat out-interface=ether3 action=masquerade

#| DHCP server is on switch, with address pool 192.168.10.100-192.168.10.200
/ip pool add name=default-dhcp ranges=192.168.10.100-192.168.10.200
/ip dhcp-server add name=default address-pool=default-dhcp interface=ether5 disabled=no
/ip dhcp-server network add address=192.168.10.0/24 gateway=192.168.10.40 dns-server=192.168.10.40 comment="default configuration"

#| DNS
/ip dns set allow-remote-requests=yes
/ip dns static add name=router address=192.168.10.40

#| Now Configure DNS server so users can resolve hostnames,
#| Ex.cache-size=5000KiB
#| DNS Google = 8.8.8.8,8.8.4.4
#| DNS 3BB = 110.164.252.222,110.164.252.223
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000K max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4

SYS2U.COM 24-Hour Online IT Store
ซิสทูยู เฟสบุ๊ค - http://www.facebook.com/SYS2UOnline

ภาพประจำตัวสมาชิก
jadeson
 
โพสต์: 619
ลงทะเบียนเมื่อ: อังคาร 03 ก.พ. 2009 4:50 pm

ต่อไป

ย้อนกลับไปยัง วิธีการติดตั้งและปรับแต่งอุปกรณ์ Mikrotik

ผู้ใช้งานขณะนี้

กำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และ บุคคลทั่วไป 10 ท่าน