ยินดีต้อนรับสู่ show running-config ครับ

บล็อก show running-config นี้สร้างไว้เพื่อเป็นแหล่งรวบรวมเทคนิคการตั้งค่าอุปกรณ์เครือข่าย Cisco ไม่ว่าจะเป็น Cisco IOS Router, Cisco Catalyst Swtich, Cisco ASA Firewall, Cisco Mars เป็นต้น รวมทั้งอาจจะมีเทคนิคการตั้งค่าอุปกรณ์ในยี่ห้ออื่น ๆ บ้างเล็กน้อยครับ

ซึ่งบทความในบล็อกนี้ก็จะรวบรวมมาจากประสบการณ์ส่วนตัวของกระผมเองครับ (หากมีข้อผิดพลาดก็ขออภัยไว้ล่วงหน้าเลยละกันนะครับ) และก็อยากใช้พื้นที่แห่งนี้เป็นแหล่งในการแลกเปลี่ยนความรู้ รวมไปถึงวิธีการหรือเทคนิคการตั้งค่าอุปกรณ์เครือข่าย กับทุก ๆ คนครับ

Thursday, December 1, 2016

MPLS ตอนที่ 4 การตั้งค่า MPLS สำหรับการส่งต่อ Unicast IP




ในบทความทั้ง 3 ตอนที่ผ่านมา ได้อธิบายถึงวิธีการทำงานในรูปแบบต่าง ๆ ของ MPLS กันไปแล้วนะครับ ทั้งการทำงานของ MPLS บน Data plane และการทำงานของ MPLS บน Control plane แต่ทั้ง 3 บทความที่ผ่านมา จะยังไม่ได้แสดงตัวอย่างการตั้งค่าเพื่อใช้งาน MPLS แต่อย่างใด ในบทความนี้จึงจะขอกล่าวถึง การตั้งค่า MPLS สำหรับการส่งต่อ Unicast IP forwarding กันครับ

ก่อนอื่น เผื่อบางคนยังไม่ทราบว่าแพ็คเก็ตแบบ Unicast IP คืออะไร ?นะครับ

แพ็คเก็ตแบบ Unicast IP ก็คือแพ็คเก็ตทั่วไปที่ทำการรับ-ส่งข้อมูลแบบ Unicast กัน ซึ่งก็คือทราฟิกที่ใช้งานกันอยู่ทั่วไปนั่นเอง โดยปกติแพ็คเก็ตชนิดนี้ก็จะถูกส่งต่อโดใช้ข้อมูลจาก IP header เป็นตัวตัดสินใจในการส่งต่อทราฟิกไปยังปลายทาง แต่ในการใช้งาน MPLS เพื่อทำการส่งต่อทราฟิกแบบ Unicast IP นี้จะทำการส่งต่อแพ็คเก็ตโดยดูจากข้อมูล label ใน MPLS header เป็นหลัก

อย่างที่กล่าวไปด้านบน MPLS จะใช้สิ่งที่เรียกว่า label เป็นตัวตัดสินใจในการส่งต่อทราฟิกไปยังปลายทาง ดังนั้นก่อนที่จะเข้าสู่การตั้งค่า เรามาทำความรู้จักกับค่า label กันให้มากกว่าเดิมซักนิดนะครับ โดยค่า label ที่ถูกกำหนดไว้ตาม RFC3032 นี้ จะเป็นค่าตัวเลขที่อยู่ในช่วงหมายเลข 0 ถึงหมายเลข 1,048,575 (2^20-1) โดย label ในช่วงแรก ตั้งแต่หมายเลข 0 - 15 นั้นจะถูกสำรองไว้เพื่อใช้งานในวัตถุประสงค์บางอย่าง โดย label หมายเลข 4-15 จะสำรองไว้สำหรับการใช้งานในอนาคต ส่วน label หมายเลข 0 - 3 นั้น จะมีการใช้งานดังนี้

  • label หมายเลข 0 คือ  IPv4 Explicit NULL Label จะใช้เพื่อบอกว่าให้ทำการ pop label ออกจากแพ็คเก็ต และทำการส่งต่อแพ็คเก็ตตาม IPv4 header ไปยังปลายทางต่อไป
  • label หมายเลข 1 คือ Router Alert Label คล้ายกับการใช้งาน Router Alert Option ใน IPv4 Header เพื่อบอกให้เราเตอร์ทำการตรวจสอบแพ็คเก็ตนี้อย่างใกล้ชิด
  • label หมายเลข 2 คือ IPv6 Explicit NULL Label จะใช้เพื่อบอกว่าให้ทำการ pop label ออกจากแพ็คเก็ต และทำการส่งต่อแพ็คเก็ตตาม IPv6 header ไปยังปลายทางต่อไป
  • label หมายเลข 3 คือ Implicit NULL Label จะเกิดขึ้นกับ prefix แบบ connected และ aggregate เท่านั้น ใช้ในกระบวนการ PHP (ขอกล่าวถึงในบทความต่อ ๆ ไป)

ในการตั้งค่าเพื่อใช้งาน MPLS นั้น จากบทความที่ผ่าน ๆ มา จะเห็นว่าการทำงานของ MPLS จะต้องมีฐานข้อมูลหลาย ๆ ชนิดมาทำงานร่วมกัน ไม่ว่าจะเป็น RIB, FIB, LIB, LFIB (ใครที่ยังไม่ทราบว่าแต่ละอย่างคืออะไร ขอให้ติดตามบทความ MPLS ตอนที่ 3 ทำความรู้จักกับการทำงานของ MPLS ใน Control Plane ก่อนนะครับ) จึงจะสามารถใช้งาน MPLS ในการส่งต่อแพ็คเก็ตไปยังปลายทางได้ ดังนั้นก่อนที่เราจะสามารถตั้งค่า MPLS ได้ ก่อนอื่นจะต้องทำการสร้างฐานข้อมูลชนิดอื่น ๆ ขึ้นมาก่อน ไม่ว่าจะเป็น RIB ซึ่งก็คือ routing table บนเราเตอร์ ที่จะได้รับข้อมูลเส้นทางมาจาก routing protocol ต่าง ๆ ไม่ว่าจะเป็น OSPF, EIGRP, IS-IS, BGP เป็นต้น และจะต้องมีการเปิดการทำงานของ CEF เอาไว้ด้วย เพื่อที่เราเตอร์จะได้มีการสร้างฐานข้อมูล FIB ที่จำเป็นต่อการสร้าง LFIB สำหรับการส่งต่อข้อมูลของ MPLS ได้

สำหรับตัวอย่างการตั้งค่าในวันนี้ ก็จะใช้ Topology เดิมจากบทความเรื่อง MPLS ตอนที่ 3 นะครับ โดยจะมีการเชื่อมต่อภาพภาพด้านล่างครับ


และก่อนที่จะทำการตั้งค่าเพื่อใช้งาน MPLS สำหรับการส่งต่อ Unicast IP สิ่งที่ควรจะทำก่อนก็คือ การตั้งค่า routing protocol เพื่อแลกเปลี่ยนข้อมูลเส้นทางของทั้งระบบเครือข่าย และจะต้องทำการเปิดการทำงานของ CEF เอาไว้ด้วย (สำหรับรายละเอียดเรื่อง CEF ขอให้ติดตามจากบทความ ทำความรู้จักกับ Switching Path บน Cisco IOS Router นะครับ)

ตัวอย่างการใช้งาน OSPF routing protocol (แบบง่าย ๆ โดยเปิดการทำงานของ OSPF บนทุก ๆ อินเทอร์เฟส) และการเปิดการทำงานของ CEF
!
ip cef
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!

ตัวอย่าง Routing Table (RIB) และ FIB Table บนเราเตอร์ PE1
PE1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/65] via 172.16.0.2, 00:12:12, Serial1/0
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/65] via 172.16.1.2, 00:12:12, Serial1/1
      4.0.0.0/32 is subnetted, 1 subnets
O        4.4.4.4 [110/129] via 172.16.1.2, 00:12:22, Serial1/1
                 [110/129] via 172.16.0.2, 00:12:22, Serial1/0
      10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks
O        10.1.1.0/24 [110/20] via 10.2.3.1, 00:11:42, Ethernet0/0
C        10.2.3.0/30 is directly connected, Ethernet0/0
L        10.2.3.2/32 is directly connected, Ethernet0/0
O        10.6.7.0/30 [110/138] via 172.16.1.2, 00:11:42, Serial1/1
                     [110/138] via 172.16.0.2, 00:11:42, Serial1/0
O        10.8.8.0/24 [110/148] via 172.16.1.2, 00:11:37, Serial1/1
                     [110/148] via 172.16.0.2, 00:11:37, Serial1/0
      172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks
C        172.16.0.0/30 is directly connected, Serial1/0
L        172.16.0.1/32 is directly connected, Serial1/0
C        172.16.1.0/30 is directly connected, Serial1/1
L        172.16.1.1/32 is directly connected, Serial1/1
O        172.16.2.0/30 [110/128] via 172.16.1.2, 00:12:22, Serial1/1
                       [110/128] via 172.16.0.2, 00:12:22, Serial1/0
O        172.16.3.0/30 [110/128] via 172.16.0.2, 00:12:22, Serial1/0
O        172.16.4.0/30 [110/128] via 172.16.1.2, 00:12:22, Serial1/1

PE1#show ip cef
Prefix               Next Hop             Interface
0.0.0.0/0            no route
0.0.0.0/8            drop
0.0.0.0/32           receive
1.1.1.1/32           receive              Loopback0
2.2.2.2/32           172.16.0.2           Serial1/0
3.3.3.3/32           172.16.1.2           Serial1/1
4.4.4.4/32           172.16.0.2           Serial1/0
                     172.16.1.2           Serial1/1
10.1.1.0/24          10.2.3.1             Ethernet0/0
10.2.3.0/30          attached             Ethernet0/0
10.2.3.0/32          receive              Ethernet0/0
10.2.3.1/32          attached             Ethernet0/0
10.2.3.2/32          receive              Ethernet0/0
10.2.3.3/32          receive              Ethernet0/0
10.6.7.0/30          172.16.0.2           Serial1/0
                     172.16.1.2           Serial1/1
10.8.8.0/24          172.16.0.2           Serial1/0
                     172.16.1.2           Serial1/1
127.0.0.0/8          drop
172.16.0.0/30        attached             Serial1/0
172.16.0.0/32        receive              Serial1/0
Prefix               Next Hop             Interface
172.16.0.1/32        receive              Serial1/0
172.16.0.3/32        receive              Serial1/0
172.16.1.0/30        attached             Serial1/1
172.16.1.0/32        receive              Serial1/1
172.16.1.1/32        receive              Serial1/1
172.16.1.3/32        receive              Serial1/1
172.16.2.0/30        172.16.0.2           Serial1/0
                     172.16.1.2           Serial1/1
172.16.3.0/30        172.16.0.2           Serial1/0
172.16.4.0/30        172.16.1.2           Serial1/1
224.0.0.0/4          drop
224.0.0.0/24         receive
240.0.0.0/4          drop
255.255.255.255/32   receive


การตั้งค่า MPLS สำหรับการส่งต่อ Unicast IP


โดยปกติของการส่งต่อแพ็คเก็ตของเราเตอร์ ถ้าเป็นแพ็คเก็ต IP ที่ไม่ได้มีการใช้งาน label ก็จะใช้ฐานข้อมูล FIB เป็นตัวตัดสินใจว่าจะทำการส่งต่อแพ็คเก็ตไปทางอินเทอร์เฟสและ next-hop ใด แต่ถ้าเป็นแพ็คเก็ต MPLS ที่มีการใช้งาน label ในการส่งต่อ Unicast IP ก็จะใช้ฐานข้อมูล LFIB เป็นตัวตัดสินใจในการส่งต่อแพ็คเก็ตไปยังปลายทาง ซึ่งทั้ง FIB และ LFIB นี้ จริง ๆ แล้วก็มีจุดตั้งต้นมาจากฐานข้อมูลชุดเดียวกัน ก็คือจะได้รับข้อมูลตั้งต้นก็คือ prefix, next-hop, outgoing-interface ตั้งต้นมาจากฐานข้อมูล RIB (routing table) ด้วยกันทั้งคู่ ดังนั้น เส้นทางที่จะใช้ในการส่งต่อแพ็คเก็ตนั้นก็จะเป็นเส้นทางเดียวกันเสมอ ไม่ว่าจะมีการใช้งาน MPLS หรือไม่ก็ตาม ดังนั้น จริง ๆ แล้วการใช้งาน MPLS สำหรับการส่งต่อ Unicast IP นั้น จะไม่ค่อยเห็นประโยชน์จากการใช้งานจริง ๆ มากนัก โดย MPLS ที่นิยมใช้งานและได้รับประโยชน์อย่างเห็นผลนั้นจะเป็นการนำ MPLS ไปประยุกต์ใช้งานในรูปแบบอื่น ๆ เสียมากกว่า เช่น การทำ MPLS L2/L3 VPN หรือการทำ MPLS Traffic Engineering เป็นต้น ซึ่งจะยังไม่ขอกล่าวถึงในบทความนี้นะครับ สำหรับในบทความนี้ จะเป็นเพียงตัวอย่างการตั้งค่าเพื่อใช้งาน MPLS สำหรับการส่งต่อ Unicast IP ซึ่งเป็นเพียงพื้นฐานการตั้งค่าเบื้องต้นของการใช้งาน MPLS เท่านั้นครับ

ในการตั้งค่า MPLS สำหรับ Unicast IP บนเราเตอร์ Cisco IOS นั้นจริง ๆ แล้วมีขั้นตอนที่ง่ายมาก สิ่งที่ต้องทำก็คือบอกเราเตอร์ว่าอินเทอร์เฟสใดที่ให้ทำการส่งต่อแพ็คเก็ตโดยเรียกดูข้อมูลจาก IP (IP lookup) และอินเทอร์เฟสใดที่ให้ทำการส่งต่อแพ็คเก็ตโดยเรียกดูข้อมูล label (label lookup) ซึ่งวิธีที่ใช้ในการบอกเราเตอร์ก็ไม่ได้ยุ่งยากอะไร เพียงแค่ใช้คำสั่ง "mpls ip" บนอินเทอร์เฟสที่ต้องการเปิดการทำงานของ MPLS เท่านั้น ดังนั้นในตัวอย่างการตั้งค่าในวันนี้ ก็จะทำการเปิดการทำงานของ MPLS บนอินเทอร์เฟสที่อยู่ภายใต้เครือข่าย MPLS ทั้งหมดตามภาพด้านบน หรือก็คือบนลิ้งค์ระหว่างเราเตอร์ PE และ P ทั้งหมดนั่นเองนะครับ

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ PE1
PE1(config)#interface Serial1/0
PE1(config-if)#mpls ip
PE1(config-if)#exit
PE1(config)#interface Serial1/1
PE1(config-if)#mpls ip
PE1(config-if)#exit

PE1#show mpls interfaces
Interface              IP            Tunnel   BGP Static Operational
Serial1/0              Yes (ldp)     No       No  No     Yes
Serial1/1              Yes (ldp)     No       No  No     Yes

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ PE2
PE2(config)#interface Serial1/0
PE2(config-if)#mpls ip
PE2(config-if)#exit
PE2(config)#interface Serial1/1
PE2(config-if)#mpls ip
PE2(config-if)#exit

PE2#show mpls interfaces
Interface              IP            Tunnel   BGP Static Operational
Serial1/0              Yes (ldp)     No       No  No     Yes
Serial1/1              Yes (ldp)     No       No  No     Yes

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ P1
P1(config)#interface Serial1/0
P1(config-if)#mpls ip
P1(config-if)#exit
P1(config)#interface Serial1/1
P1(config-if)#mpls ip
P1(config-if)#exit
P1(config)#interface Serial1/2
P1(config-if)#mpls ip
P1(config-if)#exit

P1#show mpls interfaces
Interface              IP            Tunnel   BGP Static Operational
Serial1/0              Yes (ldp)     No       No  No     Yes
Serial1/1              Yes (ldp)     No       No  No     Yes
Serial1/2              Yes (ldp)     No       No  No     Yes

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ P2
P2(config)#interface Serial1/0
P2(config-if)#mpls ip
P2(config-if)#exit
P2(config)#interface Serial1/1
P2(config-if)#mpls ip
P2(config-if)#exit
P2(config)#interface Serial1/2
P2(config-if)#mpls ip
P2(config-if)#exit

P2#show mpls interfaces
Interface              IP            Tunnel   BGP Static Operational
Serial1/0              Yes (ldp)     No       No  No     Yes
Serial1/1              Yes (ldp)     No       No  No     Yes
Serial1/2              Yes (ldp)     No       No  No     Yes

จากตัวอย่างด้านบน จะเห็นว่าเมื่อได้เปิดการทำงานของ MPLS บนอินเทอร์เฟสไปแล้ว โดย default เราเตอร์ Cisco IOS จะใช้งานโปรโคตอล LDP ในการแลกเปลี่ยนข้อมูล label กับเราเตอร์เพื่อนบ้านทันที เพื่อที่จะนำข้อมูลที่แลกเปลี่ยนกันนี้มาใช้ในการสร้าง LIB และ LFIB ที่ใช้สำหรับการส่งต่อแพ็คเก็ตไปยังปลายทางต่อไป (รายละเอียดอยู่ในบทความ MPLS ตอนที่ 3 ทำความรู้จักกับการทำงานของ MPLS ใน Control Plane) โดยการเปิดการทำงานของ MPLS นั้นจะเสมือนเป็นการเปิดการทำงานของ LDP ไปด้วยโดยอัตโนมัติ โดยที่ไม่ต้องกำหนดการตั้งค่า LDP แต่อย่างใด แต่เราสามารถปรับเปลี่ยนรายระเอียดการตั้งค่าของ LDP เช่น เปลี่ยน router-id, การตั้งค่า password, การกำหนด label range หรือเปลี่ยนไปใช้งานโปรโตคอลอื่น ๆ  ได้ (มีอีกโปรโตคอล เรียกว่า TDP ซึ่งไม่ค่อยได้รับความนิยมในการใช้งาน เนื่องจากเป็น Cisco proprietary)

ตัวอย่างด้านล่างเป็นการกำหนดให้ใช้งานโปรโตคอลที่ใช้ในการแลกเปลี่ยน label เป็น LDP ทำการกำหนด label range ใหม่ (โดย default label range ที่จะนำไปจัดสรรใช้งานกับแต่ละ prefix จะอยู่ในช่วง 16 - 1,048,575 แต่เพื่อให้เห็นภาพจากการทดสอบได้ง่ายขึ้นว่า label ที่เชื่อมโยงอยู่กับแต่ละ prefix นี้เป็นของเราเตอร์ตัวใด ในตัวอย่างการตั้งค่านี้จึงได้ทำการกำหนดค่า label range เริ่มต้นของเราเตอร์แต่ละตัวต่างกัน) และกำหนดอินเทอร์เฟสที่จะนำมาใช้งานเป็น router-id สำหรับการสร้าง LDP neighbor ระหว่างเราเตอร์แต่ละตัว ซึ่งจริง ๆ แล้วถ้าถามว่าการตั้งค่าในส่วนนี้ไม่ทำแล้วใช้งาน MPLS ได้หรือไม่ ก็ต้องตอบว่าสามารถใช้งาน MPLS ได้ เพียงแต่เป็นการกำหนดรายละเอียดในการใช้งานเพิ่มเติมตามความต้องการเท่านั้น

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ PE1
PE1(config)#mpls ip
PE1(config)#mpls label protocol ldp
PE1(config)#mpls label range 16 500
PE1(config)#mpls ldp router-id loopback 0

PE1#show mpls ldp neighbor
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 1.1.1.1:0
        TCP connection: 2.2.2.2.26082 - 1.1.1.1.646
        State: Oper; Msgs sent/rcvd: 27/27; Downstream
        Up time: 00:09:48
        LDP discovery sources:
          Serial1/0, Src IP addr: 172.16.0.2
        Addresses bound to peer LDP Ident:
          172.16.0.2      2.2.2.2         172.16.2.1      172.16.3.2
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 1.1.1.1:0
        TCP connection: 3.3.3.3.12491 - 1.1.1.1.646
        State: Oper; Msgs sent/rcvd: 26/26; Downstream
        Up time: 00:09:42
        LDP discovery sources:
          Serial1/1, Src IP addr: 172.16.1.2
        Addresses bound to peer LDP Ident:
          172.16.1.2      3.3.3.3         172.16.2.2      172.16.4.2

PE1#show mpls label range
Downstream Generic label region: Min/Max label: 16/500


ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ PE2
PE2(config)#mpls ip
PE2(config)#mpls label protocol ldp
PE2(config)#mpls label range 76 500
PE2(config)#mpls ldp router-id loopback 0

PE2#show mpls ldp neighbor
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 4.4.4.4:0
        TCP connection: 2.2.2.2.646 - 4.4.4.4.56977
        State: Oper; Msgs sent/rcvd: 372/371; Downstream
        Up time: 05:12:54
        LDP discovery sources:
          Serial1/0, Src IP addr: 172.16.3.2
        Addresses bound to peer LDP Ident:
          172.16.0.2      2.2.2.2         172.16.2.1      172.16.3.2
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 4.4.4.4:0
        TCP connection: 3.3.3.3.646 - 4.4.4.4.12624
        State: Oper; Msgs sent/rcvd: 372/373; Downstream
        Up time: 05:12:54
        LDP discovery sources:
          Serial1/1, Src IP addr: 172.16.4.2
        Addresses bound to peer LDP Ident:
          172.16.1.2      3.3.3.3         172.16.2.2      172.16.4.2

PE2#show mpls label range
Downstream Generic label region: Min/Max label: 76/500


ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ P1
P1(config)#mpls ip
P1(config)#mpls label protocol ldp
P1(config)#mpls label range 36 500
P1(config)#mpls ldp router-id loopback 0

P1#show mpls ldp neighbor
    Peer LDP Ident: 4.4.4.4:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 4.4.4.4.56977 - 2.2.2.2.646
        State: Oper; Msgs sent/rcvd: 372/373; Downstream
        Up time: 05:13:20
        LDP discovery sources:
          Serial1/2, Src IP addr: 172.16.3.1
        Addresses bound to peer LDP Ident:
          10.6.7.2        172.16.3.1      4.4.4.4         172.16.4.1
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 3.3.3.3.21356 - 2.2.2.2.646
        State: Oper; Msgs sent/rcvd: 374/375; Downstream
        Up time: 05:13:18
        LDP discovery sources:
          Serial1/1, Src IP addr: 172.16.2.2
        Addresses bound to peer LDP Ident:
          172.16.1.2      3.3.3.3         172.16.2.2      172.16.4.2
    Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 1.1.1.1.646 - 2.2.2.2.26082
        State: Oper; Msgs sent/rcvd: 28/28; Downstream
        Up time: 00:10:55
        LDP discovery sources:
          Serial1/0, Src IP addr: 172.16.0.1
        Addresses bound to peer LDP Ident:
          10.2.3.2        172.16.0.1      1.1.1.1         172.16.1.1

P1#show mpls label range
Downstream Generic label region: Min/Max label: 36/500


ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ P2
P2(config)#mpls ip
P2(config)#mpls label protocol ldp
P2(config)#mpls label range 56 500
P2(config)#mpls ldp router-id loopback 0

P2#show mpls ldp neighbor
    Peer LDP Ident: 4.4.4.4:0; Local LDP Ident 3.3.3.3:0
        TCP connection: 4.4.4.4.12624 - 3.3.3.3.646
        State: Oper; Msgs sent/rcvd: 374/373; Downstream
        Up time: 05:13:42
        LDP discovery sources:
          Serial1/2, Src IP addr: 172.16.4.1
        Addresses bound to peer LDP Ident:
          10.6.7.2        172.16.3.1      4.4.4.4         172.16.4.1
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 3.3.3.3:0
        TCP connection: 2.2.2.2.646 - 3.3.3.3.21356
        State: Oper; Msgs sent/rcvd: 375/374; Downstream
        Up time: 05:13:40
        LDP discovery sources:
          Serial1/1, Src IP addr: 172.16.2.1
        Addresses bound to peer LDP Ident:
          172.16.0.2      2.2.2.2         172.16.2.1      172.16.3.2
    Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 3.3.3.3:0
        TCP connection: 1.1.1.1.646 - 3.3.3.3.12491
        State: Oper; Msgs sent/rcvd: 28/28; Downstream
        Up time: 00:11:10
        LDP discovery sources:
          Serial1/0, Src IP addr: 172.16.1.1
        Addresses bound to peer LDP Ident:
          10.2.3.2        172.16.0.1      1.1.1.1         172.16.1.1

P2#show mpls label range
Downstream Generic label region: Min/Max label: 56/500


และเมื่อทำการสร้าง LDP neighbor กันตามตัวอย่างด้านบนได้แล้ว เราเตอร์ LSR แต่ละตัวก็จะทำการแลกเปลี่ยนข้อมูล prefix และ label ที่เชื่อมโยงกันอยู่ซึ่งกันและกัน เพื่อทำการสร้าง LSP ที่จะใช้ในการส่งต่อแพ็คเก็ต MPLS ไปยังปลายทางต่อไป รายละเอียดด้านล่างเป็นตัวอย่าง LIB และ LFIB ของเราเตอร์ LSR ทั้ง 4 ตัว

ตัวอย่าง LIB และ LFIB บนเราเตอร์ PE1
PE1#show mpls ldp bindings
  lib entry: 1.1.1.1/32, rev 5
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 42
        remote binding: lsr: 3.3.3.3:0, label: 62
  lib entry: 2.2.2.2/32, rev 23
        local binding:  label: 23
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 61
  lib entry: 3.3.3.3/32, rev 21
        local binding:  label: 22
        remote binding: lsr: 2.2.2.2:0, label: 41
        remote binding: lsr: 3.3.3.3:0, label: imp-null
  lib entry: 4.4.4.4/32, rev 11
        local binding:  label: 17
        remote binding: lsr: 2.2.2.2:0, label: 36
        remote binding: lsr: 3.3.3.3:0, label: 56
  lib entry: 10.1.1.0/24, rev 25
        local binding:  label: 24
        remote binding: lsr: 2.2.2.2:0, label: 44
        remote binding: lsr: 3.3.3.3:0, label: 64
  lib entry: 10.2.3.0/30, rev 3
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 40
        remote binding: lsr: 3.3.3.3:0, label: 60
  lib entry: 10.6.7.0/30, rev 19
        local binding:  label: 21
        remote binding: lsr: 2.2.2.2:0, label: 39
        remote binding: lsr: 3.3.3.3:0, label: 59
  lib entry: 10.8.8.0/24, rev 27
        local binding:  label: 25
        remote binding: lsr: 2.2.2.2:0, label: 43
        remote binding: lsr: 3.3.3.3:0, label: 63
  lib entry: 172.16.0.0/30, rev 7
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 58
  lib entry: 172.16.1.0/30, rev 9
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 38
        remote binding: lsr: 3.3.3.3:0, label: imp-null
  lib entry: 172.16.2.0/30, rev 17
        local binding:  label: 20
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: imp-null
  lib entry: 172.16.3.0/30, rev 15
        local binding:  label: 19
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 57
  lib entry: 172.16.4.0/30, rev 13
        local binding:  label: 18
        remote binding: lsr: 2.2.2.2:0, label: 37
        remote binding: lsr: 3.3.3.3:0, label: imp-null

PE1#show mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
17         36         4.4.4.4/32       0             Se1/0      point2point
           56         4.4.4.4/32       0             Se1/1      point2point
18         Pop Label  172.16.4.0/30    0             Se1/1      point2point
19         Pop Label  172.16.3.0/30    0             Se1/0      point2point
20         Pop Label  172.16.2.0/30    0             Se1/0      point2point
           Pop Label  172.16.2.0/30    0             Se1/1      point2point
21         39         10.6.7.0/30      0             Se1/0      point2point
           59         10.6.7.0/30      0             Se1/1      point2point
22         Pop Label  3.3.3.3/32       0             Se1/1      point2point
23         Pop Label  2.2.2.2/32       0             Se1/0      point2point
24         No Label   10.1.1.0/24      0             Et0/0      10.2.3.1
25         43         10.8.8.0/24      0             Se1/0      point2point
           63         10.8.8.0/24      0             Se1/1      point2point


ตัวอย่าง LIB และ LFIB บนเราเตอร์ PE2
PE2#show mpls ldp bindings
  lib entry: 1.1.1.1/32, rev 23
        local binding:  label: 83
        remote binding: lsr: 3.3.3.3:0, label: 62
        remote binding: lsr: 2.2.2.2:0, label: 42
  lib entry: 2.2.2.2/32, rev 21
        local binding:  label: 82
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 61
  lib entry: 3.3.3.3/32, rev 19
        local binding:  label: 81
        remote binding: lsr: 3.3.3.3:0, label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 41
  lib entry: 4.4.4.4/32, rev 5
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 36
        remote binding: lsr: 3.3.3.3:0, label: 56
  lib entry: 10.1.1.0/24, rev 27
        local binding:  label: 85
        remote binding: lsr: 3.3.3.3:0, label: 64
        remote binding: lsr: 2.2.2.2:0, label: 44
  lib entry: 10.2.3.0/30, rev 17
        local binding:  label: 80
        remote binding: lsr: 2.2.2.2:0, label: 40
        remote binding: lsr: 3.3.3.3:0, label: 60
  lib entry: 10.6.7.0/30, rev 3
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 39
        remote binding: lsr: 3.3.3.3:0, label: 59
  lib entry: 10.8.8.0/24, rev 25
        local binding:  label: 84
        remote binding: lsr: 3.3.3.3:0, label: 63
        remote binding: lsr: 2.2.2.2:0, label: 43
  lib entry: 172.16.0.0/30, rev 15
        local binding:  label: 79
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 58
  lib entry: 172.16.1.0/30, rev 13
        local binding:  label: 78
        remote binding: lsr: 2.2.2.2:0, label: 38
        remote binding: lsr: 3.3.3.3:0, label: imp-null
  lib entry: 172.16.2.0/30, rev 11
        local binding:  label: 77
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: imp-null
  lib entry: 172.16.3.0/30, rev 7
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 57
  lib entry: 172.16.4.0/30, rev 9
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 37
        remote binding: lsr: 3.3.3.3:0, label: imp-null

PE2#show mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
77         Pop Label  172.16.2.0/30    0             Se1/0      point2point
           Pop Label  172.16.2.0/30    0             Se1/1      point2point
78         Pop Label  172.16.1.0/30    0             Se1/1      point2point
79         Pop Label  172.16.0.0/30    0             Se1/0      point2point
80         40         10.2.3.0/30      0             Se1/0      point2point
           60         10.2.3.0/30      0             Se1/1      point2point
81         Pop Label  3.3.3.3/32       0             Se1/1      point2point
82         Pop Label  2.2.2.2/32       0             Se1/0      point2point
83         42         1.1.1.1/32       0             Se1/0      point2point
           62         1.1.1.1/32       0             Se1/1      point2point
84         No Label   10.8.8.0/24      0             Et0/0      10.6.7.1
85         44         10.1.1.0/24      0             Se1/0      point2point
           64         10.1.1.0/24      0             Se1/1      point2point


ตัวอย่าง LIB และ LFIB บนเราเตอร์ P1
P1#show mpls ldp bindings
  lib entry: 1.1.1.1/32, rev 22
        local binding:  label: 42
        remote binding: lsr: 4.4.4.4:0, label: 83
        remote binding: lsr: 3.3.3.3:0, label: 62
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 2.2.2.2/32, rev 2
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: 82
        remote binding: lsr: 3.3.3.3:0, label: 61
        remote binding: lsr: 1.1.1.1:0, label: 23
  lib entry: 3.3.3.3/32, rev 21
        local binding:  label: 41
        remote binding: lsr: 4.4.4.4:0, label: 81
        remote binding: lsr: 3.3.3.3:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: 22
  lib entry: 4.4.4.4/32, rev 10
        local binding:  label: 36
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 56
        remote binding: lsr: 1.1.1.1:0, label: 17
  lib entry: 10.1.1.0/24, rev 26
        local binding:  label: 44
        remote binding: lsr: 3.3.3.3:0, label: 64
        remote binding: lsr: 4.4.4.4:0, label: 85
        remote binding: lsr: 1.1.1.1:0, label: 24
  lib entry: 10.2.3.0/30, rev 18
        local binding:  label: 40
        remote binding: lsr: 4.4.4.4:0, label: 80
        remote binding: lsr: 3.3.3.3:0, label: 60
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 10.6.7.0/30, rev 16
        local binding:  label: 39
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 59
        remote binding: lsr: 1.1.1.1:0, label: 21
  lib entry: 10.8.8.0/24, rev 25
        local binding:  label: 43
        remote binding: lsr: 4.4.4.4:0, label: 84
        remote binding: lsr: 3.3.3.3:0, label: 63
        remote binding: lsr: 1.1.1.1:0, label: 25
  lib entry: 172.16.0.0/30, rev 4
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: 79
        remote binding: lsr: 3.3.3.3:0, label: 58
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 172.16.1.0/30, rev 14
        local binding:  label: 38
        remote binding: lsr: 4.4.4.4:0, label: 78
        remote binding: lsr: 3.3.3.3:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 172.16.2.0/30, rev 6
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: 77
        remote binding: lsr: 3.3.3.3:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: 20
  lib entry: 172.16.3.0/30, rev 8
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: 57
        remote binding: lsr: 1.1.1.1:0, label: 19
  lib entry: 172.16.4.0/30, rev 12
        local binding:  label: 37
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 3.3.3.3:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: 18

P1#show mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
36         Pop Label  4.4.4.4/32       0             Se1/2      point2point
37         Pop Label  172.16.4.0/30    0             Se1/1      point2point
           Pop Label  172.16.4.0/30    0             Se1/2      point2point
38         Pop Label  172.16.1.0/30    0             Se1/0      point2point
           Pop Label  172.16.1.0/30    0             Se1/1      point2point
39         Pop Label  10.6.7.0/30      0             Se1/2      point2point
40         Pop Label  10.2.3.0/30      0             Se1/0      point2point
41         Pop Label  3.3.3.3/32       0             Se1/1      point2point
42         Pop Label  1.1.1.1/32       0             Se1/0      point2point
43         84         10.8.8.0/24      0             Se1/2      point2point
44         24         10.1.1.0/24      0             Se1/0      point2point


ตัวอย่าง LIB และ LFIB บนเราเตอร์ P2
P2#show mpls ldp bindings
  lib entry: 1.1.1.1/32, rev 22
        local binding:  label: 62
        remote binding: lsr: 4.4.4.4:0, label: 83
        remote binding: lsr: 2.2.2.2:0, label: 42
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 2.2.2.2/32, rev 20
        local binding:  label: 61
        remote binding: lsr: 4.4.4.4:0, label: 82
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: 23
  lib entry: 3.3.3.3/32, rev 2
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: 81
        remote binding: lsr: 2.2.2.2:0, label: 41
        remote binding: lsr: 1.1.1.1:0, label: 22
  lib entry: 4.4.4.4/32, rev 10
        local binding:  label: 56
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 36
        remote binding: lsr: 1.1.1.1:0, label: 17
  lib entry: 10.1.1.0/24, rev 26
        local binding:  label: 64
        remote binding: lsr: 2.2.2.2:0, label: 44
        remote binding: lsr: 4.4.4.4:0, label: 85
        remote binding: lsr: 1.1.1.1:0, label: 24
  lib entry: 10.2.3.0/30, rev 18
        local binding:  label: 60
        remote binding: lsr: 4.4.4.4:0, label: 80
        remote binding: lsr: 2.2.2.2:0, label: 40
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 10.6.7.0/30, rev 16
        local binding:  label: 59
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 39
        remote binding: lsr: 1.1.1.1:0, label: 21
  lib entry: 10.8.8.0/24, rev 25
        local binding:  label: 63
        remote binding: lsr: 4.4.4.4:0, label: 84
        remote binding: lsr: 2.2.2.2:0, label: 43
        remote binding: lsr: 1.1.1.1:0, label: 25
  lib entry: 172.16.0.0/30, rev 14
        local binding:  label: 58
        remote binding: lsr: 4.4.4.4:0, label: 79
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 172.16.1.0/30, rev 4
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: 78
        remote binding: lsr: 2.2.2.2:0, label: 38
        remote binding: lsr: 1.1.1.1:0, label: imp-null
  lib entry: 172.16.2.0/30, rev 6
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: 77
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: 20
  lib entry: 172.16.3.0/30, rev 12
        local binding:  label: 57
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 1.1.1.1:0, label: 19
  lib entry: 172.16.4.0/30, rev 8
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 37
        remote binding: lsr: 1.1.1.1:0, label: 18

P2#show mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
56         Pop Label  4.4.4.4/32       0             Se1/2      point2point
57         Pop Label  172.16.3.0/30    0             Se1/1      point2point
           Pop Label  172.16.3.0/30    0             Se1/2      point2point
58         Pop Label  172.16.0.0/30    0             Se1/0      point2point
           Pop Label  172.16.0.0/30    0             Se1/1      point2point
59         Pop Label  10.6.7.0/30      0             Se1/2      point2point
60         Pop Label  10.2.3.0/30      0             Se1/0      point2point
61         Pop Label  2.2.2.2/32       0             Se1/1      point2point
62         Pop Label  1.1.1.1/32       0             Se1/0      point2point
63         84         10.8.8.0/24      0             Se1/2      point2point
64         24         10.1.1.0/24      0             Se1/0      point2point


เพียงเท่านี้ ก็สามารถใช้งาน MPLS ในการส่งต่อข้อมูลแบบ Unicast IP ได้แล้ว ซึ่งขั้นตอนที่จำเป็นจะต้องทำการกำหนดค่านั้นจริง ๆ แล้วมีเพียงขั้นตอนเดียวเท่านั้น ก็คือการใช้คำสั่ง "mpls ip" บนอินเทอร์เฟสที่ต้องการจะให้เราเตอร์ทำการส่งต่อข้อมูลด้วย MPLS ส่วนอื่น ๆ เป็นรายละเอียดในการตั้งค่า และการตรวจสอบการทำงานเท่านั้น

การกำหนดค่า Static Label


นอกเหนือจากการใช้งาน LDP ในการกำหนดค่า label ที่เชื่อมโยงอยู่กับแต่ละ prefix โดยอัตโนมัติแล้ว เรายังสามารถทำการกำหนดค่า label ที่เชื่อมโยงกับแต่ละ prefix ได้ด้วยตัวเอง ซึ่งอาจจะใช้งานในบางกรณีอย่างเช่น เป็น prefix พิเศษที่เราต้องการกำหนดค่า label ด้วยตัวเอง หรืออาจจะด้วยเหตุผลที่เราเตอร์เพื่อนบ้านไม่รองรับการทำงาน หรือไม่เปิดการทำงานของโปรโตคอล LDP  เอาไว้ เราก็สามารถที่จะกำหนดค่า label แบบ static label เพื่อใช้งานก็ได้ แต่การใช้งาน static label อาจจะมีข้อจำกัดบางอย่าง (คล้ายกับ static route) ก็คือ ถึงแม้ prefix ที่กำหนดค่า static label หายไปจาก routing table แล้วก็ตาม แต่ค่า static label ที่กำหนดเอาไว้ใน LFIB ก็จะยังคงใช้งานอยู่

ในการตั้งค่าเพื่อใช้งาน static label จะมีขั้นตอนดังนี้
  1. ทำการกำหนดช่วงของ label ที่จะนำมาใช้งานเป็น static label
  2. ทำการจัดสรร label ให้กับแต่ละ prefix ด้วยตนเอง บนเราเตอร์แต่ละตัวในลักษณะ hop by hop
ตัวอย่างการตั้งค่าในบทความนี้ จะกำหนดให้ใช้งาน label สำหรับ prefix 10.8.8.0/24 เป็น label หมายเลข 1100 ทั้ง local label และ outgoing label บนเราเตอร์ทุก ๆ ตัว

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ PE1
PE1(config)#mpls label range 16 500 static 1000 1200
PE1(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 input 1100
PE1(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 2.2.2.2 1100
PE1(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 3.3.3.3 1100

PE1#show mpls label range
Downstream Generic label region: Min/Max label: 16/500
Range for static labels: Min/Max label: 1000/1200

PE1#show mpls static binding
10.8.8.0/24: Incoming label: 1100
  Outgoing labels:
     2.2.2.2                 1100          3.3.3.3                 1100

PE1#show mpls forwarding-table 10.8.8.0
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
1100       1100       10.8.8.0/24      0             Se1/0      point2point
           1100       10.8.8.0/24      0             Se1/1      point2point

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ PE2
PE2(config)#mpls label range 76 500 static 1000 1200
PE2(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 input 1100
PE2(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 2.2.2.2 1100
PE2(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 3.3.3.3 1100

PE2#show mpls label range
Downstream Generic label region: Min/Max label: 76/500
Range for static labels: Min/Max label: 1000/1200

PE2#show mpls static binding
10.8.8.0/24: Incoming label: 1100
  Outgoing labels:
     2.2.2.2                 1100          3.3.3.3                 1100

PE2#show mpls forwarding-table 10.8.8.0
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
1100       No Label   10.8.8.0/24      0             Et0/0      10.6.7.1

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ P1
P1(config)#mpls label range 36 500 static 1000 1200
P1(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 input 1100
P1(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 1.1.1.1 1100
P1(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 3.3.3.3 1100
P1(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 4.4.4.4 1100

P1#show mpls label range
Downstream Generic label region: Min/Max label: 36/500
Range for static labels: Min/Max label: 1000/1200

P1#show mpls static binding
10.8.8.0/24: Incoming label: 1100
  Outgoing labels:
     4.4.4.4                 1100          3.3.3.3                 1100
     1.1.1.1                 1100

P1#show mpls forwarding-table 10.8.8.0
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
1100       1100       10.8.8.0/24      0             Se1/2      point2point

ตัวอย่างการตั้งค่าและการตรวจสอบการทำงานบนเราเตอร์ P2
P2(config)#mpls label range 56 500 static 1000 1200
P2(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 input 1100
P2(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 1.1.1.1 1100
P2(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 2.2.2.2 1100
P2(config)#mpls static binding ipv4 10.8.8.0 255.255.255.0 output 4.4.4.4 1100

P2#show mpls label range
Downstream Generic label region: Min/Max label: 56/500
Range for static labels: Min/Max label: 1000/1200

P2#show mpls static binding
10.8.8.0/24: Incoming label: 1100
  Outgoing labels:
     1.1.1.1                 1100          2.2.2.2                 1100
     4.4.4.4                 1100

P2#show mpls forwarding-table 10.8.8.0
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
1100       1100       10.8.8.0/24      0             Se1/2      point2point

เพียงเท่านี้เมื่อทำการส่งต่อแพ็คเก็ตไปยัง prefix ปลายทางอยู่ในเครือข่าย 10.8.8.0/24 ก็จะทำการกำหนด label ทั้ง local label และ outgoing label เป็น 1100 ตามที่ได้ทำการตั้งค่าเอาไว้

สำหรับตัวอย่างการตั้งค่าในวันนี้ก็หมดลงแต่เพียงเท่านี้นะครับ ในบทความนี้ก็ได้เรียนรู้เกี่ยวกับการตั้งค่าเพื่อใช้งาน MPLS ร่วมกับโปรโตคอล LDP และในกรณีที่ต้องการกำหนดค่า label ด้วยตนเอง ก็สามารถทำได้ด้วยการใช้ static label ตามตัวอย่างการตั้งค่าด้านบน ซึ่งโดยทั่วไปถ้าทำการเชื่อมต่อกับอุปกรณ์ที่รองรับการทำงานของ LDP อยู่แล้ว ก็จะไม่ค่อยนิยมใช้งาน static label เท่าไร เนื่องจากจะมีข้อเสียอย่างที่ได้กล่าวเอาไว้ (ข้อเสียที่คล้ายกับ static route คือ label นี้ยังคงอยู่ใน LFIB ถึงแม้ว่า prefix ที่เชื่อมโยงจะไม่มีอยู่ใน RIB แล้วก็ตาม)

การตั้งค่าเพื่อใช้งาน MPLS สำหรับการส่งต่อ Unicast IP ก็มีขั้นตอนเพียงไม่กี่ขั้นตอนเท่านั้น และจริง ๆ แล้วก็ไม่ค่อยได้รับความนิยมในการนำไปใช้งานจริงเท่าไร เนื่องจากถึงแม้ใช้งานหรือไม่ใช้งาน MPLS ก็จะใช้เส้นทางเดียวกันในการส่งต่อข้อมูลอยู่ดี ดังนั้นการใช้งาน MPLS แบบที่เห็นประโยชน์ได้อย่างชัดเจน จะเป็นการนำ MPLS ไปประยุกต์ใช้งานในด้านอื่น ๆ มากกว่า เช่น การใช้งาน MPLS สำหรับการทำ L2/L3 VPN หรือการทำ MPLS Traffic Engineering เป็นต้น ซึ่งจะขอกล่าวถึงในบทความต่อ ๆ ไปนะครับ

บทความเรื่อง MPLS ที่เกี่ยวข้อง
MPLS ตอนที่ 1 ทำความรู้จักกับการทำงานของ MPLS ใน Dataplane
MPLS ตอนที่ 2 การทำงานของ MPLS TTL propagation
MPLS ตอนที่ 3 ทำความรู้จักกับการทำงานของ MPLS ใน Control Plane
MPLS ตอนที่ 4 การตั้งค่า MPLS สำหรับการส่งต่อ Unicast IP

No comments:

Post a Comment