1. Trang chủ
  2. » Công Nghệ Thông Tin

Tim hieu ngon ngu mo hinh hoa mang va xay dung bo cong cu topology cho mang

226 44 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

Nhận xét giáo viên hướng dẫn ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… Nhận xét giáo viên phản biện ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… ………………………………………………………………… LỜI CẢM ƠN Chúng xin tỏ lòng biết ơn sâu sắc đến ba mẹ gia đình ni dưỡng, giáo dục tạo điều kiện tốt cho chúng thực đề tài Chúng em xin chân thành cảm ơn khoa Công nghệ thông tin quý Thầy, Cô khoa, trường Đại học Khoa học Tự nhiên TpHCM tạo điều kiện cho chúng em học tập thực luận văn tốt nghiệp Đặc biệt, chúng em xin chân thành cảm ơn Thầy Phan Xuân Huy tận tình hướng dẫn, bảo chúng em trình thực đề tài Mặc dù chúng em cố gắng hoàn thành luận văn với tất nỗ lực thân, luận văn chắn không tránh khỏi thiếu sót định, kính mong cảm thơng tận tình bảo q Thầy, Cơ bạn Phú Quý&Quang Hiếu Tháng 7/2005 MỤC LỤC Trang Danh sách bảng 12 Danh sách hình 14 Danh sách từ viết tắt 18 Tóm tắt luận văn 22 Chương mở đầu 24 Dẫn nhập 24 Mục đích ý nghĩa đề tài 25 Đối tượng phạm vi nghiên cứu 25 A Ngôn ngữ mơ hình hóa mạng mơi trường giả lập mạng 27 Phần SSFNet Models Domain Modeling Language 27 Chương SSF SSFNet Models 28 1.1 SSF Model 28 1.1.1 Giới thiệu 28 1.1.2 Các đặc tính SSF 28 1.1.3 Các phiên cài đặt SSF 28 1.1.4 Giới thiệu lớp sở SSF 29 1.1.5 Trình tự trình giả lập 34 1.2 SSFNet Model 36 1.2.1 Giới thiệu 36 1.2.2 Tổ chức thư mục SSFNet 38 1.2.3 Các giao thức hổ trợ SSFNet 38 1.2.4 Các gói thư viện SSFNet 39 1.2.4.1 SSF.OS 39 1.2.4.2 SSF.Net 40 Chương Domain Modeling Language 42 2.1 Giới thiệu ngôn ngữ DML 42 2.1.1 DML gì? 42 2.1.2 Cấu trúc ngữ pháp DML 42 2.1.3 Quá trình biên dịch DML 44 2.2 Các bước cài đặt biên dịch chương trình 45 2.2.1 Môi trường Windows 45 2.2.2 Môi trường Unix 48 2.3 Các đối tượng thuộc tính DML 48 2.3.1 Đối tượng Net 50 2.3.1.1 Định nghĩa khai báo 50 2.3.1.2 Các thuộc tính Net 52 2.3.2 Đối tượng Host 54 2.3.2.1 Định nghĩa khai báo 54 2.3.2.2 Các thuộc tính Host 54 2.3.3 Đối tượng Router 56 2.3.3.1 Định nghĩa khai báo 56 2.3.3.2 Các thuộc tính Router 57 2.3.4 Link 58 2.3.4.1 Định nghĩa khai báo 58 2.3.4.2 Các thuộc tính Link 59 2.3.5 Traffic 60 2.3.5.1 Định nghĩa khai báo 60 2.3.5.2 Các thuộc tính Traffic 60 2.3.6 Protocol 60 2.3.6.1 Định nghĩa khai báo 60 2.3.6.2 Các thuộc tính Protocol 61 2.3.6.3 Cấu hình Host FTP Client 65 2.3.6.4 Cấu hình Host FTP Server 66 2.4 Ciao thức BGP SSFNet 67 2.4.1 Giới thiêu giao thức BGP 67 2.4.2 Các yếu tố đánh giá BGP 69 2.4.3 BGP SSFNet 71 2.4.3.1 Các mơ hình tùy chọn cấu hình BGP 71 2.4.3.2 Tạo sub-network AS 71 2.4.3.3 Chồng giao thức cấu hình cho Boundary Router 72 2.4.3.4 Các thuộc tính BGP 73 2.5 Các từ khóa hổ trợ DML 75 2.5.1 Từ khóa _extend 75 2.5.2 Từ khóa _find 75 2.5.3 Từ khóa _dictionary 76 2.5.4 Ví dụ minh họa 76 Phần Công cụ giả lập mạng NS-2 Ngôn ngữ TCL 78 Chương Công cụ giả lập mạng NS-2 78 3.1 Tổng quan NS-2 78 3.2 Kiến trúc NS-2 78 3.3 Các thành phần cấu hình mạng NS-2 81 3.3.1 Lớp Simulator 78 3.3.1.1 Khởi tạo đối tượng Simulator 78 3.3.1.2 Các lập lịch kiện 78 3.3.1.3 Các phương thức khác 83 3.3.1.4 Tóm tắt 83 3.3.2 Cấu hình Node 84 3.3.2.1 Tạo Node 84 3.3.2.2 Cấu hình cho MobileNode 84 3.3.2.3 Cấu hình cho Base-Station Node 85 3.3.2.4 Bảng tóm tắt tham số cấu hình cho Node 85 3.3.3 Tạo liên kết cho Node 87 3.4 Các Agent NS-2 88 3.4.1 Giới thiệu 88 3.4.2 UDP Agent 89 3.4.3 TCP Agent 91 3.4.3.1 Một số TCP agent bên gởi 92 3.4.3.1.1 TCP Tahoe 92 3.4.3.1.2 TCP Reno 93 3.4.3.1.3 TCP Newreno 94 3.4.3.2 Một số TCP agent bên nhận 94 3.4.3.3 TCP agent hai chiều 95 3.4.4 Các ví dụ minh họa 96 3.5 Ứng dụng NS-2 97 3.5.1 Lớp Application 97 3.5.2 Phân loại ứng dụng 97 3.5.2.1 Ứng dụng phát sinh lưu lượng mạng 98 3.5.2.2 Ứng dụng giả lập mạng 99 3.5.3 Các ví dụ minh họa 100 3.6 Mạng không dây NS-2 101 3.6.1 Các thành phần cấu hình MobileNode 101 3.6.2 Tạo mơ hình mạng khơng dây NS-2 101 3.6.3 Tạo kịch chuyển động cho Node 103 3.6.4 Giao thức định tuyến cho mạng không dây 104 3.6.4.1 Giới thiệu tổng quan 104 3.6.4.2 Giao thức định tuyến TORA 106 3.6.4.3 Giao thức định tuyến DSDV 108 3.6.4.4 Giao thức định tuyến DSR 110 3.6.4.5 Giao thức định tuyến AODV 112 Chương Ngôn ngữ TCL 117 4.1 Tổng quan số đặc điểm ngôn ngữ TCL 117 4.2 Cú pháp TCL 118 4.2.1 Khai báo biến mảng 118 4.2.2 Các biểu thức toán học TCL 119 4.2.3 Thay lập nhóm 120 4.2.3.1 Thay 120 4.2.3.2 Lập nhóm 121 4.2.4 Cấu trúc điều khiển 121 4.2.4.1 Điều kiện if 121 4.2.4.2 Vòng lặp for 121 4.2.4.3 Vòng lặp while 122 4.2.4.4 Thủ tục 122 4.2.4.5 Tập lệnh TCL 124 4.2.4.5.1 Nhóm lệnh điều khiển 124 4.2.4.5.2 Nhóm lệnh kiện 125 4.2.4.5.3 Nhóm lệnh file 125 4.2.4.5.4 Nhóm lệnh danh sách 126 4.2.4.5.5 Nhóm lệnh xử lý chuỗi 127 4.2.4.5.6 Nhóm lệnh xử lý biến 127 4.2.4.5.7 Nhóm lệnh thời gian 128 Chương Ngôn ngữ hướng đối tượng Otcl 133 5.1 Otcl ngôn ngữ hướng đối tượng TCL 133 5.2 Lớp đối tượng Otcl 133 5.3 Phương thức khởi tạo hủy cho lớp 133 5.4 Khai báo phương thức cho lớp 134 5.5 Khai báo thành phần liệu 135 B Giới thiệu công cụ phát sinh Topology mạng 137 Phần Các công cụ hổ trợ ngôn ngữ DML 137 Chương DMLEditor 138 6.1 Giới thiệu 138 6.2 Các tính bật DMLEditor 138 6.3 Các bước cài đặt DMLEditor 138 6.4 Quá trình thiết kế DMLEditor 139 Chương RacewayViewer 143 7.1 Giới thiệu 143 7.2 Các tính bật RacewayViewer 143 7.3 Các bước cài đặt RacewayViewer 143 7.4 Quá trình thiết kế RacewayViewer 144 Chương NetViewer 148 8.1 Giới thiệu 148 8.2 Các tính bật NetViewer 148 8.3 Các bước cài đặt NetViewer 148 8.4 Quá trình thiết kế NetViewer 149 Phần Các công cụ hổ trợ ngôn ngữ TCL 155 Chương BRITE 155 9.1 Thiết kế cài đặt BRITE 155 9.1.1 Download cài đặt BRITE 156 9.1.2 Giao diện GUI 158 9.1.3 Giao diện dòng lệnh 158 9.1.4 Các file cấu hình 159 9.1.5 Định dạng output BRITE 160 9.2 Kiến trúc BRITE 162 9.2.1 Qui trình làm viêc BRITE 162 9.2.2 Kiến trúc BRITE 162 9.2.2.1 Lớp Model 163 9.2.2.1.1 Mơ hình đẳng cấp Router-level 164 9.2.2.1.2 Mơ hình đẳng cấp AS-level 166 9.2.2.1.3 Mơ hình phân cấp top-down 166 9.2.2.1.4 Mơ hình phân cấp botton-up 167 9.2.2.1.5 Mơ hình Imported File 167 9.3 Các tham số giao diện BRITE 168 9.4 Hạn chế BRITE 170 Chương 10 NS-2 NAM 171 10.1 Cài đặt NS-2 NAM Window 171 10.1.1 Download NS-2 NAM 171 10.1.2 Cài đặt NS-2 171 10.1.3 Chạy NS-2 NAM 172 10.2 Cài đặt NS-2 NAM Linx 173 10.2.1 Download NS-2 NAM 173 10.2 Cài đặt 174 10.2.3 Chạy NS-2 NAM 175 Phần Các công cụ khác 176 Chương 11 Otter 176 11.1 Giới thiệu 176 11.2 Các tính bật Otter 176 11.3 Các bước cài đặt Otter 177 11.4 Quá trình thiết kế Otter 178 C Xây dựng chương trình ứng dụng BRITE 182 Phần Cơ sở lý thuyết 182 Chương 12 Lý thuyết mạng không dây 183 12.1 Giới thiệu 183 12.1.1 Mạng không dây cố định 184 12.2.2 Mạng không dây di động 185 12.2 Mạng MANET 185 12.2.1 Tổng quan mạng MANET 185 12.2.2 Phân loại mạng MANET theo cách thức định tuyến 186 12.2.2.1 Mạng MANET định tuyến Single-hop 186 12.2.2.2 Mạng MANET định tuyến Multi-hop 186 12.2.2.3 Mơ hình MANET định tuyến MobileMulti-hop 187 12.2.3 Phân loại mạng MANET theo chức Node 187 10 PHỤ LỤC Một số ví dụ minh họa ngơn ngữ DML TCL Minh họa ngôn ngữ DML (A Switched-Shared-LAN): # -Mơ hình Topology # # C0 -| # C1 -| # C2 -| // S0 # C3 -| // S1 # C4 -| R1 R2 | # C5 -| \\ S3 # C6 -| \\ S4 # C7 -| # -# Net [ frequency 1000000000 randomstream [ generator MersenneTwister stream "seed starter" reproducibility_level timeline ] # -define the two router R1 and R2 -# router [ id graph [ ProtocolSession [ name ip use SSF.OS.IP ] ] interface [ id buffer 192000 _extends dictionary.1Gbps ] 212 interface [ id buffer 192000 _extends dictionary.100Mbps ] route [ dest default interface ] ] router [ id graph [ ProtocolSession [ name ip use SSF.OS.IP ] ] interface [ id buffer 192000 _extends dictionary.1Gbps ] interface [ idrange [ from to ] buffer 192000 _extends dictionary.100Mbps ] route [ dest default interface ] ] # -Define a shared LAN of clients -# host [ idrange [ from 100 to 107 ] _extends dictionary.TCPRenoTestClient ] # -Define a switched LAN of servers # host [ idrange [ from 201 to 205 ] _extends dictionary.TCPRenoTestServer ] # -Define Network Connections # 213 link [ attach 1(0) attach 2(0) delay 0.0005 ] link [attach 1(1) attach 100(0) attach 101(0) attach 102(0) attach 103(0) attach 104(0) attach 105(0) attach 106(0) attach 107(0) ] link [ attach 2(1) attach 201(0) delay 0.000005 ] link [ attach 2(2) attach 202(0) delay 0.000005 ] link [ attach 2(3) attach 203(0) delay 0.000005 ] link [ attach 2(4) attach 204(0) delay 0.000005 ] link [ attach 2(5) attach 205(0) delay 0.000005 ] # -Define Traffic: A client requests files from servers -# traffic [ pattern [client 100 servers [ nhi_range [ from 201(0) to 202(0) ] port 8080] ] pattern [client 101 servers [nhi_range [ from 203(0) to 205(0) ] port 8080] ] pattern [client 102 servers [nhi_range [ from 202(0) to 204(0) ] port 8080] ] pattern [client 103 servers [ nhi_range [ from 201(0) to 205(0) ] port 8080] ] pattern [ client 104 servers [nhi_range [ from 201(0) to 205(0) ] port 8080 ] ] pattern [client 105 servers [ nhi_range [ from 202(0) to 204(0) ] port 8080 ] ] pattern [client 106 servers [ nhi_range [ from 201(0) to 203(0) ] port 8080 ] ] pattern [ client 107 servers [ nhi_range [ from 201(0) to 205(0) ] port 8080 ] ] ] 214 # end Traffics ] # end Net # -Define dictionary # dictionary [ # Standard Interfaces 100Mbps [bitrate 100000000 # bits/s latency 0.00001 # per packet proc delay, in sec ] 622Mbps [bitrate 622000000 # bits/s latency 0.0001 # per packet proc delay, in sec ] 1Gbps [bitrate 1000000000 # bits/s latency 0.0001 # per packet proc delay, in sec ] single_homed_host [ interface [ id _extends dictionary.100Mbps ] ] TCPRenoTestClient [ _extends dictionary.single_homed_host nhi_route [ dest default interface next_hop 1(1)] #Define client protocol stack graph [ ProtocolSession [ name client use SSF.OS.TCP.test.tcpClient start_time 10.0 # Time to send request (sec) start_window 0.0 # make start time deterministic file_size 10000000 # bytes to be downloaded request_size 100 # client request size in bytes show_report true # show debugging information debug true ] ProtocolSession [ name socket use SSF.OS.Socket.socketMaster ] ProtocolSession [ name tcp use SSF.OS.TCP.tcpSessionMaster 215 _find dictionary.tcpinit ] ProtocolSession [ name ip use SSF.OS.IP ] ] # end of Protocol Graph ] # End of TCPRenoTestClient TCPRenoTestServer [ _extends dictionary.single_homed_host route [ dest default interface ] graph [ ProtocolSession [ name server use SSF.OS.TCP.test.tcpServer # Server configuration port 8080 client_limit 1024 request_size 100 # client request size in bytes show_report true # show debugging information debug true ] ProtocolSession [ name socket use SSF.OS.Socket.socketMaster ] ProtocolSession [ name tcp use SSF.OS.TCP.tcpSessionMaster _find dictionary.tcpinit ] ProtocolSession [ name ip use SSF.OS.IP ] ] # end of Protocol Graph ] # end of server definition # TCP Initial parameters tcpinit [ ISS MSS 1460 SendBufferSize 64 216 RcvWndSize 64 AdvertisedWnd 10000 MaxConWnd 10000 conThresh 10000 fast_recovery true delayed_ack true TCP_FAST_INTERVAL 0.500 show_report true ] ] # End of dictionary Minh họa ngôn ngữ TCL (A wired-cum-wireless Network): # Define Options # global val set val(chan) Channel/WirelessChannel ;#channel type set val(prop) Propagation/TwoRayGround ;#radio-propagation model set val(ant) Antenna/OmniAntenna ;#Antenna type set val(add) hierarchical ;#Addressing type set val(ll) LL ;#Link layer type set val(ifq) Queue/DropTail/PriQueue ;#Interface queue type set val(ifqlen) 50 ;#max packet in ifq set val(netif) Phy/WirelessPhy ;#network interface type set val(mac) Mac/802_11 ;#MAC type set val(rp) DSDV ;#ad-hoc routing protocol set val(nn) ;#number of mobilenodes set val(bs) ;#number of bsnodes set val(wn) ;#number of wirenodes set val(x) 500 ;#X-cordinate set val(y) 500 ;#Y-cordinate 217 set val(seed) 0.0 ;# seed for random number gen # -Check for boundary parameters and random seed if {$val(x) == || $val(y) == 0} { puts "No X-Y boundary values given for wireless topology\n" } if {$val(seed) > 0} { puts "Seeding Random number generator with $val(seed)\n" ns-random $val(seed) } set ns_ [new Simulator] # -Set up for hierarchical routing $ns_ node-config -addressType hierarchical AddrParams set domain_num_ ;#number of domains lappend cluster_num 1 ;#so cluster moi domain AddrParams set cluster_num_ $cluster_num lappend eilastlevel 1 ;#so node moi cluster AddrParams set nodes_num_ $eilastlevel set tracefd [open /home/wire_wireless.tr w ] $ns_ trace-all $tracefd set namtracefd [open /home/wire_wireless.nam w ] $ns_ namtrace-all-wireless $namtracefd $val(x) $val(y) # -Set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) # -Create God create-god [expr $val(nn) + $val(bs)] # -Create and configure wired Nodes set temp {0.0.0 0.1.0} ;#hierachical addresses for wired domain for {set i 0} {$i < $val(wn)} {incr i} { 218 set W($i) [$ns_ node [lindex $temp $i]] } # -Configure for base-station Nodes $ns_ node-config -adhocRouting DSDV \ -llType LL \ -macType Mac/802_11 \ -propInstance [new $val(prop)] \ -ifqType Queue/DropTail/PriQueue \ -ifqLen $val(ifqlen) \ -phyType Phy/WirelessPhy \ -antType Antenna/OmniAntenna \ -channel [new $val(chan)] \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace ON \ -wiredRouting ON \ set temp_1 { 1.0.0 1.0.1 1.0.2 1.0.3 } set BS_(0) [$ns_ node [ lindex $temp_1 0]] $BS_(0) random-motion set temp_2 { 2.0.0 2.0.1 2.0.2 } set BS_(1) [$ns_ node [ lindex $temp_2 0]] $BS_(1) random-motion # -Configure for wireless nodes $ns_ node-config -wiredRouting OFF # -Configure for the wireless nodes that have the same configuration $ns_ node-config -adhocRouting DSDV \ -addressingType hierarchical \ -llType LL \ 219 -macType Mac/802_11 \ -propType Propagation/TwoRayGround \ -ifqType Queue/DropTail/PriQueue \ -ifqLen 50 \ -phyType Phy/WirelessPhy \ -antType Antenna/OmniAntenna \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace ON \ -movementTrace ON \ for {set j 0} {$j < 3} {incr j} { set node_($j) [$ns_ node [lindex $temp_1 [expr $j + 1-0]]] $node_($j) base-station [AddrParams addr2id [$BS_(0) node-addr]] $node_($j) random-motion ; #Disable random motion } for {set j 3} {$j < 5} {incr j} { set node_($j) [$ns_ node [lindex $temp_2 [expr $j + 1-3]]] $node_($j) base-station [AddrParams addr2id [$BS_(1) node-addr]] $node_($j) random-motion } $node_(0) label "W0" $node_(0) set X_ 374.0 $node_(0) set Y_ 466.0 $node_(0) set Z_ 0.0 $node_(1) label "W1" $node_(1) set X_ 342.0 $node_(1) set Y_ 454.0 $node_(1) set Z_ 0.0 220 ; #Disable random motion $node_(2) label "W2" $node_(2) set X_ 309.0 $node_(2) set Y_ 427.0 $node_(2) set Z_ 0.0 $node_(3) label "W3" $node_(3) set X_ 239.0 $node_(3) set Y_ 244.0 $node_(3) set Z_ 0.0 $node_(4) label "W4" $node_(4) set X_ 65.0 $node_(4) set Y_ 479.0 $node_(4) set Z_ 0.0 $BS_(0) label "BS0" $BS_(0) set X_ 178.0 $BS_(0) set Y_ 29.0 $BS_(0) set Z_ 0.0 $BS_(1) label "BS1" $BS_(1) set X_ 483.0 $BS_(1) set Y_ 47.0 $BS_(1) set Z_ 0.0 $ns_ at 52.18422 "$node_(0) setdest 394.0 284.0 11.0" $ns_ at 62.195705 "$node_(1) setdest 442.0 480.0 65.0" $ns_ at 84.75359 "$node_(2) setdest 1.0 382.0 86.0" $ns_ at 75.980675 "$node_(3) setdest 441.0 445.0 22.0" $ns_ at 38.467274 "$node_(4) setdest 195.0 32.0 69.0" $ns_ at 19.1865 "$node_(0) setdest 431.0 193.0 69.0" $ns_ at 51.863335 "$node_(1) setdest 193.0 145.0 93.0" $ns_ at 40.75516 "$node_(2) setdest 204.0 459.0 11.0" 221 $ns_ at 92.63895 "$node_(3) setdest 478.0 128.0 69.0" $ns_ at 45.802128 "$node_(4) setdest 30.0 68.0 56.0" # -Create links between wired and bs nodes $ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail $ns_ duplex-link-op $W(0) $W(1) orient down $ns_ duplex-link $W(1) $BS_(0) 5Mb 2ms DropTail $ns_ duplex-link-op $W(1) $BS_(0) orient down $ns_ duplex-link $W(1) $BS_(1) 5Mb 2ms DropTail $ns_ duplex-link-op $W(1) $BS_(1) orient down # -Protocol and Application connections between node_(0) and w_(0) set TCP0_0 [new Agent/TCP] $TCP0_0 set class_ set sink0_0 [new Agent/TCPSink] $ns_ attach-agent $node_(0) $TCP0_0 $ns_ attach-agent $W(0) $sink0_0 $ns_ connect $TCP0_0 $sink0_0 set App0_0 [new Application/FTP] $App0_0 attach-agent $TCP0_0 $ns_ at 10 "$App0_0 start" $ns_ at 100 "$App0_0 stop" # -Protocol and Application connections between node_(3) and node_(1) set TCP3_1 [new Agent/TCP] $TCP3_1 set class_ set sink3_1 [new Agent/TCPSink] $ns_ attach-agent $node_(3) $TCP3_1 $ns_ attach-agent $node_(1) $sink3_1 $ns_ connect $TCP3_1 $sink3_1 set App3_1 [new Application/FTP] 222 $App3_1 attach-agent $TCP3_1 $ns_ at 10 "$App3_1 start" $ns_ at 100 "$App3_1 stop" # -Define the node size in nam, must adjust it according to your scenario for {set i 0} {$i < $val(nn)} {incr i} { $ns_ initial_node_pos $node_($i) 40 } # -Tell all nodes when the simulation ends for {set i 0} {$i

Ngày đăng: 07/09/2020, 17:00

Xem thêm:

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

TÀI LIỆU LIÊN QUAN

w