1. Trang chủ
  2. » Luận Văn - Báo Cáo

(LUẬN văn THẠC sĩ) kỹ thuật lưu lượng trong mạng chuyển dịch nhãn đa giao thức

127 1 0

Đ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

Nội dung

ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CÔNG NGHỆ VŨ VĂN TRƯỞNG KỸ THUẬT LƯU LƯỢNG TRONG MẠNG CHUYỂN MẠCH NHÃN ĐA GIAO THỨC LUẬN VĂN THẠC SĨ Hà Nội- 2009 TIEU LUAN MOI download : skknchat@gmail.com ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CÔNG NGHỆ VŨ VĂN TRƯỞNG KỸ THUẬT LƯU LƯỢNG TRONG MẠNG CHUYỂN MẠCH NHÃN ĐA GIAO THỨC Nghành: Công nghệ Điện tử- Viễn Thông Chuyên nghành: Kỹ thuật Điện tử Mã số: 60.52.70 LUẬN VĂN THẠC SĨ NGƯỜI HƯỚNG DẪN KHOA HỌC PGS.TS Trần Quang Vinh Hà Nội- 2009 TIEU LUAN MOI download : skknchat@gmail.com Trang-2- LỜI CAM ĐOAN Tôi xin cam đoan toàn nội dung số liệu luận văn thạc sĩ: “Kỹ thuật lưu lượng mạng chuyển mạch nhãn đa giao thức” tự nghiên cứu thực Học viên thực luận văn Vũ Văn Trƣởng TIEU LUAN MOI download : skknchat@gmail.com Trang-3- LỜI CẢM ƠN Để hồn thành chương trình cao học viết luận văn này, Trước hết, xin chân thành cảm ơn đến q thầy trường Đại học Công nghệ- Đại học Quốc gia Hà Nội, đặc biệt thầy tận tình dạy bảo cho suốt thời gian học tập trường Tôi xin gửi lời biết ơn sâu sắc đến Phó giáo sư – Tiến sĩ Trần Quang Vinh dành nhiều thời gian tâm huyết hướng dẫn nghiên cứu giúp tơi hồn thành luận văn tốt nghiệp Mặc dù tơi có nhiều cố gắng hồn thiện luận văn tất nhiệt tình lực mình, nhiên khơng thể tránh khỏi thiếu sót, mong nhận đóng góp q báu q thầy bạn Hà Nội, tháng 12 năm 2009 Học viên Vũ Văn Trƣởng TIEU LUAN MOI download : skknchat@gmail.com Trang-4- MỤC LỤC Trang phụ bìa LỜI CAM ĐOAN LỜI CẢM ƠN MỤC LỤC THUẬT NGỮ VIẾT TẮT DANH SÁCH CÁC BẢNG 11 DANH SÁCH CÁC HÌNH MINH HỌA 11 MỞ ĐẦU 13 Chƣơng 1: CHUYỂN MẠCH NHÃN ĐA GIAO THỨC MPLS 15 1.1 Tổng quan 15 1.1.1 Tính thơng minh phân tán 15 1.1.2 MPLS mơ hình tham chiếu OSI 16 1.2 Các khái niệm MPLS 17 1.2.1 Miền MPLS (MPLS domain) 17 1.2.2 Lớp chuyển tiếp tƣơng đƣơng (FEC) 18 1.2.3 Nhãn chồng nhãn 18 1.2.4 Hoán đổi nhãn (Label Swapping) 19 1.2.5 Đƣờng chuyển mạch nhãn LSP (Label Switched Path) 19 1.2.6 Chuyển gói qua miền MPLS 21 1.3 Mã hóa nhãn chế độ đóng gói nhãn MPLS 21 1.3.1 Mã hóa chồng nhãn 21 1.3.2 Chế độ Frame 23 1.3.3 Chế độ Cell 23 1.4 Cấu trúc chức MPLS 25 1.4.1 Kiến trúc nút MPLS (LER LSR) 25 1.4.2 Mặt phẳng chuyển tiếp (mặt phẳng liệu) 26 1.4.3 Mặt phẳng điều khiển 28 1.5 Hoạt động chuyển tiếp MPLS 28 1.5.1 Hoạt động mặt phẳng chuyển tiếp 28 1.5.2 Gỡ nhãn chặng áp cuối PHP (Penultimate Hop Popping) 29 1.5.3 Một ví dụ hoạt động chuyển tiếp gói 30 1.6 Ƣu điểm ứng dụng MPLS 31 1.6.1 Đơn giản hóa chức chuyển tiếp 31 1.6.2 Kỹ thuật lƣu lƣợng 31 1.6.3 Định tuyến QoS từ nguồn 31 1.6.4 Mạng riêng ảo VPN 31 1.6.5 Chuyển tiếp có phân cấp (Hierachical forwarding) 32 1.6.6 Khả mở rộng (Scalability) 32 1.7 Tổng kết chƣơng 32 Chƣơng 2: ĐỊNH TUYẾN VÀ BÁO HIỆU MPLS 34 2.1 Định tuyến MPLS 34 2.1.1 Định tuyến ràng buộc (Constrain-based Routing) 34 2.1.2 Định tuyến tƣờng minh (Explicit Routing) 35 2.2 Các chế độ báo hiệu MPLS 36 2.2.1 Chế độ phân phối nhãn 36 TIEU LUAN MOI download : skknchat@gmail.com Trang-5- 2.2.2 Chế độ trì nhãn 37 2.2.3 Chế độ điều khiển LSP 38 2.2.4 Các giao thức phân phối nhãn MPLS 39 2.3 Giao thức phân phối nhãn LDP (Label Distribution Protocol) 40 2.3.1 Hoạt động LDP 40 2.3.2 Cấu trúc thông điệp LDP 42 2.3.3 Các tin LDP [1] 44 2.3.4 LDP điều khiển độc lập phân phối theo yêu cầu 45 2.4 Giao thức CR-LDP (Constrain-based routing LDP) 46 2.4.1 Mở rộng cho định tuyến ràng buộc 46 2.4.2 Thiết lập CR-LSP (Constrain-based routing LSP) 47 2.4.3 Tiến trình dự trữ tài nguyên 48 2.5 Giao thức RSVP-TE (RSVP Traffic Engineering) [3] 49 2.5.1 Các tin thiết lập dự trữ RSVP [1] 49 2.5.2 Các Tear Down, Error Hello RSVP-TE [1] 50 2.5.3 Thiết lập tuyến tƣờng minh điều khiển theo yêu cầu 51 2.5.4 Giảm lƣợng overhead làm tƣơi RSVP 52 2.6 Tổng kết chƣơng 53 Chƣơng 3: KỸ THUẬT LƢU LƢỢNG TRONG MPLS 54 3.1 Kỹ thuật lƣu lƣợng (Traffic Engineering) 54 3.1.1 Các mục tiêu triển khai kỹ thuật lƣu lƣợng 54 3.1.2 Các lớp dịch vụ dựa nhu cầu QoS lớp lƣu lƣợng 55 3.1.3 Hàng đợi lƣu lƣợng 56 3.1.4 Giải thuật Leaky Bucket Token Bucket 59 3.1.5 Giải pháp mô hình chồng phủ (Overlay Model) 62 3.2 MPLS kỹ thuật lƣu lƣợng 62 3.2.1 Khái niệm trung kế lƣu lƣợng (traffic trunk) 63 3.2.2 Đồ hình nghiệm suy (Induced Graph) 64 3.2.3 Bài toán kỹ thuật lƣu lƣợng MPLS 64 3.3 Trung kế lƣu lƣợng thuộc tính 64 3.3.1 Các hoạt động trung kế lƣu lƣợng 65 3.3.2 Thuộc tính tham số lƣu lƣợng (Traffic Parameter) 65 3.3.3 Thuộc tính lựa chọn quản lý đƣờng (chính sách chọn đƣờng) 66 3.3.4 Thuộc tính ƣu tiên / lấn chiếm (Priority/Preemption) 67 3.3.5 Thuộc tính đàn hồi (Resilience) 68 3.3.6 Thuộc tính khống chế (Policing) 68 3.4 Các thuộc tính tài nguyên 68 3.4.1 Bộ nhân cấp phát cực đại (maximum allocation multiplier) 68 3.4.2 Lớp tài nguyên (Resource-Class) 69 3.4.3 Độ đo TE 69 3.5 Tính toán đƣờng ràng buộc 69 3.5.1 Quảng bá thuộc tính liên kết 69 3.5.2 Tính tốn LSP ràng buộc (CR-LSP) 71 3.5.3 Giải thuật chọn đƣờng 71 3.5.4 Ví dụ chọn đƣờng cho trung kế lƣu lƣợng 72 TIEU LUAN MOI download : skknchat@gmail.com Trang-6- 3.5.5 Tái tối ƣu hóa (Re-optimization) 74 3.6 Bảo vệ khôi phục đƣờng 75 3.6.1 Phân loại chế bảo vệ khôi phục 76 3.6.2 Mơ hình Makam 77 3.6.3 Mơ hình Haskin (Reverse Backup) 77 3.6.4 Mơ hình Hundessa 78 3.6.5 Mơ hình Shortest-Dynamic 79 3.6.6 Mơ hình Simple-Dynamic 79 3.6.7 Mơ hình Simple-Static 80 3.7 Tổng kết chƣơng 80 Chƣơng 4: MÔ PHỎNG MPLS-TE VÀ ĐÁNH GIÁ 81 4.1 Phƣơng pháp công cụ mô 81 4.1.1 Phƣơng pháp phân tích 81 4.1.2 Chuẩn bị công cụ mô 82 4.2 Nội dung kết mô 82 4.2.1 Mô mạng IP không hỗ trợ MPLS 83 4.2.2 Mô định tuyến ràng buộc mạng MPLS 84 4.2.3 Mô hoạt động lấn chiếm (Preemption) với độ ƣu tiên 87 4.2.4 Mô khôi phục đƣờng theo chế Makam 89 4.2.5 Mô khôi phục đƣờng theo chế Haskin (Reverse Backup) 91 4.2.6 Mô khôi phục đƣờng theo chế Shortest-Dynamic 93 4.2.7 Mô khôi phục đƣờng theo chế Simple-Dynamic 94 4.3 Tổng kết chƣơng 96 KẾT LUẬN 97 TÀI LIỆU THAM KHẢO 99 PHỤ LỤC: MÃ NGUỒN CÁC BÀI MÔ PHỎNG 100 TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-7- THUẬT NGỮ VIẾT TẮT AAL AS ASIC ATM BGP CBQ CBR CBS CDR CLIP CQ CR CR-LDP CR-LSP CSPF DLCI DSCP eBGP EBS EGP ER ERB ERO EXP FDDI FEC FF ATM Adaptation Layer- Lớp thích ứng ATM Autonomous System- Hệ thống tự trị Application-Specific Integrated Circuit- Mạch tích hợp ứng dụng riêng Asynchronous Transfer Mode- Chế độ chuyển tải không đồng Border Gateway Protocol- Giao thức cổng biên Class Based Queueing- Hàng đợi theo lớp Constant Bit Rate- Tốc độ bít khơng đổi Committed Burst Size- Kích thƣớc chùm xung cam kết Committed Data Rate- Tốc độ liệu cam kết Classical IP- IP truyền thống Custom Queuing- Hàng đợi định Constraint-based Routing- Định tuyến ràng buộc Constraint-based Routing Label Distribution Protocol- Giao thức phân phối nhãn dƣa định tuyến ràng buộc Constraint-based Routing Label Switched Path- Đƣờng chuyển mạch nhãn dựa định tuyến ràng buộc Constrained Shortest Path First Diffserv Differentiated ServiceDịch vụ phân biệt dựa đƣờng dẫn ngắn có ràng buộc Data Link Connection Identifier- Nhận dạng kết nối liên kết liệu Service Code Point- Điểm mã dịch vụ exterior Border Gateway Protocol- Giao thức cổng biên ngồi Excess Burst Size- Kích thƣớc chùm xung tới hạn External (Exterior) Gateway Protocol- Giao thức cổng Explicit Route- Định tuyến tƣờng minh Explicit Route Information Base- Cơ sở thông tin định tuyến tƣờng minh Explicit Route Object- Đối tƣợng định tuyến tƣờng minh Experimental field- Trƣờng ƣu tiên Fibre Distributed Data Interface- Giao diện liệu phân phối sợi Forwarding Equivalence Class- Lớp chuyển tiếp tƣơng đƣơng Fixed Filter (RSVP reservation style)- Bộ lọc cố định (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-8- FIB FIFO FIS FR FRS FTN GFC GMPLS HEC iBGP IETF IGP ILM IP ISDN IS-IS IS-IS TE LC-ATM ATM LDP LER LFIB LIB LIFO LSA LSP LSR MNS MPLS MPLSCP MPLS-TE MPOA MSC Forwarding Infomation Base- Cơ sở thông tin chuyển tiếp First-in First-out- Vào trƣớc trƣớc Fault Information Signal- Tín hiệu thơng tin lỗi Frame Relay- Chuyển mạch khung Fault Recovery Signal- Tín hiệu khơi phục lỗi FEC to NHLFE Map- Ánh xạ FEC tới NHLFE Generic Flow Control (ATM)- Điều khiển luồng chung Generalized MPLS- MPLS tổng quan Header Error Control (ATM)- Điều khiển lỗi tiêu đề interior Border Gateway Protocol- Giao thức cổng biên nội Internet Engineering Task Force- Nhóm đặc trách kỹ thuật Internet Interior Gateway Protocol- Giao thức cổng nội Incoming Label Map- Ánh xạ nhãn đến Internet Protocol- Giao thức Internet Intergrated Services Digital Network- Mạng số tích hợp đa dịch vụ Intermediate System - to - Intermediate System- Hệ thống chuyển tiếp IS-IS with Traffic Engineering- IS-IS với kỹ thuật lƣu lƣợng Label Controlled ATM Interface- Nhãn đƣợc điều khiển qua giao tiếp Asynchronous Transfer Mode – Chế độ truyền không đồng Label Distribution Protocol- Giao thức phân phối nhãn Label Edge Router- Router biên nhãn Label Forwarding Information Base- Cơ sở thông tin chuyển tiếp nhãn Label Information Base- Cơ sở thông tin nhãn Last-in First-out- Vào sau trƣớc Link State Advertisements- Quảng bá trạng thái liên kết Label Switched Path- Đƣờng chuyển mạch nhãn Label Switching Router- Router chuyển mạch nhãn MPLS module for Network Simulator- Mô đun mô mạng MultiProtocol Label Switching- Chuyển mạch nhãn đa giao thức MPLS Control Protocol- Giao thức điều khiển MPLS MPLS Traffic Engineering- Kỹ thuật lƣu lƣợng MPLS Multiprotocol over ATM- Đa giao thức ATM Mobile Switching Centre- Trung tâm chuyển mạch di động (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-9- MTU NAM NCP NGN NHLFE NHRP tiếp NS OSI OSPF OSPF-TE PBS PDR PDU PHP PoR PPP PQ PSL PTI PVC QoS RED RFC RIB RSVP RSVP-TE SDH SLA SONET SPF TCP TE TLV ToS Maximum Transfer Unit- Đơn vị truyền cƣc đại Network Animator- Mô mạng Network Control Program- Chƣơng trình điều khiển mạng Next Generation Network- Mạng hệ Next Hop Label Forwarding Entry- Mục nhập chuyển tiếp nhãn chặng Next Hop Resolution Protocol- Giao thức phân giải chặng kế Network Simulator- Mô mạng Open System Interconnection- Kết nối hệ thống mở Open Shortest Path First- Giao thức lựa chọn đƣờng dẫn ngắn OSPF with Traffic Engineering- OSPF với kỹ thuật lƣu lƣợng Peak Burst Size- Kích thƣớc chùm xung đỉnh Peak Data Rate- Tốc độ liệu đỉnh Protocol Data Unit- Đơn vị liệu giao thức Penultimate Hop Popping- Gỡ nhãn chặng áp cuối Point of Repair- Điểm sửa chữa Point to Point Protocol- Giao thức kết nối điểm điểm Priority Queuing- Hàng đợi ƣu tiên Path Switch LSR- LSR chuyển đổi đƣờng dẫn Payload Type Identifier (ATM)- Bộ nhận dạng gói Permanent Virtual Connection- Mạch ảo cố định Quality of Service- Chất lƣợng dịch vụ Random Early Detection (Discard)- Sự phát ngẫu nhiên sớm Request for Comments - Đề nghị duyệt thảo bình luận Routing Information Base- Cơ sở thơng tin định tuyến Resource reSerVation Protocol- Giao thức dự trữ tài nguyên RSVP with Traffic Engineering- RSVP với kỹ thuật lƣu lƣợng Synchronous Digital Hierarchy- Phân cấp số đồng Service Level Agreement- Thỏa thuận mức dịch vụ Synchronous Optical Network- Mạng quang đồng Shortest Path First- Tìm đƣờng ngắn Transmission Control Protocol- Giao thức điều khiển truyền liệu Traffic Engneering- Kỹ thuật lƣu lƣợng Type/Length/Value - Kiểu/ Độ dài/ Giá trị Type of Service- Loại dịch vụ (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-112# 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 # 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 seq-record 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 } # -# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac proc notify-erlsp-setup {node lspid} { global src1 src2 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 (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-113$ns trace-annotate $msg set module [$node get-module "MPLS"] switch $lspid { 1100 { $module bind-flow-erlsp 10 100 $lspid } 1200 { $module reroute-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 $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 luong_1.tr -M -nb -bg white -fg black -zg black \ -geometry 500x250 -y "BW (Mbps)" -x "Time (sec)" \ -t "Bai 4: Khoi phuc duong theo co che Makam" -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 4: Bieu so thu tu packet theo thoi gian" -tf "helvetica-12" & exec nam -r 2ms bai4.nam & exit } # -# Tao sink1 gan voi nut R10 (day la noi thu nhan traffic) set sink1 [new Agent/LossMonitor] (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-114$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: MAKAM $ns enable-reroute notify-prenegotiated [$LSR3 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100 [$LSR5 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100 [$LSR7 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100 # Bat dau mo phong exec clear >@ stdout puts "\n BAI 4: KHOI PHUC DUONG BANG TAI DINH TUYEN TOAN CUC (MAKAM)\n" $ns at 0.00 "record" $ns at 0.00 "seq-record 600 800k 5.5" # Thiet lap LSP lam viec $ns at 0.15 "$ns trace-annotate {Bao hieu thiet lap duong lam viec: LSP_1100, ER=1_3_5_7_9 }" $ns at 0.15 "[$LSR1 get-module "MPLS"] setup-erlsp 1_3_5_7_9 1100" # Thiet lap LSP bao ve $ns at 0.15 "$ns trace-annotate {Bao hieu thiet lap duong bao ve: LSP_1200, ER=1_2_4_6_8_9 }" $ns at 0.15 "[$LSR1 get-module "MPLS"] setup-erlsp 1_2_4_6_8_9 1200" $ns at 0.50 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }" $ns at 0.50 "$src1 start" # Link giua LSR5 va LSR7 bi dut tu 2.0s, den 3.5s thi khoi phuc lai $ns rtmodel-at 2.0 down $LSR5 $LSR7 $ns rtmodel-at 3.5 up $LSR5 $LSR7 $ns at 5.0 "$src1 stop" $ns at 5.5 "recv-pkts" $ns at 5.5 "finish" $ns run Bai5.tcl ######################################################################## # BAI 5: KHOI PHUC DUONG THEO CO CHE DU PHONG DAO (REVERSE BACKUP) # # (MO HINH HASKIN) # ######################################################################## # Tao mot doi tuong mo phong set ns [new Simulator] $ns rtproto LS # Tao file de xuat ket qua cho NAM set nf [open bai5.nam w] $ns namtrace-all $nf # Tao cac file de luu du lieu cho xgraph set f1 [open luong_1.tr w] set f2 [open luong_seq.tr w] # So ket noi mang # # Khai bao nut IP (R0,R10) va nut MPLS (LSR1 > LSR9) set R0 [$ns node] (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-115foreach i "1 9" { set LSR$i [$ns mpls-node] set m LSR$i eval $$m color blue } set R10 [$ns node] # Khai bao link: odes bw delay queue $ns duplex-link $R0 $LSR1 3Mb 10ms DropTail $ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail $ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail $ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail $ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail $ns duplex-link $LSR9 $R10 3Mb 10ms DropTail $ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail $ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail $ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail $ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail $ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail $ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail $ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail $ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail # Ve dang so mang $ns duplex-link-op $R0 $LSR1 orient right $ns duplex-link-op $LSR1 $LSR3 orient right $ns duplex-link-op $LSR3 $LSR5 orient right $ns duplex-link-op $LSR5 $LSR7 orient right $ns duplex-link-op $LSR7 $LSR9 orient right $ns duplex-link-op $LSR9 $R10 orient right $ns duplex-link-op $LSR1 $LSR2 orient 0.333 $ns duplex-link-op $LSR2 $LSR4 orient right $ns duplex-link-op $LSR4 $LSR6 orient right $ns duplex-link-op $LSR6 $LSR8 orient right $ns duplex-link-op $LSR8 $LSR9 orient 1.667 $ns duplex-link-op $LSR3 $LSR4 orient 0.333 $ns duplex-link-op $LSR5 $LSR6 orient 0.333 $ns duplex-link-op $LSR7 $LSR8 orient 0.333 # Ghi chu $ns duplex-link-op $LSR1 $LSR3 label " 2M " $ns duplex-link-op $LSR3 $LSR5 label " 1M " $ns duplex-link-op $LSR5 $LSR7 label " 2M " $ns duplex-link-op $LSR7 $LSR9 label " 1M " $ns duplex-link-op $LSR1 $LSR2 label " 1M " $ns duplex-link-op $LSR2 $LSR4 label " 1M " $ns duplex-link-op $LSR4 $LSR6 label " 2M " $ns duplex-link-op $LSR6 $LSR8 label " 1M " $ns duplex-link-op $LSR8 $LSR9 label " 2M" $ns duplex-link-op $LSR3 $LSR4 label " 1M " $ns duplex-link-op $LSR5 $LSR6 label " 1M " $ns duplex-link-op $LSR7 $LSR8 label " 1M " $R0 label "Nguon" $R10 label "Dich" $LSR1 label "Ingress " $LSR9 label " Egress" # Cau hinh LDP agent tren tat ca cac nut MPLS $ns configure-ldp-on-all-mpls-nodes # Dat color cho cac ban tin LDP $ns ldp-request-color blue $ns ldp-mapping-color red $ns ldp-withdraw-color magenta $ns ldp-release-color orange $ns ldp-notification-color green # -# Dinh nghia cac ham su dung chuong trinh chinh # -# Tao mot procedure ghi nhan bang thong theo mot chu ki $time proc record {} { (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-116global sink1 f1 set ns [Simulator instance] # Dinh chu ki ghi nhan bang thong set time 0.1 # 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 seq-record 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 } # -# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac proc notify-erlsp-setup {node lspid} { global src1 src2 LSR3 LSR5 LSR7 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"] (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-117switch $lspid { 1100 { $module bind-flow-erlsp 10 100 $lspid } 1200 { $module reroute-lsp-binding 1100 $lspid } 1300 { [$LSR3 get-module "MPLS"] reroute-lsp-binding 1100 $lspid [$LSR5 get-module "MPLS"] reroute-lsp-binding 1100 $lspid [$LSR7 get-module "MPLS"] reroute-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 $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 luong_1.tr -M -nb -bg white -fg black -zg black \ -geometry 500x230 -y "BW (Mbps)" -x "Time (sec)" \ -t "Bai 5: Khoi phuc duong theo co che Haskin" -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 5: Bieu so thu tu packet theo thoi gian" -tf "helvetica-12" & exec nam -r 2ms bai5.nam & exit } (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-118# -# 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: HASKIN $ns enable-reroute drop [$LSR3 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100 [$LSR5 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100 [$LSR7 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100 # Bat dau mo phong exec clear >@ stdout puts "\n BAI 5: KHOI PHUC DUONG CO CHE REVERSE BACKUP (HASKIN) \n " $ns at 0.0 "record" $ns at 0.0 "seq-record 600 800k 5.5" # Thiet lap LSP lam viec $ns at 0.1 "$ns trace-annotate {Bao hieu thiet lap duong lam viec: LSP_1100, ER=1_3_5_7_9 }" $ns at 0.1 "[$LSR1 get-module "MPLS"] setup-erlsp 1_3_5_7_9 1100” # Thiet lap LSP bao ve $ns at 0.1 "$ns trace-annotate {Bao hieu thiet lap duong bao ve: LSP_1200, ER=1_2_4_6_8_9 }" $ns at 0.1 "[$LSR1 get-module "MPLS"] setup-erlsp 1_2_4_6_8_9 1200” # Thiet lap LSP du phong dao (reverse backup) $ns at 0.3 "$ns trace-annotate {Bao hieu thiet lap duong reverse backup: LSP_1300, ER=9_7_5_3_1_L1200 }" $ns at 0.3 "[$LSR9 get-module "MPLS"] setup-erlsp 9_7_5_3_1_L1200 1300” $ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }" $ns at 0.5 "$src1 start" # Link giua LSR5 va LSR7 bi dut tu 2.0s, den 3.5s thi khoi phuc lai $ns rtmodel-at 2.0 down $LSR5 $LSR7 $ns rtmodel-at 3.5 up $LSR5 $LSR7 $ns at 5.0 "$src1 stop" $ns at 5.5 "recv-pkts" $ns at 5.5 "finish" $ns run Bai6.tcl ###################################################################### # BAI 6: KHOI PHUC DUONG THEO CO CHE SHORTEST-DYNAMIC # ###################################################################### # Tao mot doi tuong mo phong set ns [new Simulator] $ns rtproto LS # 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 luong_1.tr w] set f2 [open luong_seq.tr w] # So ket noi mang (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-119# # 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] # Khai bao link: odes bw delay queue $ns duplex-link $R0 $LSR1 3Mb 10ms DropTail $ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail $ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail $ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail $ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail $ns duplex-link $LSR9 $R10 3Mb 10ms DropTail $ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail $ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail $ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail $ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail $ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail $ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail $ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail $ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail # Ve dang so mang $ns duplex-link-op $R0 $LSR1 orient right $ns duplex-link-op $LSR1 $LSR3 orient right $ns duplex-link-op $LSR3 $LSR5 orient right $ns duplex-link-op $LSR5 $LSR7 orient right $ns duplex-link-op $LSR7 $LSR9 orient right $ns duplex-link-op $LSR9 $R10 orient right $ns duplex-link-op $LSR1 $LSR2 orient 0.333 $ns duplex-link-op $LSR2 $LSR4 orient right $ns duplex-link-op $LSR4 $LSR6 orient right $ns duplex-link-op $LSR6 $LSR8 orient right $ns duplex-link-op $LSR8 $LSR9 orient 1.667 $ns duplex-link-op $LSR3 $LSR4 orient 0.333 $ns duplex-link-op $LSR5 $LSR6 orient 0.333 $ns duplex-link-op $LSR7 $LSR8 orient 0.333 # Ghi chu $ns duplex-link-op $LSR1 $LSR3 label " 2M " $ns duplex-link-op $LSR3 $LSR5 label " 1M " $ns duplex-link-op $LSR5 $LSR7 label " 2M " $ns duplex-link-op $LSR7 $LSR9 label " 1M " $ns duplex-link-op $LSR1 $LSR2 label " 1M " $ns duplex-link-op $LSR2 $LSR4 label " 1M " $ns duplex-link-op $LSR4 $LSR6 label " 2M " $ns duplex-link-op $LSR6 $LSR8 label " 1M " $ns duplex-link-op $LSR8 $LSR9 label " 2M" $ns duplex-link-op $LSR3 $LSR4 label " 1M " $ns duplex-link-op $LSR5 $LSR6 label " 1M " $ns duplex-link-op $LSR7 $LSR8 label " 1M " $R0 label "Nguon" $R10 label "Dich" (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-120$LSR1 label "Ingress " $LSR9 label " Egress" # Cau hinh LDP agent tren tat ca cac nut MPLS $ns configure-ldp-on-all-mpls-nodes # Dat color cho cac ban tin LDP $ns ldp-request-color blue $ns ldp-mapping-color red $ns ldp-withdraw-color magenta $ns ldp-release-color orange $ns ldp-notification-color 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 # 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 seq-record 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 (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-121$traffic set rate $rate $source attach-traffic $traffic $ns connect $source $sink return $source } # -# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac proc notify-erlsp-setup {node lspid} { global src1 src2 LSR3 LSR5 LSR7 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 } 1101 { # LSP_1101 tu dong chon duong ngan nhat vong qua loi $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 $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 (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-122exec xgraph luong_1.tr -M -nb -bg white -fg black -zg black \ -geometry 500x250 -y "BW (Mbps)" -x "Time (sec)" \ -t "Bai 6: Khoi phuc duong theo co che Shortest-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 6: Bieu so thu tu packet theo thoi gian" -tf "helvetica-12" & exec nam -r 2ms 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 red # Cai dat co che khoi phuc: SHORTEST-DYNAMIC $ns enable-reroute shortest-dynamic [$LSR5 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100 [$LSR9 get-module "MPLS"] enable-reroute-egress-lsr # Bat dau mo phong exec clear >@ stdout puts "\n BAI 6: KHOI PHUC DUONG THEO CO CHE SHORTEST-DYNAMIC \n " $ns at 0.0 "record" $ns at 0.0 "seq-record 600 800k 5.5" # 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 "[$LSR1 get-module "MPLS"] setup-erlsp 1_3_5_7_9 1100” $ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }" $ns at 0.5 "$src1 start" # Link giua LSR5 va LSR7 bi dut tu 2.0s, den 3.5s thi khoi phuc lai $ns rtmodel-at 2.0 down $LSR5 $LSR7 $ns rtmodel-at 3.5 up $LSR5 $LSR7 $ns at 5.0 "$src1 stop" $ns at 5.5 "recv-pkts" $ns at 5.5 "finish" $ns run Bai7.tcl ####################################################################### # BAI 7: KHOI PHUC DUONG THEO CO CHE SIMPLE-DYNAMIC # ####################################################################### # Tao mot doi tuong mo phong set ns [new Simulator] $ns rtproto LS # 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 luong_1.tr w] set f2 [open luong_seq.tr w] # So ket noi mang (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-123# # 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] # Khai bao link: odes bw delay queue $ns duplex-link $R0 $LSR1 3Mb 10ms DropTail $ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail $ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail $ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail $ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail $ns duplex-link $LSR9 $R10 3Mb 10ms DropTail $ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail $ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail $ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail $ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail $ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail $ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail $ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail $ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail # Ve dang so mang $ns duplex-link-op $R0 $LSR1 orient right $ns duplex-link-op $LSR1 $LSR3 orient right $ns duplex-link-op $LSR3 $LSR5 orient right $ns duplex-link-op $LSR5 $LSR7 orient right $ns duplex-link-op $LSR7 $LSR9 orient right $ns duplex-link-op $LSR9 $R10 orient right $ns duplex-link-op $LSR1 $LSR2 orient 0.333 $ns duplex-link-op $LSR2 $LSR4 orient right $ns duplex-link-op $LSR4 $LSR6 orient right $ns duplex-link-op $LSR6 $LSR8 orient right $ns duplex-link-op $LSR8 $LSR9 orient 1.667 $ns duplex-link-op $LSR3 $LSR4 orient 0.333 $ns duplex-link-op $LSR5 $LSR6 orient 0.333 $ns duplex-link-op $LSR7 $LSR8 orient 0.333 # Ghi chu $ns duplex-link-op $LSR1 $LSR3 label " 2M " $ns duplex-link-op $LSR3 $LSR5 label " 1M " $ns duplex-link-op $LSR5 $LSR7 label " 2M " $ns duplex-link-op $LSR7 $LSR9 label " 1M " $ns duplex-link-op $LSR1 $LSR2 label " 1M " $ns duplex-link-op $LSR2 $LSR4 label " 1M " $ns duplex-link-op $LSR4 $LSR6 label " 2M " $ns duplex-link-op $LSR6 $LSR8 label " 1M " $ns duplex-link-op $LSR8 $LSR9 label " 2M" $ns duplex-link-op $LSR3 $LSR4 label " 1M " $ns duplex-link-op $LSR5 $LSR6 label " 1M " $ns duplex-link-op $LSR7 $LSR8 label " 1M " $R0 label "Nguon" $R10 label "Dich" (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-124$LSR1 label "Ingress " $LSR9 label " Egress" # Cau hinh LDP agent tren tat ca cac nut MPLS $ns configure-ldp-on-all-mpls-nodes # Dat color cho cac ban tin LDP $ns ldp-request-color blue $ns ldp-mapping-color red $ns ldp-withdraw-color magenta $ns ldp-release-color orange $ns ldp-notification-color 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 # 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 seq-record 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 (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc Trang-125$traffic set rate $rate $source attach-traffic $traffic $ns connect $source $sink return $source } # -# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac proc notify-erlsp-setup {node lspid} { global src1 src2 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 luong_1.tr -M -nb -bg white -fg black -zg black \ -geometry 500x250 -y "BW (Mbps)" -x "Time (sec)" \ -t "Bai 7: Khoi phuc duong theo co che Simple-Dynamic" -tf "helvetica12" & 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 -r 2ms bai7.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 red # Cai dat co che khoi phuc: SIMPLE-DYNAMIC (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc (LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc(LUAN.van.THAC.si).ky.thuat.luu.luong.trong.mang.chuyen.dich.nhan.da.giao.thuc

Ngày đăng: 17/12/2023, 02:12

TÀI LIỆU CÙNG NGƯỜI DÙNG

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

TÀI LIỆU LIÊN QUAN