Kỹ thuật điều khiển lưu lượng trong chuyển mạch nhãn đa giao thức ( MPLS ) : Luận văn ThS. Kỹ thuật Điện tử-Viễn thông : 2 07 00

107 25 0
Kỹ thuật điều khiển lưu lượng trong chuyển mạch nhãn đa giao thức ( MPLS ) : Luận văn ThS. Kỹ thuật Điện tử-Viễn thông : 2 07 00

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CÔNG NGHỆ Nguyễn Hoàng Chương KỸ THUẬT ĐIỀU KHIỂN LƯU LƯỢNG TRONG CHUYỂN MẠCH NHÃN ĐA GIAO THỨC (MPLS) LUẬN VĂN THẠC SĨ Hà nội – 2007 ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CƠNG NGHỆ Nguyễn Hồng Chương KỸ THUẬT ĐIỀU KHIỂN LƯU LƯỢNG TRONG CHUYỂN MẠCH NHÃN ĐA GIAO THỨC (MPLS) Ngành: Công nghệ Điện tử - Viễn thông Chuyên ngành: Kỹ thuật vô tuyến điện tử thông tin liên lạc Mã số: 2.07.00 LUẬN VĂN THẠC SĨ NGƯỜI HƯỚNG DẪN KHOA HỌC: PGS.TS Nguyễn Kim Giao Hà nội – 2007 MỤC LỤC MỤC LỤC DANH MỤC CÁC KÝ HIỆU VÀ CÁC CHỮ VIẾT TẮT DANH MỤC CÁC HÌNH VẼ, ĐỒ THỊ MỞ ĐẦU CHƢƠNG I TỔNG QUAN VỀ CÔNG NGHỆ MPLS 1.1 Lịch sử phát triển 1.1.1 Lịch sử phát triển Công nghệ MPLS 1.1.2 Một số ứng dụng Công nghệ MPLS 12 1.2 Tổng quan công nghệ MPLS 12 1.2.1 Định nghĩa 12 1.2.2 Lợi ích MPLS 13 1.2.3 Nhược điểm MPLS 13 1.2.4 Đặc điểm mạng MPLS 13 1.2.5 So sánh MPLS IP 13 1.3 Kết luận 14 CHƢƠNG II 15 CẤU TRÚC CỦA MẠNG MPLS 15 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 Định nghĩa nhãn MPLS 15 Cấu trúc khung nhãn MPLS 15 Cấu trúc tế bào nhãn MPLS 16 Mặt phẳng chuyển tiếp Mặt phẳng điều khiển 17 Thuật toán chuyển tiếp nhãn 18 Phân phối nhãn 19 Duy trì nhãn 19 Các loại nhãn đặc biệt 19 Kết luận 20 CHƢƠNG III 22 KỸ THUẬT ĐIỀU KHIỂN LƢU LƢỢNG TRONG MPLS 22 3.1 Trung kế lƣu lƣợng MPLS 22 3.1.1 Khái niệm 22 3.1.2 Các thuộc tính trung kế lưu lượng 22 3.1.3 Các hoạt động trung kế lưu lượng 22 3.2 Các toán kỹ thuật lƣu lƣợng MPLS 23 3.3 Thuộc tính tham số lƣu lƣợng 23 Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 3.3.1 Thuộc tính chọn đường 23 3.3.2 Các thuộc tính tài nguyên 25 3.3.3 Bảo vệ khôi phục đường 26 3.3.4 Các chế bảo vệ khôi phục 27 3.4 Các mơ hình khơi phục lƣu lƣợng MPLS 28 3.4.1 Mơ hình Makam 28 3.4.2 Mơ hình Haskin (Reverse Backup) 28 3.4.3 Mơ hình Hundessa 29 3.4.4 Mơ hình Shortest-Dynamic 30 3.4.5 Mơ hình Simple-Dynamic 30 3.4.6 Mơ hình Simple Static 30 3.5 Kết luận Chƣơng 31 CHƢƠNG IV 32 MƠ PHỎNG VÀ PHÂN TÍCH VỚI NS2 32 4.1 Môi trƣờng mô 32 4.1.1 J-SIM 32 4.1.2 OMNeT++ 33 4.1.3 GLASS 33 4.1.4 NS2 34 4.2 Cài đặt cấu hình phần mềm mơ 34 4.3 Các tình mơ NS2 35 4.3.1 Mô môi trường không sử dụng MPLS 35 4.3.2 Mô định tuyến bắt buộc MPLS 37 4.3.3 Mô lấn chiếm lưu lượng MPLS 41 4.3.4 Mô chuyển lưu lượng MPLS – Mơ hình Makam 46 4.3.5 Mơ chuyển lưu lượng MPLS – Mơ hình Haskin 50 4.3.6 Mô chuyển lưu lượng MPLS – Mơ hình SD 54 4.4 Kết luận Chƣơng 58 KẾT LUẬN VÀ KIẾN NGHỊ 60 TÀI LIỆU THAM KHẢO 61 PHỤ LỤC I 62 Các bước cài đặt phần mềm mô NS2 RSVP-TE 62 PHỤ LỤC II 64 Mã nguồn mô NS2 RSVP-TE 64 PHỤ LỤC III 101 Ý nghĩa câu lệnh phần mềm mô NS2 RSVP-TE 101 Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học DANH MỤC CÁC KÝ HIỆU VÀ CÁC CHỮ VIẾT TẮT ATM Asynchronous Transfer Mode Công nghệ chuyển mạch tế bào, cơng nghệ chia gói tin thành tế bào có kích thước cố định 53 byte, gồm byte cho tiêu đề 48 byte cho liệu Label Chạy giao thức MPLS mặt phẳng điều ATM –LSR ATM Switching Router khiển để thiết lập kênh ảo ATM , thực chuyển tiếp gói tin có gắn nhãn tế bào ATM Gateway Giao thức định tuyến vùng biên vùng tự trị ( AS – Autonomous System) BGP Border Protocol CoS Class of Service DLCI Data Link Circuit Định danh kênh kết nối liệu số thứ tự Identifier kênh gắn vào khung liệu mạng Frame Relay để thông báo làm định tuyến liệu ELSR Edge Label Thiết bị định tuyến thực gắn nhãn Switching Router (push) gỡ nhãn (hành động gọi POP ) biên mạng MPLS FEC Forwarding Equivalence Class FTN FEC Map IGP Interior Protocol ILM Incoming Map IP Internet Protocol Nguyễn Hoàng Chƣơng to Phân lớp dịch vụ Là khái niệm sử dụng chuyển mạch nhãn đa giao thức nhằm mô tả việc thiết lập gói có đặc tính tương đương đồng mà chuyển theo đường NHLFE Gateway Giao thức định tuyến sử dụng vùng tự trị ( AS – Autonomous System) Label Giao thức Internet mơ hình TCP/IP Luận văn tốt nghiệp cao học Là giao thức bảo mật Internet sử dụng cho giao tiếp cách xác thực mã hóa gói IP luồng liệu IPSec IP Security ISP Internet Provider IXP Internet eXchange Nhà cung cấp dịch vụ trao đổi lưu lượng Internet Provider L2 Layer Lớp – Datalink mơ hình OSI L3 Layer Lớp – Network mơ hình OSI LDP Label Distribution Giao thức phân phối nhãn Protocol LIB Label Base LSP Label Path LSC Label Controler Service Nhà cung cấp dịch vụ Internet Information Thông tin nhãn sở Switched Đường chuyển nhãn, xác định đường gói tin MPLS Switch Bộ điều khiển chuyển mạch nhãn Hop by Hop signal Xác định đường khả thi theo kiểu best LSP effort Explicit route signal Xác định đường từ nút gốc LSP Switching Thiết bị định tuyến thiết bị chuyển mạch thực thủ tục phân phối nhãn chuyển tiếp gói tin dựa thơng tin nhãn Các LSR làm việc hoạt động gần giống switch LSR Label Router MPLS MultiProtocol Label Chuyển mạch nhãn đa giao thức Switching NHLFE Next Hop Label Forwarding Entry Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học PBH Per-Hop Behavior QoS Quality of Service RFC Request Comments RSVP-TE Resource Giao thức sử dụng cho việc dự phòng tài nguyên ReSerVation mạng Protocol - Traffic Engineering SVC Switched Circuit Virtual Chuyển mạch kênh ảo SVP Switched Path Virtual Chuyển mạch đường ảo TTL Time-To-Live TIB Tag Base VC Virtual Circuit VCI Virtual Identifier VP Virtual Path VPI Virtual Identifier VPN Virtual Network Nguyễn Hoàng Chƣơng Chất lượng dịch vụ For Gồm văn phát hành IETF dùng để ghi nhớ nghiên cứu mới, sáng kiến phương pháp ứng dụng công nghệ Internet Thời gian sống gói tin Information Thơng tin thẻ sở Kênh ảo Circuit Định danh kênh ảo Đường ảo Path Định danh đường ảo Private Mạng riêng ảo Luận văn tốt nghiệp cao học DANH MỤC CÁC HÌNH VẼ, ĐỒ THỊ Hình 2.1 Nhãn MPLS Hình 2.2 Ngăn xếp Nhãn MPLS Hình 2.3 Các cơng nghệ kết hợp với MPLS Hình 2.4 Cấu trúc điều khiển MPLS Hình 2.5 Quá trình gán nhãn MPLS Hình 3.1 Mơ hình Makam Hình 3.2 Mơ hình Haskin Hình 3.3 Mơ hình Shortest Dynamic Hình 4.1 Đồ thị mơ truyền liệu qua mạng IP Hình 4.2 Mơ hình biểu diễn gói đường truyền Hình 4.3 Mô tả truyền lưu lượng mạng IP phần mềm NS2 Hình 4.4 Đồ thị kết mơ định tuyến bắt buộc MPLS Hình 4.5 Mơ hình giai đoạn truyền lưu lượng thứ R1-R3-R5-R7-R9 Hình 4.6 Mơ hình giai đoạn truyền lưu lượng thứ hai R1-R2-R4-R6-R8-R9 Hình 4.7 Mơ hình giai đoạn truyền lưu lượng thứ ba R1-R3-R4… Hình 4.8 Mơ hình giai đoạn truyền lưu lượng thứ ba R1-R3-R4-R6-R5-… Hình 4.9 Mơ hình giai đoạn truyền lưu lượng thứ ba R1-R3-R4-R6-R5-R7-R8-R9 Hình 4.10 Mơ tả định tuyến ràng buộc phần mềm NS2 Hình 4.11 Đồ thị kết mô lấn chiếm lưu lượng MPLS Hình 4.12 Mơ hình giai đoạn truyền lưu lượng thứ hai R1-R2-R6-R5-R7-R9 Hình 4.13 Mơ hình biểu diễn gói lưu lượng thứ hai Hình 4.14 Mơ hình biểu diễn lưu lượng thứ hai tiếp tục truyền R7 đầy đệm Hình 4.15 Mơ hình biểu diễn lưu lượng thứ hai giải phóng từ đệm Hình 4.16 Mơ tả hoạt động lấn chiếm mạng MPLS phần mềm NS2 Hình 4.17 Đồ thị kết mơ mơ hình Makam MPLS Hình 4.18 Mơ hình gói đứt kết nối mơ hình Makam Hình 4.19 Mơ hình chuyển hướng lưu lượng mơ hình Makam Nguyễn Hồng Chƣơng Luận văn tốt nghiệp cao học Hình 4.20 Mơ hình hồn thành việc chuyển hướng lưu lượng mơ hình Makam Hình 4.21 Mơ hình khơi phục hướng lưu lượng mơ hình Makam Hình 4.22 Mơ mơ hình Makam phần mềm NS2 Hình 4.23 Đồ thị kết mơ mơ hình Haskin MPLS Hình 4.24 Mơ hình gói đứt kết nối mơ hình Haskin Hình 4.25 Mơ hình chuyển hướng lưu lượng mơ hình Haskin Hình 4.26 Mơ hình lưu lượng sau khơi phục kết nối mơ hình Haskin Hình 4.27 Mơ mơ hình Haskin phần mềm NS2 Hình 4.28 Đồ thị kết mơ mơ hình shortest-dynamic MPLS Hình 4.29 Q trình chuyển hướng lưu lượng mơ hình shortest-dynamic Hình 4.30 Sau khơi phục kết nối mơ hình shortest-dynamic Hình 4.31 Mơ mơ hình shortest-dynamic phần mềm NS2 Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học MỞ ĐẦU Công nghệ chuyển mạch nhãn đa giao thức trở thành lựa chọn công nghệ cho việc điều phối lớp lớp mơ hình tham chiếu OSI Rất nhiều nhà cung cấp viễn thông Internet giới lựa chọn công nghệ để cung cấp tính kết hợp ưu việt cơng nghệ mạng trước Để giúp cho sinh viên học viên, người chưa có hội tiếp xúc với hệ thống mạng nhà khai thác, hiểu rõ khả áp dụng mô hình mạng chuyển mạch nhãn đa giao thức, phạm vi luận văn thạc sĩ, học viên sử dụng phần mềm mô NS2 để làm rõ khả mà công nghệ đem lại thực tế Luận văn bao gồm chương từ giới thiệu lịch sử đời MPLS, mơ hình điều khiển lưu lượng cho MPLS cuối xây dựng, mơ phân tích mơ hình điều khiển lưu lượng dùng phần mềm NS2 Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 91 VI Mô mạng MPLS sử dụng chế khôi phục SHORTEST-DYNAMIC ######################################################################## # BAI 6: KHOI PHUC DUONG THEO CO CHE SHORTEST-DYNAMIC ######################################################################## # Tao mot doi tuong mo phong set ns [new Simulator] $ns rtproto DV # Tao file de xuat ket qua cho NAM set nf [open bai6.nam w] $ns namtrace-all $nf # Tao cac file de luu du lieu cho xgraph set f1 [open unit_6_1.tr w] set f2 [open unit_6_1_seq.tr w] # So ket noi mang # # 1M 2M 1M # LSR2 -LSR4 -LSR6 -LSR8 # / / / / \ # / / / / \ # 1M / 1M / 1M / 2M / \ 2M # / / / / \ # / / / / \ # R0 -LSR1 -LSR3 -LSR5 -LSR7 LSR9 R10 # 2M 2M 2M 1M # # Khai bao nut IP (R0,R10) va nut MPLS (LSR1 > LSR9) set R0 [$ns node] foreach i "1 9" { set LSR$i [$ns mpls-node] set m LSR$i eval $$m color blue } set R10 [$ns node] set set set set set set set set set LSRmpls1 LSRmpls2 LSRmpls3 LSRmpls4 LSRmpls5 LSRmpls6 LSRmpls7 LSRmpls8 LSRmpls9 [$LSR1 [$LSR2 [$LSR3 [$LSR4 [$LSR5 [$LSR6 [$LSR7 [$LSR8 [$LSR9 get-module get-module get-module get-module get-module get-module get-module get-module get-module # Khai bao link: odes $ns duplex-link $R0 $LSR1 $ns duplex-link $LSR1 $LSR3 $ns duplex-link $LSR3 $LSR5 $ns duplex-link $LSR5 $LSR7 $ns duplex-link $LSR7 $LSR9 $ns duplex-link $LSR9 $R10 $ns duplex-link $LSR1 $LSR2 $ns duplex-link $LSR2 $LSR4 $ns duplex-link $LSR4 $LSR6 $ns duplex-link $LSR6 $LSR8 $ns duplex-link $LSR8 $LSR9 Nguyễn Hoàng Chƣơng "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] bw delay 3Mb 10ms 2Mb 30ms 2Mb 30ms 2Mb 30ms 1Mb 30ms 3Mb 10ms 1Mb 30ms 1Mb 30ms 2Mb 30ms 1Mb 30ms 2Mb 30ms queue DropTail DropTail DropTail DropTail DropTail DropTail DropTail DropTail DropTail DropTail DropTail Luận văn tốt nghiệp cao học 92 $ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail $ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail $ns duplex-link $LSR7 $LSR8 2Mb 30ms DropTail # Ve dang so mang $ns duplex-link-op $R0 $LSR1 $ns duplex-link-op $LSR1 $LSR3 $ns duplex-link-op $LSR3 $LSR5 $ns duplex-link-op $LSR5 $LSR7 $ns duplex-link-op $LSR7 $LSR9 $ns duplex-link-op $LSR9 $R10 $ns duplex-link-op $LSR1 $LSR2 $ns duplex-link-op $LSR2 $LSR4 $ns duplex-link-op $LSR4 $LSR6 $ns duplex-link-op $LSR6 $LSR8 $ns duplex-link-op $LSR8 $LSR9 $ns duplex-link-op $LSR3 $LSR4 $ns duplex-link-op $LSR5 $LSR6 $ns duplex-link-op $LSR7 $LSR8 orient orient orient orient orient orient orient orient orient orient orient orient orient orient right right right right right right 0.333 right right right 1.667 0.333 0.333 0.333 # Ghi chu #$ns duplex-link-op $R0 $LSR1 $ns duplex-link-op $LSR1 $LSR3 $ns duplex-link-op $LSR3 $LSR5 $ns duplex-link-op $LSR5 $LSR7 $ns duplex-link-op $LSR7 $LSR9 #$ns duplex-link-op $LSR9 $R10 $ns duplex-link-op $LSR1 $LSR2 $ns duplex-link-op $LSR2 $LSR4 $ns duplex-link-op $LSR4 $LSR6 $ns duplex-link-op $LSR6 $LSR8 $ns duplex-link-op $LSR8 $LSR9 $ns duplex-link-op $LSR3 $LSR4 $ns duplex-link-op $LSR5 $LSR6 $ns duplex-link-op $LSR7 $LSR8 label label label label label label label label label label label label label label 3M 2M 2M 2M 1M 3M 1M 1M 2M 1M $R0 $R10 $LSR1 $LSR9 label label label label " " " " " " " " " " " " " " " " " " " " " " " " 2M" 1M 1M 2M " " " "Source" "Destination" "Ingress " " Egress" # Cau hinh LDP agent tren tat ca cac nut MPLS $ns configure-ldp-on-all-mpls-nodes # Dat color cho cac ban tin $ns ldp-request-color $ns ldp-mapping-color $ns ldp-withdraw-color $ns ldp-release-color $ns ldp-notification-color LDP blue red magenta orange green # -# Dinh nghia cac ham su dung chuong trinh chinh # -# Tao mot procedure ghi nhan bang thong theo mot chu ki $time proc record {} { global sink1 f1 set ns [Simulator instance] # Dinh chu ki ghi nhan bang thong set time 0.1 Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 93 # Lay so luong packet nhan duoc chu ky o moi sink set bw1 [$sink1 set bytes_] set now [$ns now] puts $f1 "$now [expr $bw1/$time*8/1000000]" # Reset gia tri bytes_ cua sink $sink1 set bytes_ #Dinh thoi goi lai ham record sau chu ky $time $ns at [expr $now+$time] "record" } # -set prvseqnb -1 set seqerrnb # Thu tuc ghi lai so packet nhan duoc dung thu tu proc seq-record {size rate ftime} { global prvseqnb seqerrnb sink1 f2 set ns [Simulator instance] # Dat chu ky thoi gian chay lai thu tuc set tsize [parse-bw $size] set trate [parse-bw $rate] set time [expr double($tsize)/double($trate)/8.0] set now [$ns now] # Tim so thu tu cua packet set revseqnb [$sink1 set expected_] if {$prvseqnb > $revseqnb} { incr seqerrnb } # Ghi so thu tu cua packet vao file if {$prvseqnb != $revseqnb} { puts $f2 "$now [$sink1 set expected_]" set prvseqnb $revseqnb } # Dinh thoi goi lai ham se-qrecord if { [expr $now+$time] < $ftime } { $ns at [expr $now+$time] "seq-record $size $rate $ftime" } } # -# Ham tao mot nguon luu luong gan vao node voi sink, size goi, # burst, idle time, rate va colour cua luu luong proc attach-expoo-traffic { node sink size burst idle rate } { set ns [Simulator instance] set source [new Agent/CBR/UDP] $ns attach-agent $node $source set traffic [new Traffic/Expoo] $traffic set packet-size $size $traffic set burst-time $burst $traffic set idle-time $idle $traffic set rate $rate $source attach-traffic $traffic $ns connect $source $sink return $source Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 94 } # -# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tiep cac tac vu khac # LSP_1200 tu dong chon duong ngan nhat vong qua vi tri loi proc notify-erlsp-setup {node lspid} { global src1 LSR3 LSR5 LSR7 LSR9 set ns [Simulator instance] set msg " [string range [$ns now] 3]s: Tunnel LSP_$lspid (Ingress=LSR[$node id]) da duoc thiet lap xong !" puts $msg $ns trace-annotate $msg set module [$node get-module "MPLS"] switch $lspid { 1100 { $module bind-flow-erlsp 10 100 $lspid } 1200 { $module secondary-lsp-binding 1100 $lspid } default { puts " Error!" exit } } } proc notify-erlsp-fail {node status lspid tr} { set ns [Simulator instance] set module [$node get-module "MPLS"] if { [$node id] == && $status=="BSNodeError" } { $module set-lib-error-for-lspid $lspid set msg " [string range [$ns now] 3]s: Phat hien loi tren duong lam viec LSP_$lspid Chuyen sang duong bao ve LSP_1200 !" } if { [$node id] == && $status=="NodeRepair" } { $module set-lib-error-for-lspid $lspid -1 set msg " [string range [$ns now] 3]s: Loi da duoc khoi phuc Chuyen luu luong tro lai duong lam viec LSP_$lspid !" } puts $msg $ns trace-annotate $msg } # -# Thu tuc xuat tong so packet nhan duoc o cac sink proc recv-pkts {} { global sink1 seqerrnb set ns [Simulator instance] set msg " Luong da truyen [$sink1 set expected_] goi, mat [$sink1 set nlost_] goi, ti le mat goi la [string range [expr [$sink1 set nlost_]*100.0/[$sink1 set expected_]] 3] */*" puts $msg $ns trace-annotate $msg set msg " Tong so packet bi sai thu tu : $seqerrnb goi" puts $msg Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 95 $ns trace-annotate $msg } # -# Thu tuc dong file va the hien ket qua ket thuc mo phong proc finish {} { global ns nf f1 f2 $ns flush-trace close $nf close $f1 close $f2 exec xgraph unit_6_1.tr -M -bg white -fg black -zg black \ -geometry 800x500 -y "BW (Mbps)" -x "Time (sec)" \ -t "Bai 6: Khoi phuc duong theo co che Shortest-Dynamic" -tf "helvetica-12" & exec nam bai6.nam & exit } # -# Tao sink1 gan voi nut R10 (day la noi thu nhan traffic) set sink1 [new Agent/LossMonitor] $ns attach-agent $R10 $sink1 # Tao nguon luu luong src1 gan voi nut R0 bang cach # goi ham attach-expoo-traffic Luong co packet_size=600, rate=0.8Mbps set src1 [attach-expoo-traffic $R0 $sink1 600B 0 0.8M ] $src1 set fid_ 100 $ns color 100 green # Cai dat co che khoi phuc: SHORTEST-DYNAMIC $ns enable-reroute shortest-dynamic # set-protection-lsp {start_time: thoi diem bat dau bao ve; interval: chu ky kiem tra; lsp_id $LSRmpls5 set-protection-lsp 0.7 0.01 1100 #$LSRmpls9 enable-reroute-egress-lsr # Bat dau mo phong exec clear >@ stdout puts "\n DYNAMIC \n " BAI 6: KHOI PHUC DUONG THEO CO CHE SHORTEST- $ns at 0.0 "record" $ns at 0.0 "seq-record 600 800k 3.0" # Thiet lap LSP lam viec $ns at 0.2 "$ns trace-annotate {Bao hieu thiet lap duong lam viec: LSP_1100, ER=1_3_5_7_9 }" $ns at 0.2 "$LSRmpls1 bind-flow-erlsp 1_3_5_7_9 1100" $ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=2.5) su dung LSP_1100, ER=1_3_5_7_9 }" $ns at 0.5 "$src1 start" # Link giua LSR5 va LSR7 bi dut tu 1.0s, den 2.0s thi khoi phuc lai $ns rtmodel-at 1.0 down $LSR5 $LSR7 $ns rtmodel-at 2.0 up $LSR5 $LSR7 $ns $ns $ns $ns at 2.5 "$src1 stop" at 3.0 "recv-pkts" at 3.0 "finish" run Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 96 VII Mô mạng MPLS sử dụng chế khôi phục SIMPLE-DYNAMIC ######################################################################## # BAI 7: KHOI PHUC DUONG THEO CO CHE SIMPLE-DYNAMIC # ######################################################################## # Tao mot doi tuong mo phong set ns [new Simulator] $ns rtproto DV # Tao file de xuat ket qua cho NAM set nf [open bai7.nam w] $ns namtrace-all $nf # Tao cac file de luu du lieu cho xgraph set f1 [open unit_7_1.tr w] set f2 [open unit_7_1_seq.tr w] # So ket noi mang # # 1M 2M 1M # LSR2 -LSR4 -LSR6 -LSR8 # / / / / \ # / / / / \ # 1M / 1M / 1M / 1M / \ 2M # / / / / \ # / / / / \ # R0 -LSR1 -LSR3 -LSR5 -LSR7 LSR9 R10 # 2M 1M 2M 1M # # Khai bao nut IP (R0,R10) va nut MPLS (LSR1 > LSR9) set R0 [$ns node] foreach i "1 9" { set LSR$i [$ns mpls-node] set m LSR$i eval $$m color blue } set R10 [$ns node] set set set set set set set set set LSRmpls1 LSRmpls2 LSRmpls3 LSRmpls4 LSRmpls5 LSRmpls6 LSRmpls7 LSRmpls8 LSRmpls9 [$LSR1 [$LSR2 [$LSR3 [$LSR4 [$LSR5 [$LSR6 [$LSR7 [$LSR8 [$LSR9 get-module get-module get-module get-module get-module get-module get-module get-module get-module # Khai bao link: odes $ns duplex-link $R0 $LSR1 $ns duplex-link $LSR1 $LSR3 $ns duplex-link $LSR3 $LSR5 $ns duplex-link $LSR5 $LSR7 $ns duplex-link $LSR7 $LSR9 $ns duplex-link $LSR9 $R10 $ns duplex-link $LSR1 $LSR2 $ns duplex-link $LSR2 $LSR4 $ns duplex-link $LSR4 $LSR6 $ns duplex-link $LSR6 $LSR8 Nguyễn Hoàng Chƣơng "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] "MPLS"] bw delay 3Mb 10ms 2Mb 30ms 1Mb 30ms 2Mb 30ms 1Mb 30ms 3Mb 10ms 1Mb 30ms 1Mb 30ms 2Mb 30ms 1Mb 30ms queue DropTail DropTail DropTail DropTail DropTail DropTail DropTail DropTail DropTail DropTail Luận văn tốt nghiệp cao học 97 $ns $ns $ns $ns duplex-link duplex-link duplex-link duplex-link $LSR8 $LSR3 $LSR5 $LSR7 $LSR9 $LSR4 $LSR6 $LSR8 2Mb 1Mb 1Mb 1Mb 30ms 30ms 30ms 30ms DropTail DropTail DropTail DropTail # Ve dang so mang $ns duplex-link-op $R0 $LSR1 $ns duplex-link-op $LSR1 $LSR3 $ns duplex-link-op $LSR3 $LSR5 $ns duplex-link-op $LSR5 $LSR7 $ns duplex-link-op $LSR7 $LSR9 $ns duplex-link-op $LSR9 $R10 $ns duplex-link-op $LSR1 $LSR2 $ns duplex-link-op $LSR2 $LSR4 $ns duplex-link-op $LSR4 $LSR6 $ns duplex-link-op $LSR6 $LSR8 $ns duplex-link-op $LSR8 $LSR9 $ns duplex-link-op $LSR3 $LSR4 $ns duplex-link-op $LSR5 $LSR6 $ns duplex-link-op $LSR7 $LSR8 orient orient orient orient orient orient orient orient orient orient orient orient orient orient # Ghi chu #$ns duplex-link-op $R0 $LSR1 $ns duplex-link-op $LSR1 $LSR3 $ns duplex-link-op $LSR3 $LSR5 $ns duplex-link-op $LSR5 $LSR7 $ns duplex-link-op $LSR7 $LSR9 #$ns duplex-link-op $LSR9 $R10 $ns duplex-link-op $LSR1 $LSR2 $ns duplex-link-op $LSR2 $LSR4 $ns duplex-link-op $LSR4 $LSR6 $ns duplex-link-op $LSR6 $LSR8 $ns duplex-link-op $LSR8 $LSR9 $ns duplex-link-op $LSR3 $LSR4 $ns duplex-link-op $LSR5 $LSR6 $ns duplex-link-op $LSR7 $LSR8 label label label label label label label label label label label label label label $R0 $R10 $LSR1 $LSR9 label label label label right right right right right right 0.333 right right right 1.667 0.333 0.333 0.333 " " " " " " " " " " " " " " 3M 2M 1M 2M 1M 3M 1M 1M 2M 1M 1M 1M 1M " " " " " " " " " " 2M" " " " "Source" "Destination" "Ingress " " Egress" # Cau hinh LDP agent tren tat ca cac nut MPLS $ns configure-ldp-on-all-mpls-nodes # Dat color cho cac ban tin $ns ldp-request-color $ns ldp-mapping-color $ns ldp-withdraw-color $ns ldp-release-color $ns ldp-notification-color LDP blue red magenta orange green # -# Dinh nghia cac ham su dung chuong trinh chinh # -# Tao mot procedure ghi nhan bang thong theo mot chu ki $time proc record {} { global sink1 f1 set ns [Simulator instance] # Dinh chu ki ghi nhan bang thong set time 0.1 Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 98 # Lay so luong packet nhan duoc chu ky o moi sink set bw1 [$sink1 set bytes_] set now [$ns now] puts $f1 "$now [expr $bw1/$time*8/1000000]" # Reset gia tri bytes_ cua sink $sink1 set bytes_ #Dinh thoi goi lai ham record sau chu ky $time $ns at [expr $now+$time] "record" } # -set prvseqnb -1 set seqerrnb # Thu tuc ghi lai so packet nhan duoc dung thu tu proc seq-record {size rate ftime} { global prvseqnb seqerrnb sink1 f2 set ns [Simulator instance] # Dat chu ky thoi gian chay lai thu tuc set tsize [parse-bw $size] set trate [parse-bw $rate] set time [expr double($tsize)/double($trate)/8.0] set now [$ns now] # Tim so thu tu cua packet set revseqnb [$sink1 set expected_] if {$prvseqnb > $revseqnb} { incr seqerrnb } # Ghi so thu tu cua packet vao file if {$prvseqnb != $revseqnb} { puts $f2 "$now [$sink1 set expected_]" set prvseqnb $revseqnb } # Dinh thoi goi lai ham se-qrecord if { [expr $now+$time] < $ftime } { $ns at [expr $now+$time] "seq-record $size $rate $ftime" } } # -# Ham tao mot nguon luu luong gan vao node voi sink, size goi, # burst, idle time, rate va colour cua luu luong proc attach-expoo-traffic { node sink size burst idle rate } { set ns [Simulator instance] set source [new Agent/CBR/UDP] $ns attach-agent $node $source set traffic [new Traffic/Expoo] $traffic set packet-size $size $traffic set burst-time $burst $traffic set idle-time $idle $traffic set rate $rate $source attach-traffic $traffic $ns connect $source $sink return $source Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 99 } # -# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tiep cac tac vu khac # LSP_9999 tu dong chon duong vong den egress proc notify-erlsp-setup {node lspid} { global src1 LSR3 LSR5 LSR7 set ns [Simulator instance] set module [$node get-module "MPLS"] switch $lspid { 9999 { # LSP_9999 tu dong chon duong vong den egress set msg " [string range [$ns now] 3]s: Tunnel LSP_$lspid (Ingress=LSR[$node id]) tu dong chon duong ngan nhat den Egress !" puts $msg $ns trace-annotate $msg } default { puts " Error!" exit } } } # -# Thu tuc xuat tong so packet nhan duoc o cac sink proc recv-pkts {} { global sink1 seqerrnb set ns [Simulator instance] set msg " Luong da truyen [$sink1 set expected_] goi, mat [$sink1 set nlost_] goi, ti le mat goi la [string range [expr [$sink1 set nlost_]*100.0/[$sink1 set expected_]] 3] */*" puts $msg $ns trace-annotate $msg set msg " Tong so packet bi sai thu tu : $seqerrnb goi" puts $msg $ns trace-annotate $msg } # -# Thu tuc dong file va the hien ket qua ket thuc mo phong proc finish {} { global ns nf f1 f2 $ns flush-trace close $nf close $f1 close $f2 exec xgraph unit_7_1.tr -M -bg white -fg black -zg black \ -geometry 550x300 -y "BW (Mbps)" -x "Time (sec)" \ -t "Bai 7: Khoi phuc duong theo co che Simple-Dynamic" -tf "helvetica-12" & # exec xgraph luong_seq.tr -p -nl -nb -bg white -fg black -zg black \ # -geometry 500x250 -y "Packet No." -x "Time (sec)" \ # -t "Bai 7: Bieu so thu tu packet theo thoi gian" -tf "helvetica-12" & exec nam bai7.nam & exit } # Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 100 # Tao sink1 gan voi nut R10 (day la noi thu nhan traffic) set sink1 [new Agent/LossMonitor] $ns attach-agent $R10 $sink1 # Tao nguon luu luong src1 gan voi nut R0 bang cach # goi ham attach-expoo-traffic Luong co packet_size=600, rate=0.8Mbps set src1 [attach-expoo-traffic $R0 $sink1 600B 0 0.8M ] $src1 set fid_ 100 $ns color 100 red # Cai dat co che khoi phuc: SIMPLE-DYNAMIC $ns enable-reroute simple-dynamic # Cau hinh tham so: #$self class proc stime $LSRmpls5 set-protection-flow 0.1 #$LSRmpls1 enable-data-driven #$LSRmpls9 enable-reroute-egress-lsr # Bat dau mo phong exec clear >@ stdout puts "\n DYNAMIC \n " interval 0.01 fec phb" -1 BAI 7: KHOI PHUC DUONG THEO CO CHE SIMPLE- $ns at 0.0 "record" $ns at 0.0 "seq-record 600 800k 3.0" $ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=2.5) su dung LSP_1100, ER=1_3_5_7_9 }" $ns at 0.5 "$src1 start" # Link giua LSR5 va LSR7 bi dut tu 1.0s, den 2.0s thi khoi phuc lai $ns rtmodel-at 1.0 down $LSR5 $LSR7 $ns rtmodel-at 2.0 up $LSR5 $LSR7 $ns at 2.5 "$src1 stop" $ns at 3.0 "recv-pkts" $ns at 3.0 "finish" $ns run Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 101 PHỤ LỤC III Ý nghĩa câu lệnh phần mềm mô NS2 RSVP-TE $lsrJ get-module “MPLS” – this command is used to attach the MPLS module with node lsrJ $lsrJ aggregate-flows I K – this command is to aggregate flows It aggregates flow to node I from node J till node K $lsrJ send-ldp-withdraw-msg I – this command is used to withdraw the label that was distributed by node J to node I $lsrJ send-crldp-release-msg lspid – this command is used to release all labels associated with the erlsp, which has an id lspid $lsrJ setup-crlsp fec er lspid Bandwidth BufferSize PacketSize SetupPriority HoldingPriority – this command is used to setup a constrainedlsp (crlsp) from node to node through the erlsp 1_2_3 It attaches an id (lspid) along with this crlsp The setup path has a bandwidth, buffer size, packet size, setup priority and holding priority associated with that $ns configure-ldp-on-all-mpls-nodes – Configure LDP agents on all the created MPLS nodes $lsrJ enable-control-driven – Let $lsrJ operate as control-driven trigger $lsrJ enable-data-driven – Let $lsrJ operate as data-driven trigger $lsrJ enable-on-demand – Let $lsrJ operate as on-demand-mode 10 $lsrJ enable-ordered-control – Let $lsrJ operate as ordered-control-mode 11 $ns enable-control-driven – Let all the created MPLS nodes operate as controldriven trigger 12 $ns enable-data-driven – Let all the created MPLS nodes operate as datadriven trigger 13 $ns enable-on-demand – Let all the created MPLS nodes operate as ondemandmode 14 $ns enable-ordered-control – Let all the created MPLS nodes operate as ordered control- mode APIs for ER-LSP $lsrJ setup-erlsp I J_P_A_T_H_I lspid – this command is used to setup an explicit route from node J to node I through nodes P,A,T,H and binds an id (lspid) with this erlsp (explicit routed label switched path) $lsrJ bind-flow-erlsp I priority lspid – this command is used to bind a flow which is bound to node I with already established erlsp which has an id lspid APIs for CR-LSP and CR-LDP $ns cfg-cbq-for-SBTS $qlim $cbq_qtype $okborrow $bw $maxidle $extradelay -Configure CBQ on all MPLS nodes so as to support Simple Besteffort Traffic Service Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 102 Configuration Parameters $qlim : The queue size in packets $cbq_qtype : The type of a Queue object into the compound CBQ $okborrow : A boolean indicating the class is permitted to borrow bandwidth from its parent $bw $maxidle : The maximum amount of time a class may be required to have its packets queued before they are permitted to be forwarded $extradelay : increase the delay experienced by a delayed class by the specified time $ns cfg-cbq-for-HBTS $qlim $cbq_qtype $okborrow $bw $maxidle $extradelay Configure CBQ on all MPLS nodes so as to support Higher priority Best-effort Traffic Service The configuration parameters are the same as that of $ns cfgcbq-for- SBTS $ns cfg-cbq-for-STS $extradelay – $qlim $cbq_qtype $okborrow $bw $maxidle Configure CBQ on all MPLS nodes so as to support Signalling Traffic Service The configuration parameters are the same as that of $ns cfg-cbq-for-SBTS $ns cfg-cbq-for-RTS $qlim $cbq_qtype $okborrow $bw $maxidle $extradelay Configure CBQ on all MPLS nodes so as to support Real-time Traffic Service The configuration parameters are the same as that of $ns cfg-cbq-for-SBTS $ns bind-flowid-to-SBTS $id1 [$id2] – Cause packets containing flow id $id1 (or those in the range $id1 to $id2 inclusive) to be associated with SBTS service $ns bind-flowid-to-HBTS $id1 [$id2] – Cause packets containing flow id $id1 (or those in the range $id1 to $id2 inclusive) to be associated with HBTS service $ns bind-flowid-to-STS $id1 [$id2] – Cause packets containing flow id $id1 (or those in the range $id1 to $id2 inclusive) to be associated with STS service $ns bind-ldp-to-SBTS – Cause LDP packets to be associated with SBTS service $ns bind-ldp-to-HBTS – Cause LDP packets to be associated with HBTS service 10 $ns bind-ldp-to-STS – Cause LDP packets to be associated with STS service 11 $MPLSnode setup-crlsp $fec $er $lspid $TRate $BSize $PSize $SPrio $HPrio – Create an CR-LSP ofth which the FEC is $fec, the specified Explicit Route is $er, and the LSPID is $lspid By this command, a CR-LDP Request message is sent toward the node with $fec along the $er Configuration Parameter: $fec : The value of FEC Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 103 $er : Explicit Route $lspid : The value of LSPID $TRate : The value of traffic rate $BSize : The value of buffer size $PSize : The value of packet size $SPrio : The value of setup priority $HPrio : The value of holding priority 12 $MPLSnode send-crldp-release-msg $lspid – Send a CR-LDP Release message toward an upstream LSR in order to release the established ERLSP/CR-LSP of which the LSPID is $lspid 13 $MPLSnode send-crldp-withdraw-msg $lspid – Send a CR-LDP Withdraw message toward downstream LSRs in order to release the established ERLSP/CRLSP of which the LSPID is $lspid 14 $MPLSnode send-crldp-notification-msg $status $lspid $tr – Send a CRLDP Notification message toward upstream LSRs in order to give them a notification information Configuration Parameter $status : The status information defined in CR-LDP standards $lspid : LSPID $tr : Traffic information 15 $MPLSnode set-flow-prio $fec $flowid $priority – let the traffic with FEC $fec and flow id $ flowid have priority $priority There are three call-back functions in MNS proc notify-erlsp-setup {node lspid} – It is used to notify user that CR-LDP Mapping message with LSPID $lspid arrived at a node $node proc notify-erlsp-fail {node status lspid tr} – It is used to notify user that CRLDP Notification message with a status information $status, LSPID $lspid, and traffic information $tr arrived at a node $node proc notify-erlsp-release {node lspid} – It is used to notify user that CR-LDP Release/Withdraw message with LSPID $lspid arrived at a node $node APIs for the constraint-based routing $ns collect-resource-info $itime – Used to collect the resource information from all MPLS nodes periodically every the time interval $itime $MPLSnode constraint-based-routing $dstid $bw – Used to calculate explicit route If O.K return an explicit route, else return -1 Configuration Parameters Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 104 $dstid : the ID of the destination LSR $bw : the required bandwidth APIs for reroute simulation in MPLS Networks $ns enable-reroute $option – let all MPLS nodes execute path restoration function There are five options as follows: drop : Not create any new alternative path L3 : make use of L3 routing table notify-prenegotiated : The node that detected a link failure transmits a LDP Notification message to its upstream LSRs simple-dynamic : Create new alternative path between The node that detected a link failure and the PML if one does not exist shortest-dynamic: Create new alternative path between The node that detected a link failure and the next node if one does not exist $ns set-protection-lsp $stime $itime $lspid – used to see whether a link failure occurs on all MPLS nodes Configuration Parameters $stime : The time to start detecting a lnk failure $itime : The time intervals $lspid : the LSPID of working LSP $MPLSnode reroute-lsp-binding $w_lspid a_lspid - used to bind working LSP to altanative LSP Configuration Parameters $w_lspid : The LSPID of working LSP $a_lspid : The LSPID of altanative LSP $MPLSnode enable-reroute-egress-lsr – let $MPLSnode operate as a Protection Merge LSR APIs for Trace of MPLS/LDP packets and Dump of Tables $MPLSnode trace-mpls – Trace packets in a MPLS node, $MPLSnode $MPLSnode trace-ldp – Trace LDP packets in a MPLS node, $MPLSnodel $MPLSnode pft-dump – Display a table, PFT(Partial Forwarding Table) managed in a MPLS node, $MPLSnode $MPLSnode erb-dump – Display a table, ERB(Explicit Route information Table) managed in a MPLS node, $MPLSnode $MPLSnode lib-dump – Display a table, LIB(Label Information Base) managed in a MPLS node, $MPLSnode Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học 105 APIs for utility $ns ldp-request-color $color – Set a color for LDP Request message ex)$ns ldp-request-color $green – Set green color for LDP Request message $ns ldp-mapping-color $color – Set a color for LDP Mapping message $ns ldp-withdraw-color $color – Set a color for LDP Withdraw message $ns ldp-release-color $color – Set a color for LDP Release message 10 $ns ldp-notification-color $color – Set a color for LDP Notification message Nguyễn Hoàng Chƣơng Luận văn tốt nghiệp cao học

Ngày đăng: 23/09/2020, 23:06

Từ khóa liên quan

Mục lục

  • MỤC LỤC

  • DANH MỤC CÁC KÝ HIỆU VÀ CÁC CHỮ VIẾT TẮT

  • DANH MỤC CÁC HÌNH VẼ, ĐỒ THỊ

  • MỞ ĐẦU

  • 1.1. Lịch sử phát triển

  • 1.1.1. Lịch sử phát triển của Công nghệ MPLS

  • 1.1.2. Một số ứng dụng của Công nghệ MPLS

  • 1.2. Tổng quan về công nghệ MPLS

  • 1.2.1. Định nghĩa

  • 1.2.2. Lợi ích của MPLS

  • 1.2.3. Nhược điểm của MPLS

  • 1.2.4. Đặc điểm mạng MPLS

  • 1.2.5. So sánh MPLS và IP

  • 1.3. Kết luận

  • 2.1. Định nghĩa về nhãn trong MPLS

  • 2.2. Cấu trúc khung của nhãn trong MPLS

  • 2.3. Cấu trúc tế bào của nhãn trong MPLS

  • 2.4. Mặt phẳng chuyển tiếp và Mặt phẳng điều khiển

  • 2.5. Thuật toán chuyển tiếp nhãn

  • 2.6. Phân phối nhãn

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan