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

การ Config อุปกรณ์ เครือข่าย Network Device => อุปกรณ์ Mikrotik Router => หัวข้อที่ตั้งโดย: yod เมื่อ วันที่ 24 สิงหาคม 2015, 19:57:26

ชื่อ: ทำ Policies Base Routing By IP Address บนอุปกรณ์ Mikrotik Router
โดย: yod เมื่อ วันที่ 24 สิงหาคม 2015, 19:57:26

ทำ Policies Base Routing By IP Address บนอุปกรณ์ Mikrotik Router


หัวข้อนี้จะเป็นการกำหนดเส้นทางให้กับ Client แต่ละเครื่อง ออก Internet เส้นที่ต้องการครับ คล้ายๆกับแยกเย็ตแยกเกมส์ แต่อันนั้นเป็นการกำหนดว่า Service ไหนจะให้ออก Internet เส้นไหน

มี 2 ส่วนนะครับ
A. กำหนดโดย Subnetwork (วง IP วิ่งออกเส้นที่ต้องการ)
B. กำหนดโดย IP Address (ให้ IP Address วิ่งออกเส้นที่ต้องการ)

การ Config ให้หัวข้อนี้ ต้องมีความรู้พื้นฐานด้าน Network และเคย config mikrotik (https://www.sysnetcenter.com/94-integrated-solutions) มาแล้วบ้าง รายละเอียดย่อยจะไม่กล่าวถึงนะครับ


A. กำหนดโดย Subnetwork (วง IP วิ่งออกเส้นที่ต้องการ)


(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-000-A.gif)


ในรูป มี Internet 2 เส้น อุปกรณ์ Mikrotik เชื่อมต่อแบบ Static IP ที่ eth1 (192.168.80.2/24) และ eth2 (192.168.90.2/24)

ส่วนขา Lan จะมี eth3: 192.168.59.1, eth4: 192.168.10.1 และ eth5: 172.16.0.1

ต้องการให้ วง Network 172.16.0.0 ออกที่ Wan1 (192.168.80.1) และ 192.168.59.0, 192.168.10.0 ออกที่ Wan 2 (192.168.90.1)

1. สร้าง Address ให้แต่ละ Interface
eth1 และ 2 เป็น Static IP เชื่อมต่อเข้ากับ Router

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-001.gif)


สร้าง Route ชี้หมายเลข Gateway ให้ Distace เป็น 1 ครับ ระยะทางจะมีผลในการเลือกเส้นทางที่ออก Internet ครับ ถ้าตั้งเป็น 2 หมายถึง ไกลขึ้นครับ จะวิ่งเส้นที่ใกล้ที่สุด

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-004.gif)

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-005.gif)


2. สร้าง DHCP Server

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-002.gif)


3. สร้าง NAT ให้แต่ละ Subnetwork

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-003.gif)



ทดสอบ

PC ต่อเข้ากับวง 172.16.0.0 ทำการ Traceroute ไปยัง Google

Mikrotik เลือกที่จะวิ่งออกทาง Wan 2 (192.168.90.1)

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-006.gif)


4. ทำการ Mark route เข้า Menu Firewall --> Mangle

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-007.gif)

Chain: prerouting
Src. Address: 172.16.0.0/24

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-008.gif)

Action: mark routing
New Routing Mask: to_wan1
UnCheck Passthrough

Click [OK]


5. Menu IP --> Route แก้ไข Gateway 192.168.80.1
Routing Mask: to_wan1

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-009.gif)

Click [OK]



ทดสอบ

PC ต่อเข้ากับวง 172.16.0.0 ทำการ Traceroute ไปยัง Google

Mikrotik เลือกออกเส้นทาง Wan 1 (192.168.80.1)

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-010.gif)


6. ทีนี้ทำการ Mark routing ทุกวง Network ครับ

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-011.gif)


7. แก้ไข Gateway 192.168.90.1
Routing Mask: to_wan2

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-012.gif)



ทดสอบ

PC ต่อเข้ากับวง 192.168.10.0 ทำการ Traceroute ไปยัง Google

Mikrotik เลือกออกเส้นทาง Wan 2 (192.168.90.1)

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-013.gif)


B. กำหนดโดย IP Address (ให้ IP Address วิ่งออกเส้นที่ต้องการ)

เหมาะกับสำนักงาน ที่ต้องการจัดการให้เครื่อง Computer แต่ละเครื่องออก Internet ตามเส้นที่ต้องการ อาจจะเป็นเรื่องของความสเถียร หรือ ความเร็วที่ได้ครับ

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-000-B.gif)


ตัวอย่าง ต้องการให้ IP 192.168.10.2 และ 192.168.10.254 ออก Internet เส้นที่ 1 และ IP: 192.168.10.3 ออก Internet เส้นที่ 2 หรือ เครื่อง Computer ที่เชื่อมต่อเข้ามา ให้ออก Internet เส้นที่ 2 ทั้งหมด

1. Menu Firewall --> Address Lists

สร้าง Address Lists
Name: Manager
Address: 192.168.10.2 และ 192.168.10.254

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-014.gif)


สร้าง Address List Staff
IP: 192.168.10.3

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-015.gif)


2. Menu IP --> Mangle

Tab General
Chain: prerouting

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-016.gif)

Tab Advanced
Src. Address List: Manager

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-017.gif)


Tab Action
Action: mark routing
New Routing Mark: to_wan1
UnChecked: Passthrough

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-018.gif)


ทำในส่วนของ Src Address List ที่เป็น Staff ด้วยครับ

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-019.gif)


3. IP --> Route

Gateway: 192.168.80.1
Routing Mark: to_wan1
Distance: 2

Gateway: 192.168.90.1
Routing Mark: to_wan2

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-020.gif)

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-021.gif)



ทดสอบ

PC ที่เชื่อมต่อเป็นหมายเลข IP:192.168.10.254 ทำการ Traceroute ไปยัง Google

Mikrotik เลือกออกเส้นทาง Wan 1 (192.168.80.1)

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-022.gif)


ทีนี้ Fix IP เป็น 192.168.10.4

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-023.gif)

Traceroute ไปยัง Google

Mikrotik เลือกออกเส้นทาง Wan 2 (192.168.90.1)

(https://www.sysnetcenter.com/board/images/mikrotik/policies-base-routing/mikrotik-policies-base-routing-by-ip-024.gif)


เรียบร้อยครับ  ;D

Users found this pages searching for: