1. Trang chủ
  2. » Giáo Dục - Đào Tạo

MẠNG MPLS và ỨNG DỤNG TRONG NGÀNH THUẾ

78 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

ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CÔNG NGHỆ =======================  ========================= ĐINH CÔNG HIẾU MẠNG MPLS VÀ ỨNG DỤNG TRONG NGÀNH THUẾ LUẬN VĂN THẠC SĨ Hà Nội - 2011 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CÔNG NGHỆ ĐINH CÔNG HIẾU MẠNG MPLS VÀ ỨNG DỤNG TRONG NGÀNH THUẾ Ngành: Công nghệ thông tin Chuyên ngành: Truyền số liệu mạng máy tính Mã số: 604815 LUẬN VĂN THẠC SĨ NGƯỜI HƯỚNG DẪN KHOA HỌC: PGS.TS Nguyễn Văn Tam Hà Nội - 2011 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com MỤC LỤC Trang phụ bìa Lời cam đoan Mục lục Danh mục thuật ngữ từ viết tắt Danh mục hình vẽ LỜI MỞ ĐẦU CHƢƠNG CÔNG NGHỆ CHUYỂN MẠCH MPLS 10 1.1 Giới thiệu chuyển mạch đa giao thức (MPLS) 10 1.1.1 MPLS ? 10 1.1.2 Lợi ích MPLS 11 1.2 Kiến trúc MPLS: 12 1.2.1 Mặt phẳng chuyển tiếp: 12 1.2.2 Mặt phẳng điều khiển 15 1.3 Các thành phần MPLS 16 1.3.1 Bộ định tuyến chuyển mạch nhãn 16 1.3.2 Tuyến chuyển mạch nhãn 18 1.3.3 Giao thức phân phối nhãn 23 CHƢƠNG CHẤT LƢỢNG DỊCH VỤ 25 2.1 Dịch vụ tích hợp IntServ 25 2.1.1 Phân lớp dịch vụ IntServ 26 2.1.2 RSVP 26 2.2 Dịch vụ phân biệt DiffServ 28 2.2.1 Xử lý chặn 28 2.2.2 Kiến trúc dịch vụ DiffServ 30 2.2.3 Cơ chế dịch vụ DiffServ 31 2.2.4 Thực thi PHB 32 2.3 Modular QoS CLI 33 2.4 Triển khai dịch vụ DiffServ mạng MPLS 34 2.4.1 MPLS hỗ trợ DiffServ 34 2.4.2 Mơ hình đƣờng hầm DiffServ qua mạng MPLS 35 CHƢƠNG ỨNG DỤNG MƠ HÌNH DIFFSERV TRONG VIỆC ĐẢM BẢO CHẤT LƢỢNG DỊCH VỤ MẠNG MPLS 41 3.1 Hạ tầng truyền thông ngành Tài 41 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 3.1.1 Giới thiệu 41 3.1.2 Thiết Kế Truy Cập Cho Tổng Cục Thuế 43 3.2 Đề suất cải tiến chất lƣợng dịch vụ đƣờng truyền ngành Tài 45 3.2.1 Xác định mức độ ƣu tiên gói tin IP Precedence, MPLS exp 46 3.2.2 Các lớp dịch vụ tƣơng ứng với IP Precedence: 46 3.2.3 Giới hạn băng thông 47 3.2.4 Loại bỏ có chọn lọc gói tin 48 3.2.5 Các chế xếp hàng gói tin (Queueing): 48 3.3 Kết đo đạc thông lƣợng đƣờng truyền MPLS ngành Thuế 49 3.3.1 Thông lƣợng truy cập vào TTDL 52 3.3.2 Thông lƣợng vào Cục thuế Phú Thọ 53 3.3.3 Thông lƣợng xuất phát từ chi cục thuế Việt Trì 54 3.3.4 Nhận xét thông lƣợng đƣờng truyền MPLS ngành Thuế: 55 3.4 Thực nghiệm kiểm chứng hiệu việc áp dụng mơ hình DiffServ công cụ mô NS2 55 3.4.1 Khái quát chung NS-2 55 3.4.2 Mơ hình kết mơ 58 KẾT LUẬN 63 TÀI LIỆU THAM KHẢO 64 PHỤ LỤC 66 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com LỜI CAM ĐOAN Kính gửi: Ban giám hiệu - Trƣờng Đại học Công nghệ - Phịng Đào tạo - Ban Chủ nhiệm Khoa Cơng nghệ thông tin Tên là: Đinh Công Hiếu Sinh ngày: 21-11-1978 Học viên cao học lớp K15-T2 Tôi xin cam đam toàn kiến thức nội dung luận văn kiến thức tự nghiên cứu từ tài liệu tham khảo nƣớc nhƣ nêu phần “Tài liệu tham khảo” Tồn luận văn thân tơi nghiên cứu xây dựng nên khơng có chép hay vay mƣợn dƣới hình thức để hồn thành luận văn Tơi xin cam đoan lời khai chịu hoàn toàn trách nhiệm nội dung luận văn trƣớc Hội đồng chấm luận văn thạc sĩ LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com DANH MỤC CÁC THUẬT NGỮ VÀ CÁC TỪ VIẾT TẮT ATM Asynchnorous Tranfer Mode Truyền dẫn không đồng AToM Any Transport over MPLS Truyền tải qua MPLS BGP Border Gateway Protocol Giao thức cổng biên Bộ tài BTC CAR Committed Access Rate CBWFQ Class-Base Weighted Fair Queuing Cam kết tốc độ truy cập Hàng đợi cân dựa lớp CE Custome Edge Biên phía khách hàng CEF Cisco Express Forwarding Chuyển tiếp nhanh Cisco CoS Class of Service Lớp dịch vụ CQ Custom Queue Hàng đợi tuỳ chọn CR Constraint-based routing Định tuyến ràng buộc CCT Chi cục Thuế CT Cục thuế DiffServ Differentiated Services Dịch vụ khác biệt DSCP DiffServ Code Point Điểm mã dịch vụ phân biệt E-LSR Egress LSR LSR biên FEC Forwarding Equivalency Class Lớp chuyển tiếp tƣơng đƣơng FTP File Tranfer Protocol Giao thức truyền file FRTS Frame Relay Traffic Shaping Định dạng lƣu lƣợng Frame Relay GRE Generic Routing Encapsulation Giao thức GRE GTS Generic Traffic Shaping Định dạng lƣu lƣợng chung High-Level Data Link Control Điều khiển tuyến kết nối số liệu HDLC mức cao Hạ tầng truyền thông HTTT IETF Internet Engineering Task Force Ủy ban tƣ vấn kỹ thuật Internet LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com Interior Gateway Protocol Giao thức định tuyến phạm I-LSR Ingress LSR vi miền LSR biên vào IntServ Intergrated Services Dịch vụ tích hợp IP Internet Protocol Giao thức Internet Intermediate System to Intermediate Giao thức định tuyến IS-IS IGP IS-IS System LAN Local Area Network Mạng cục LDP Label Distribution Protocol Giao thức phân phối nhãn LER Label Edge Router Bộ định tuyến nhãn biên LFIB Label Forwarding Information Base Cơ sở thông tin chuyển tiếp nhãn LIB Label Information Base Bảng sở liệu nhãn LSP Label Switch Path Tuyến chuyển mạch nhãn LSR Label Switch Router Bộ định tuyến chuyển mạch nhãn MPLS Multiprotocol Label Switching Chuyển mạch nhãn đa giao thức BGP Border Gateway Protocol Giao thức cổng biên OSPF Open Shortest Path First Giao thức OSPF OUI Organizationally Unique Identifier Nhận dạng tổ chức PE Provider Edge Biên nhà cung cấp PHB Per-Hop Behavior Xử lý chặng PPP Point-to-Point Protocol Giao thức điểm - điểm PQ Priority Queue Hàng đợi ƣu tiên PVC Permanent Virtual Circuit Mạch ảo thƣờng trực QoS Quanlity of Service Chất lƣợng dịch vụ RFC Request for comment Các tài liệu chuẩn IETF đƣa RSpec Request Specification Mô tả yêu cầu LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com RSVP Resource Reservation Protocol Giao thức dành sẵn tài nguyên SLA Service Level Agreements Thoả thuận cấp độ dịch vụ SP Service Provider Nhà cung cấp TCP Tranmission Control Protocol Giao thức điều khiển truyền dẫn Tổng cục Thuế TCT TDP Tag Distribution Protocol Giao thức phân phối tag TE Traffic Engineering Kỹ thuật điều khiển lƣu lƣợng TSpec Traffic Specification Mô tả lƣu lƣợng TTDL Trung tâm liệu TTH Trung tâm huyện TTM Trung tâm miền TTL Time To Live Thời gian sống Trung tâm tỉnh TTT UDP User Datagram Protocol Giao thức UDP UNI User-to-Network Interface Giao diện ngƣời dùng tới mạng VC Virtual Channel Kênh ảo VoATM Voice over ATM Thoại qua ATM VoIP Voice over IP Thoại qua IP VP Virtual Path Tuyến ảo VPN Virtual Pravite Network Mạng riêng ảo Weighted Random Early Detection Hàng đợi phát sớm ngẫu nhiên WRED theo trọng số LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com DANH MỤC HÌNH VẼ Hình 1- Kiến trúc hệ thống mạng MPLS 11 Hình 1- Kiến trúc nút mạng MPLS 12 Hình 1- Định dạng nhãn MPLS 13 Hình 1- Cấu trúc sở thông tin chuyển tiếp nhãn (LFIB) 14 Hình 1- Hoạt động LSR gói tin với mức ngăn xếp 17 Hình 1- Hoạt động LSR gói tin với nhiều mức ngăn sếp 18 Hình 1- Các mức chuyển tiếp LSP 19 Hình 1- Thiết lập LSP điều khiển độc lập 20 Hình 1- Thiết lập LSP điều khiển thứ tự 23 Hình 2-1 Luồng thơng điệp PATH RESV 27 Hình 2-2 Luồng thơng điệp PATH RESV theo hai chiều 27 Hình 2-3 Giá trị trƣờng DSCP PHB 28 Hình 2-4 Kiến trúc dịch vụ DiffServ 31 Hình 2-5 Cơ chế thành phần QoS CLI 33 Hình 2-6 MPLS E-LSP 34 Hình 2-7 MPLS L-LSP 35 Hình 2-8 Mơ hình đƣờng ống 36 Hình 2-9 Mơ hình đƣờng ống ngắn với PHP 37 Hình 2-10 Mơ hình đƣờng ống ngắn khơng có PHP 38 Hình 2-11 Mơ hình đƣờng hầm thống với PHP 39 Hình 2-12 Mơ hình đƣờng hầm thống khơng có PHP 40 Hình 3-1 Mơ hình hạ tầng truyền thơng ngành Tài 41 Hình 3-2 Mơ hình kết nối cho Cục thuế tỉnh 44 Hình 3-3 Mơ hình kết nối tổng quát GRE Tunnel 44 Hình 3-4 Mơ hình kết hợp DiffServ vào mạng MPLS 46 Hình 3-5 Các lớp dịch vụ khác chia sẻ băng thơng 48 Hình 3-6 Vị trí lắp đặt Packetshaper Data Center 50 Hình 3-7 Vị trí lắp đặt Packetshaper Cục thuế Phú Thọ 51 Hình 3-8 Vị trí lắp đặt Packetshaper Chi cục Thuế Việt Trì 51 Hình 3-9 Thơng lƣợng truy cập vào TTDL 52 Hình 3-10 Mƣời ứng dụng đứng đầu truy cập vào TTDL 52 Hình 3-11 Thơng lƣợng vào Cục thuế Phú Thọ 53 Hình 3-12 Mƣời ứng dụng đứng đầu truy cập CT Phú Thọ 53 Hình 3-13 Thơng lƣợng vào Chi cục Thuế Việt Trì 54 Hình 3-14 Mƣời ứng dụng truy cập CCT Việt Trì 54 Hình 3-15 Cấu trúc thƣ mục NS-allinone 56 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com Hình 3-16 Cấu trúc node Unicast node Multicast 56 Hình 3-17 Mơ hình MNS NS2 57 Hình 3-18 Cấu trúc node MPLS 58 Hình 3-19 Topo mạng sử dụng q trình mơ 59 Hình 3-20 Mạng MPLS khơng DiffServ với luồng UDP có lƣu lƣợng thấp 59 Hình 3-21 Mạng MPLS khơng DiffServ với luồng UDP có lƣu lƣợng cao 60 Hình 3-22 Mạng MPLS có DiffServ với luồng UDP có lƣu lƣợng thấp 61 Hình 3-23 Mạng MPLS có DiffServ với luồng UDP có lƣu lƣợng cao 62 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 62 Hình 3-23 Mạng MPLS có DiffServ với luồng UDP có lưu lượng cao Nhƣ Hình 3-22 Hình 3-23 có khác biệt thông lƣợng luồng TCP việc sử dụng luồng UDP có lƣu lƣợng thấp cao luồng TCP0 TCP1 áp dụng sách khác hàng đợi, thơng lƣợng, mức độ ƣu tiên gửi gói tin đƣờng truyền Bảng 3.2 tóm tắt kết mơ mạng MPLS có sử dụng DiffServ MPLS có DiffServ Thơng lƣợng Độ trễ trung bình (s) Độ lệch chuẩn (s) 0.26455 0.06379 trung bình (kbps) Luồng UDP 9.86206 UDP lƣu TCP0 416.29462 0.27741 0.00764 lƣợng thấp TCP1 547.50034 0.24583 0.01542 Luồng UPD 0.27205 0.18292 UDP lƣu TCP0 195.58893 0.31349 0.01926 lƣợng cao TCP1 735.20819 0.16990 0.05869 46.10445 Bảng 3.2 Thống kê thơng lượng mạng MPLS (có DiffServ) LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 63 KẾT LUẬN Trong nội dung luận văn trình bày khái niệm cơng nghệ chuyển mạch nhãn MPLS, khái niệm chất lƣợng đƣờng truyền (QoS) đề suất việc áp dụng mơ hình DiffServ hệ thống mạng MPLS ngành Tài Thơng qua kết đo đạc thơng lƣợng đƣờng truyền MPLS ngành Thuế kết thực nghiệm chạy NS2 chứng minh đƣợc việc sử dụng mơ hình DiffServ hệ thống mạng MPLS tăng đƣợc chất lƣợng dịch vụ cho ứng dụng địi hỏi có độ ƣu tiên cao Với việc áp dụng mơ hình DiffServ hạ tầng truyền thơng ngành Tài chính, Bộ tài có khả phân luồng lƣu lƣợng hệ thống mạng trục ngành cho ứng dụng quan trọng ngành tài nhƣ ứng dụng TABMIS, ITAIS,… hoạt động thông suốt hiệu từ cấp Trung ƣơng xuống tới địa phƣơng Hƣớng phát triển đề tài: Luận văn có số hƣớng phát triển thời gian tới nhƣ:  Thực thi sách QoS mơ hình DiffServ mạng MPLS ngành Tài thiết bị mạng sử dụng ngành Tài TTT TTM  Nghiên cứu xem xét việc xây dựng giao thức để đƣa giải pháp cung cấp QoS cho lớp mạng lõi mạng MPLS ngành Tài LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 64 TÀI LIỆU THAM KHẢO Tiếng Việt Juniper Networks (Jun, 2007), "Thiết kế mạng MPLS cho Bộ tài chính", Bộ tài chính, tr 30 Juniper Networks (Jun, 2007), "Thiết kế mạng MPLS cho Bộ tài chính", Bộ tài chính, tr 31 Trần Công Hùng (2009), Chuyển mạch nhãn đa giao thức, Nhà xuất Thông tin Truyền thông, tr 222-223 Trần Công Hùng (2009), Chuyển mạch nhãn đa giao thức, Nhà xuất Thông tin Truyền thông, tr 230-232 Tiếng Anh Cisco Systems (Aug, 2005), "DiffServ-The scalable end-to-end quality of service model”, White Paper, pp 7-10 Eric Horlait and Nicolas Rouhana (2000), “Differentiated Services and Intergrated Services Use of MPLS”, University Pierre et Marie Curie – France, University Saint Joseph – Lebanon Gaei Ahn and Woojik Chum (2001), “Overview of MPLS Network Simulator: Design and Implementation”, Chungnam National University Korea Raymond Law and Srihari Raghavan (2001), “DiffServ and MPLS – Concepts and Simulation”, Virginia Polytechnic Institude and State University Santiago Alvarez (June, 02, 2006), QoS for IP/MPLS Networks, Cisco Press, USA, pp 15-19 10 Santiago Alvarez (June, 02, 2006), QoS for IP/MPLS Networks, Cisco Press, USA, pp 18 11 Vivek Alwayn (2002), Advanced MPLS Design and Implementation, Cisco Press, USA, pp 14 12 Vivek Alwayn (2002), Advanced MPLS Design and Implementation, Cisco Press, USA, pp 48-50 13 Vivek Alwayn (2002), Advanced MPLS Design and Implementation, Cisco Press, USA, pp 59-62 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 65 14 Vivek Alwayn (2002), Advanced MPLS Design and Implementation, Cisco Press, USA, pp 63 15 Vivek Alwayn (2002), Advanced MPLS Design and Implementation, Cisco Press, USA, pp 277-279 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 66 PHỤ LỤC  # -# mpls.tcl # -# Network simulation topology: # # Node0 # \ # \1Mb Node9 # \ 1Mb 1Mb / # LSR2 - LSR5 LSR6 /1Mb # /|(ingress) | | \ / # / | | | \ / # / |1Mb |1Mb 1Mb| LSR7 # 1Mb/ | | | / (engress) # / | 1Mb | 1Mb | / # / LSR3 - LSR4 LSR8 # Node1 (engress)\ # \1Mb # \ # Node10 # - set ns [new Simulator] #Open the NAM trace file -set nf [open mpls.nam w] set tf [open mpls.tr w] $ns namtrace-all $nf $ns trace-all $tf #Define a 'finish' procedure -proc finish {} { global ns nf tf $ns flush-trace #Close the NAM trace file close $nf #Close the Trace file close $tf #Execute NAM on the trace file exec nam mpls.nam & exit } # Define a procedure attach traffic node with sink proc attach-expoo-traffic { node sink size burst idle rate } { global ns 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 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 67 $traffic set idle-time $idle $traffic set rate $rate $source attach-traffic $traffic $ns connect $source $sink return $source } # make nodes & MPLSnodes set Node0 [$ns node] set Node1 [$ns node] set LSR2 [$ns mpls-node] set LSR3 [$ns mpls-node] set LSR4 [$ns mpls-node] set LSR5 [$ns mpls-node] set LSR6 [$ns mpls-node] set LSR7 [$ns mpls-node] set LSR8 [$ns mpls-node] set Node9 [$ns node] set Node10 [$ns node] # make links $ns duplex-link $Node0 $LSR2 1Mb 10ms DropTail $ns duplex-link $Node1 $LSR2 1Mb 10ms DropTail $ns duplex-link $LSR2 $LSR3 1Mb 10ms DropTail $ns duplex-link $LSR3 $LSR4 1Mb 10ms DropTail $ns duplex-link $LSR4 $LSR8 1Mb 10ms DropTail $ns duplex-link $LSR2 $LSR5 1Mb 10ms DropTail $ns duplex-link $LSR5 $LSR6 1Mb 10ms DropTail $ns duplex-link $LSR5 $LSR4 1Mb 10ms DropTail $ns duplex-link $LSR6 $LSR7 1Mb 10ms DropTail $ns duplex-link $LSR6 $LSR8 1Mb 10ms DropTail $ns duplex-link $LSR7 $LSR8 1Mb 10ms DropTail $ns duplex-link $LSR7 $Node9 1Mb 10ms DropTail $ns duplex-link $LSR8 $Node10 1Mb 10ms DropTail # Orient links to make topology clear $ns duplex-link-op $Node0 $LSR2 orient 1.667 $ns duplex-link-op $Node1 $LSR2 orient 0.333 $ns duplex-link-op $LSR2 $LSR3 orient down $ns duplex-link-op $LSR3 $LSR4 orient right $ns duplex-link-op $LSR4 $LSR8 orient right $ns duplex-link-op $LSR2 $LSR5 orient right $ns duplex-link-op $LSR5 $LSR6 orient right $ns duplex-link-op $LSR5 $LSR4 orient down $ns duplex-link-op $LSR6 $LSR7 orient 1.667 $ns duplex-link-op $LSR6 $LSR8 orient down $ns duplex-link-op $LSR8 $LSR7 orient 0.333 $ns duplex-link-op $LSR7 $Node9 orient 0.333 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 68 $ns duplex-link-op $LSR8 $Node10 orient 1.667 # configure ldp agents on all mpls nodes $ns configure-ldp-on-all-mpls-nodes # set ldp-message colors $ns ldp-request-color blue $ns ldp-mapping-color red $ns ldp-withdraw-color magenta $ns ldp-release-color orange $ns ldp-notification-color yellow # set ldp events $ns enable-control-driven #Create a traffic sink0 and attach it to the node node9 set sink0 [new Agent/LossMonitor] $ns attach-agent $Node9 $sink0 $sink0 clear #Create a traffic source set src0 [attach-expoo-traffic $Node0 $sink0 100 0 50k] $src0 set fid_ $ns color orange # create TCP agents set tcp0 [new Agent/TCP] $ns attach-agent $Node0 $tcp0 set ftp0 [new Application/FTP] $tcp0 set packetSize_ 1024 $ftp0 attach-agent $tcp0 set sink1 [new Agent/TCPSink] $ns attach-agent $Node9 $sink1 $ns connect $tcp0 $sink1 $tcp0 set fid_ $ns color blue set tcp1 [new Agent/TCP] $ns attach-agent $Node1 $tcp1 set ftp1 [new Application/FTP] $tcp1 set packetSize_ 1024 $ftp1 attach-agent $tcp1 set sink2 [new Agent/TCPSink] $ns attach-agent $Node9 $sink2 LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 69 $ns connect $tcp1 $sink2 $tcp1 set fid_ $ns color magenta # set MPLS modules # for {set i 2} {$i < 9} {incr i} { set a LSR$i set m [eval $$a get-module "MPLS"] eval set LSRmpls$i $m } # Schedule starting & stoping of traffic resources $ns at 1.1 "$ftp0 start" $ns at 1.5 "$ftp1 start" $ns at 1.9 "$src0 start" $ns at 25.9 "$src0 stop" $ns at 25.1 "$ftp0 stop" $ns at 25.5 "$ftp1 stop" $ns at 26.0 "finish" $ns run ### End: # # mplsdiff.tcl # # Network simulation topology: # # Node0 # \ # \1Mb Node9 # \ 1Mb 1Mb / # LSR2 - LSR5 LSR6 /1Mb # /|(ingress) | | \ / # / | | | \ / # / |1Mb |1Mb 1Mb| LSR7 # 1Mb/ | | | / (engress) # / | 1Mb | 1Mb | / # / LSR3 - LSR4 LSR8 # Node1 (engress)\ # \1Mb # \ # Node10 # - set ns [new Simulator] #Open the NAM trace file -set nf [open mplsdiff.nam w] set tf [open mplsdiff.tr w] LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 70 $ns namtrace-all $nf $ns trace-all $tf #Set variable: cir traffic rate, pir max traffic rate set cir0 100000 set pir0 500000 set rate0 4000000 set cir1 400000 set pir1 1000000 set rate1 2000000 set packetSize 1000 #Define a 'finish' procedure -proc finish {} { global ns nf tf $ns flush-trace #Close the NAM trace file close $nf #Close the Trace file close $tf #Execute NAM on the trace file exec nam mplsdiff.nam & exit } # Define a procedure attach traffic node with sink proc attach-expoo-traffic { node sink size burst idle rate } { global ns 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 } # make nodes & MPLSnodes set Node0 [$ns node] set Node1 [$ns node] set LSR2 [$ns mpls-node] set LSR3 [$ns mpls-node] set LSR4 [$ns mpls-node] set LSR5 [$ns mpls-node] set LSR6 [$ns mpls-node] set LSR7 [$ns mpls-node] set LSR8 [$ns mpls-node] LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 71 set Node9 [$ns node] set Node10 [$ns node] # make links $ns duplex-link $Node0 $LSR2 1Mb 10ms DropTail $ns duplex-link $Node1 $LSR2 1Mb 10ms DropTail $ns duplex-link $LSR2 $LSR3 1Mb 10ms DropTail $ns duplex-link $LSR3 $LSR4 1Mb 10ms DropTail $ns duplex-link $LSR4 $LSR8 1Mb 10ms DropTail $ns simplex-link $LSR2 $LSR5 1Mb 10ms dsRED/edge $ns simplex-link $LSR5 $LSR2 1Mb 10ms dsRED/core $ns duplex-link $LSR5 $LSR6 1Mb 10ms DropTail $ns duplex-link $LSR5 $LSR4 1Mb 10ms DropTail $ns duplex-link $LSR7 $LSR6 1Mb 10ms dsRED/edge $ns simplex-link $LSR6 $LSR7 1Mb 10ms dsRED/core $ns duplex-link $LSR6 $LSR8 1Mb 10ms DropTail $ns duplex-link $LSR7 $LSR8 1Mb 10ms DropTail $ns duplex-link $LSR7 $Node9 1Mb 10ms DropTail $ns duplex-link $LSR8 $Node10 1Mb 10ms DropTail set qE1C [[$ns link $LSR2 $LSR5] queue] set qE2C [[$ns link $LSR7 $LSR6] queue] set qCE1 [[$ns link $LSR5 $LSR2] queue] set qCE2 [[$ns link $LSR6 $LSR7] queue] # Orient links to make topology clear $ns duplex-link-op $Node0 $LSR2 orient 1.667 $ns duplex-link-op $Node1 $LSR2 orient 0.333 $ns duplex-link-op $LSR2 $LSR3 orient down $ns duplex-link-op $LSR3 $LSR4 orient right $ns duplex-link-op $LSR4 $LSR8 orient right $ns duplex-link-op $LSR2 $LSR5 orient right $ns duplex-link-op $LSR5 $LSR6 orient right $ns duplex-link-op $LSR5 $LSR4 orient down $ns duplex-link-op $LSR6 $LSR7 orient 1.667 $ns duplex-link-op $LSR6 $LSR8 orient down $ns duplex-link-op $LSR8 $LSR7 orient 0.333 $ns duplex-link-op $LSR7 $Node9 orient 0.333 $ns duplex-link-op $LSR8 $Node10 orient 1.667 # configure ldp agents on all mpls nodes $ns configure-ldp-on-all-mpls-nodes # set ldp-message colors $ns ldp-request-color $ns ldp-mapping-color blue red LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 72 $ns ldp-withdraw-color magenta $ns ldp-release-color orange $ns ldp-notification-color yellow # set ldp events $ns enable-control-driven # Set DS RED parameters from LSR2 to LSR5: $qE1C meanPktSize $packetSize $qE1C set numQueues_ $qE1C setNumPrec $qE1C addPolicyEntry [$Node0 id] [$Node9 id] TSW3CM 10 $cir0 $pir0 $qE1C addPolicyEntry [$Node1 id] [$Node9 id] TSW3CM 20 $cir1 $pir1 $qE1C addPolicyEntry -1 -1 TSW3CM 10 $cir1 $pir1 $qE1C addPolicerEntry TSW3CM 10 11 12 $qE1C addPolicerEntry TSW3CM 20 21 22 $qE1C addPHBEntry 10 0 $qE1C addPHBEntry 11 $qE1C addPHBEntry 12 $qE1C addPHBEntry 20 0^M $qE1C addPHBEntry 21 1^M $qE1C addPHBEntry 22 2^M $qE1C addPHBEntry 0 $qE1C configQ 0 20 40 0.02 $qE1C configQ 10 20 0.10 $qE1C configQ 10 0.20 $qE1C configQ 20 40 0.02^M $qE1C configQ 1 10 20 0.10^M $qE1C configQ 10 0.20^M # Set DS RED parameters from LSR7 to LSR6: $qE2C meanPktSize $packetSize $qE2C set numQueues_ $qE2C setNumPrec $qE2C addPolicyEntry [$Node9 id] [$Node0 id] TSW3CM 10 $cir0 $pir0 $qE2C addPolicyEntry [$Node9 id] [$Node1 id] TSW3CM 20 $cir1 $pir1 $qE2C addPolicyEntry -1 -1 TSW3CM 10 $cir1 $pir1 $qE2C addPolicerEntry TSW3CM 10 11 12 $qE2C addPolicerEntry TSW3CM 20 21 22 $qE2C addPHBEntry 10 0 $qE2C addPHBEntry 11 $qE2C addPHBEntry 12 $qE2C addPHBEntry 20 0^M $qE2C addPHBEntry 21 1^M $qE2C addPHBEntry 22 2^M LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 73 $qE2C addPHBEntry 0 $qE2C configQ 0 20 40 0.02 $qE2C configQ 20 20 0.10 $qE2C configQ 10 0.20 $qE2C configQ 20 40 0.02^M $qE2C configQ 1 20 20 0.10^M $qE2C configQ 10 0.20^M # Set DS RED parameters from LSR5 to LSR2: $qCE1 meanPktSize $packetSize $qCE1 set numQueues_ $qCE1 setNumPrec $qCE1 addPHBEntry 10 0 $qCE1 addPHBEntry 11 $qCE1 addPHBEntry 12 $qCE1 addPHBEntry 20 0^M $qCE1 addPHBEntry 21 1^M $qCE1 addPHBEntry 22 2^M $qCE1 addPHBEntry 0 2^M $qCE1 configQ 0 20 40 0.02 $qCE1 configQ 10 20 0.10 $qCE1 configQ 10 0.20 $qCE1 configQ 20 40 0.02^M $qCE1 configQ 1 10 20 0.10^M $qCE1 configQ 10 0.20^M # Set DS RED parameters from LSR6 to LSR7: $qCE2 meanPktSize $packetSize $qCE2 set numQueues_ $qCE2 setNumPrec $qCE2 addPHBEntry 10 0 $qCE2 addPHBEntry 11 $qCE2 addPHBEntry 12 $qCE2 addPHBEntry 20 0^M $qCE2 addPHBEntry 21 1^M $qCE2 addPHBEntry 22 2^M $qCE2 addPHBEntry 0 2^M $qCE2 configQ 0 20 40 0.02 $qCE2 configQ 10 20 0.10 $qCE2 configQ 10 0.20 $qCE2 configQ 20 40 0.02^M $qCE2 configQ 1 10 20 0.10^M $qCE2 configQ 10 0.20^M #Create a traffic sink0 and attach it to the node node9 set sink0 [new Agent/LossMonitor] LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 74 $ns attach-agent $Node9 $sink0 $sink0 clear #Create a traffic source set src0 [attach-expoo-traffic $Node0 $sink0 100 0 90k] $src0 set fid_ $ns color orange # create TCP agents set tcp0 [new Agent/TCP] $ns attach-agent $Node0 $tcp0 set ftp0 [new Application/FTP] $tcp0 set packetSize_ 1024 $ftp0 attach-agent $tcp0 set sink1 [new Agent/TCPSink] $ns attach-agent $Node9 $sink1 $ns connect $tcp0 $sink1 $tcp0 set fid_ $ns color blue set tcp1 [new Agent/TCP] $ns attach-agent $Node1 $tcp1 set ftp1 [new Application/FTP] $tcp1 set packetSize_ 1024 $ftp1 attach-agent $tcp1 set sink2 [new Agent/TCPSink] $ns attach-agent $Node9 $sink2 $ns connect $tcp1 $sink2 $tcp1 set fid_ $ns color magenta # set MPLS modules # for {set i 2} {$i < 9} {incr i} { set a LSR$i set m [eval $$a get-module "MPLS"] eval set LSRmpls$i $m } $qE1C printPolicyTable $qE1C printPolicerTable # Schedule starting & stoping of traffic resources $ns at 1.1 "$ftp0 start" $ns at 1.5 "$ftp1 start" $ns at 1.9 "$src0 start" LUAN VAN CHAT LUONG download : add luanvanchat@agmail.com 75 $ns at 25.9 "$src0 stop" $ns at 25.1 "$ftp0 stop" $ns at 25.5 "$ftp1 stop" $ns at 26.0 "finish" $ns run ### End: # Type: perl Scripts_1.pl # To compute average throughput during simulation time # of the flow "flow id" at the node "required node" # -$infile=$ARGV[0]; $flow_id=$ARGV[1]; $tonode=$ARGV[2]; $start_time=0; $end_time=0; # To compute how many bytes of "flow id" were received at the "required node" # during simulation time # $sum=0; open (DATA,"

Ngày đăng: 01/11/2022, 15:56

Xem thêm: