210 likes | 414 Views
The Monarch Project Wireless and Mobility Extensions to ns. Wireless/Mobile Network Lab 임 상 택. Table of contents. 1. Preface 2. Overview 3. Provided components 4. Mobile node organization 4.1. outgoing packet 4.2. incoming packet 5. Building the simulator 6. Using the simulator
E N D
The Monarch Project Wireless and MobilityExtensions to ns Wireless/Mobile Network Lab 임 상 택
Table of contents 1. Preface 2. Overview 3. Provided components 4. Mobile node organization 4.1. outgoing packet 4.2. incoming packet 5. Building the simulator 6. Using the simulator 6.1. 실행개요 6.2. communication pattern 파일 6.3. movement pattern 파일 6.4. simulation 결과 추적 7. Ad-hockey
1. Preface • CMU Monarch Project는 현재 Rice University에서 Rice Monarch Project로 진행 중 • Monarch ns는 VINT ns-2 network simulator를 확장 • 무선 subnets, LANs, Multi-hop ad hoc network 상의 이동 노드들을 정확하고 세부적으로 시뮬레이션 할 수 있다. • 유선과 무선 부분 모두 시뮬레이션이 가능 • Monarch ns는 시각화 도구(visualization tool)로 ad-hockey 프로그램을 사용한다. • ad-hockey를 이용하여 scenario 파일의 생성, 편집, 재생 및 simulator로 수행 결과 생성되는 trace 파일의 시각화로 simulation 결과 이해가 용이하다. • CMU ns는 계산의 용이를 위해 “node들은 packet을 송신하거나 수신하는 시간 길이 동안 두드러지게(significantly) 이동하지 않는다”고 가정한다. • Monarch Project : http://www.monarch.cs.rice.edu/ • VINT Project : http://www.isi.edu/nsnam/vint/index.html
MobileNode MobileNode MobileNode Channel Figure 1 Logical overview of how mobile nodes are connected under the Monarch wireless extensions to ns. 2. Overview • 이동노드(Mobile Node)는 독립적인 개체(entity)로 자신의 위치(position), 속도(velocity) 계산을 책임진다. • 이동노드는 채널(channel)에 연결된 하나 또는 그 이상의 NI(network interface)를 가진다. • 같은 형태의 NI는 하나의 채널로 연결되어야 한다. 만약 노드가 다른 형태의 NI를 가지고 있다면 다른 채널들로 연결될 수 있다. • 채널은 이동노드들 사이에서 packet을 나르는 도관(conduit) 역할을 한다. • 개념적으로, 채널은 특정 변조(modulation)와 부호화방식(coding scheme)을 가지는 특정 주파수를 나타낸다. • 노드에서 채널로 packet이 보내지면, 채널은 채널상의 다른 모든 NI로 그 packet의 사본(copy)을 분배한다. • 그 때, NI들은 radio propagation model을 사용, 실제 packet의 수신 여부를 결정한다. • 채널들은 orthogonal로 다루어져 서로 다른 채널간의 packet 송수신은 서로 간섭을 받지 않는다.
3. Provided Components • Physical Layer • Radio Propagation Models • Two Ray Ground Reflection Approximation: 가까운 거리에서는 Friss 자유공간 감쇄 (1/r2), 먼 거리에서는 Two Ray Ground (1/r4) 근사치를 이용한다. • Antennas • Omni-Directional: A unity gain omni-directional antenna • Network Interfaces • Shared Media : 충돌(collision)과 propagation model에 영향을 받기 쉬운 shared media를 사용. 각 node는 다른 node들이 보낸 packet들을 엿들을(overhear) 수 있다. 기본 인자는 Lucent WaveLAN DSSS(Direct-Sequence Spread-Spectrum) 무선 인터페이스와 유사하다. • Link Layer • MAC(Media Access Control) Protocols • IEEE 802.11: IEEE 802.11 DCF(Distributed Coordination Function) MAC protocol. Unicast packet들은 “RTS/CTS/Data/ACK” pattern을 사용하고 Broadcast packet들은 “Data” pattern을 사용한다. • CSMA: collision detection이 없음 • ARP • Network Layer • Routing Protocols • Dynamic Source Routing(DSR), Destination Sequenced Distance Vector(DSDV), Temporally Ordered Routing Algorithm (TORA), Ad hoc On-demand Distance Vector (AODV)
Portdemux addrdemux Src/Sink 255 entry ip addr default RTagent Ll_(0) recvtarget arptable ARP LL mac sendtarget IFq MAC sendtarget recvtarget PropModel NetIF Propagation_ channel Channel Figure 2 Schematic of a mobile node under the Monarch wireless extensions to ns. 4. Mobile Node Organization(cont.) AGT send trace AGT recv trace RTR send trace RTR recv trace MAC recv trace MAC send trace
4.1. Outgoing Packets Source에 의해 보내진 packet들은 mobile node의 entry point로 건네지고 address demultiplexer로 보내진다. Address demux는 packet의 목적지 IP 주소를 검사해 자신의 IP 주소와 일치 시, packet을 port demux로 올려보낸다. Packet은 보통 다른 노드로 보내지므로 routing protocol로 내려 보내진다. Routing protocol은 packet의 헤더에 다음 노드의 주소를 가리키는 next_hop 필드를 설정하고, packet을 LL(link layer)로 보낸다. Next_hop 주소가 IP주소이면, LL 객체는 IP주소를 하드웨어 주소로 변환하기 위해 ARP 객체에 질의한다. ARP 객체가 해당 IP주소를 모르면, packet을 큐에 넣고 LL객체가 ARP Request packet을 보내도록 지시할 것이다. 하드웨어 주소를 알아내고 packet을 IFq(interface queue)에 삽입한다. MAC 객체는 interface queue에서 packet을 가져와 NetIF(networking interface)로 보낸다. NetIF는 power, 전송하는 인터페이스의 위치 등과 같은 속성을 packet의 헤더에 날인한 후 channel로 보낸다. Channel은 채널상의 다른 모든 interface를 위한 사본을 생성한다. 4. Mobile Node Organization(cont.)
4. Mobile Node Organization 4.2. Incoming Packets • channel로 보내진 각 packet의 사본은 channel상의 각 network interface로 전달된다. 그 시간에 packet의 첫번째 bit는 각 node들 사이의 거리와 빛의 속도를 기반으로 interface에 도착하기 시작한다. • 각 network interface는 수신 interface의 속성을 packet에 날인하고 Prop Model (propagation model)을 부른다. • Prop Model은 packet을 수신할 interface가 가지는 power를 결정하기 위해 transmit and receive stamps와 수신 interface의 속성을 이용한다. • 그 다음에 수신 network interface는 실제로 packet을 성공적으로 수신하는지 결정하기 위해 그 속성들을 이용한다. 수신했다면 packet은 MAC layer로 건네진다. • MAC layer가 충돌과 에러가 없는 packet(collision- and error-free)을 수신하면, 그것은 mobile node의 entry point로 건네진다. • packet의 최종 목적지라면 Address demux는 packet을 port demux로 건네고, port demux는 적합한 sink agent(수신 agent)로 보낼 것이다. • 만약 최종 목적지가 아니라면, packet은 address demux의 default target으로 갈 것이고 이 node에서 routing agent는 packet의 다음 hop을 할당하기 위해 호출 될 것이며 packet은 다시 link layer로 보내질 것이다.
5. Building The Simulator(cont.) • 환경 • OS: Linux 2.4.2-2wl (redhat 7.1), Compiler: Gcc 2.96, Perl: 5.6.0 • VINT project NS-2 • CMU ns를 설치하기 위해서는 먼저 ns-2를 설치해야 한다. • Monarch extensions에 가장 적합한 ns-2 버전은 ns-allinone-2.1b3 이다. • 알려진 설치 문제와 해결책 : http://www.isi.edu/nsnam/ns/ns-problems.html • ns-allinone은 ns-2, otcl, TclCL, tcl8.0, tk8.0 등의 프로그램을 포함한다. • $./install • 설치 완료 후 실행을 위해 환경변수 추가 • MY_NS_HOME=$HOME/tmp/ns-allinone-2.1b3 • PATH=$PATH:/sbin:/usr/sbin:$HOME/bin:$MY_NS_HOME/bin • LD_LIBRARY_PATH=$MY_NS_HOME/otcl • BASH_ENV=$HOME/.bashrc • export BASH_ENV PATH LD_LIBRARY_PATH
5. Building The Simulator • cmu-extendedns-1.1.2 • VINT NS 설치 directory에 tar 해제 • $cd ns-src • $cp ./../ns-2/configure configure-2 • $./configure-2 • $make depend; make • Perl/Tk800.015 • Ad-hockey runs with Perl/Tk800.015 • Perl/Tk: http://perl.com/CPAN/modules/by-authors/Nick_Ing-Simmons/ • Perl/Tk FAQ: http://w4.lns.cornell.edu/~pvhp/ptk/ptkTOC.html • $perl Makefile.PL • $make • $make test • #make install (root user) • ad-hockey 설치 • ad-hockey 디렉토리로 이동 • $ make what-time • ad-hockey, what-time, viz-trace를 실행하기 편한 디렉토리로 이동
6. Using The Simulator (cont.) 6.1. 실행 개요 • movement 패턴 파일: 시뮬레이션 동안 발생하는 노드들의 이동성(movement) 기술, 또한 역사적인(historical) 이유로 시나리오 파일로 불린다. • communication 패턴 파일: 시뮬레이션 동안 network layer에 제공되는 packet 작업(workload)을 기술 • router configuration 파일: 시뮬레이션 동안 사용되는 ad hoc network routing 프로토콜을 정의 • 실행 예 $ ./ns cmu/scripts/run.tcl -rp cmu/dsr/dsr.tcl -x 800 -y 800 -cp cbr-3-2-10-512 -sc scen-800x800-3-0-10 -nn 3 -stop 300 -tr my_out.tr • run.tcl(OTcl script) 옵션 -x #X dimension of the topography -y #Y dimension of the topography -cp # Communication file -sc # Scenario file -rp # Routing protocol script -nn # number of node -stop # simulation time -tr # trace file
6. Using The Simulator (cont.) 6.2. Communication pattern 파일 Mobile Node로 실제 packet을 주고받는 agent를 생성(create), 설정(configure), 조정(control)하는 명령어들을 두는 곳(Tcl code를 포함) 6.2.1. Communication pattern 파일을 만드는 방법 • Tcl script를 이용하여 작성 • TCP와 CBR(Constant Bit Rate) connection을 생성 $ ns cmu/scripts/cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate] • TCP connection을 생성 $ ns cmu/scripts/tcpgen.tcl [-nn nodes] [-seed seed] • Ad-hockey를 이용하여 작성 • “Construction-Tools → SchedulePackets” menu • 파일 이름 규칙 • cbr-[num nodes]-[num connections]-[pkts per sec]-[pkt size]
6. Using The Simulator (cont.) 6.2.2. Communication pattern 파일 예제 • cbr-3-2-10-512 파일 # 15.500000 2 -> 3 cbr 10 10.000000 512 # From node 2 to node 3, Number pkts: 10, Pkts per sec: 10, Pkt size(bytes): 512 set cbr_(0) [$ns_ create-connection CBR $node_(2) CBR $node_(3) 0] $cbr_(0) set packetSize_ 512 $cbr_(0) set interval_ 0.1 $cbr_(0) set random_ 0 $cbr_(0) set maxpkts_ 10 $ns_ at 15.5 "$cbr_(0) start" # 40.100000 3 -> 1 tcp 1024 512 # From node 3 to node 1, Number bytes: 1024, Pkt size(bytes): 512 set tcp_(1) [$ns_ create-connection TCP/Reno $node_(3) TCPSink/DelAck \ $node_(1) 0] $tcp_(1) set packetSize_ 512 set ftp_(1) [$tcp_(1) attach-source FTP] $ftp_(1) set maxpkts_ 2 $ns_ at 40.1000000000003 "$ftp_(1) start“
6. Using The Simulator (cont.) 6.3. Movement pattern 파일 6.3.1. Movement pattern 파일을 만드는 방법 • cmu/setdest/setdest 프로그램을 이용하여 작성 • MobiCom’98 에서 설명한 Random Waypoint algorithm을 이용 $ ./setdest [-n num_of_nodes] [-p pausetime] [-s maxspeed] [-t simtime] [-x maxx] [-y maxy] > [outdir/movement-file] • Ad-hockey를 이용하여 작성 • “Construction-Tools → Add Node” menu • cmu/setdest/calcdest 프로그램: setdest에 의해 자동 생성된 파일은 ad-hockey로 만든 movement pattern 파일과 다르다. 그 이유는 setdest에 의해 생성된 파일에는 임의의 두 node 사이의 가장 짧은 경로의 길이를 설명하는 god(general operations director) 정보가 없기 때문이다. Shortest-path 분석을 수행하고 싶다면 god 정보를 파일에 넣기 위해서 calcdest 프로그램을 사용한다. $ ./calcdest [-n <nodes>] [-t <simulation time>] -i <input_file> -o <output file> • 파일 이름 규칙 • scen-[site size]-[num nodes]-[pause time]-[max velocity]-[scen num]
6. Using The Simulator (cont.) 6.3.2. Movement pattern 파일 예 # nodes: 3, max time: 300.000000, max x: 800.000000, max y: 800.000000 # nominal range: 250.000000 link bw: 2000000.000000 # comm pattern: # background bitmap: 0 0 $ns_ at 50.911688245 "$node_(1) setdest 472.000000000 472.000000000 1.000000000" $ns_ at 0.000000000 "$node_(1) setdest 436.000000000 436.000000000 1.000000000" $node_(1) set Z_ 0.0 $node_(1) set Y_ 400.000000000 $node_(1) set X_ 400.000000000 .. 생략 .. $god_ set-dist 2 3 2 .. 생략 .. # Destination Unreachables: 0 # Route Changes: 0 # Link Changes: 0 # Node | Route Changes | Link Changes # 1 | 0 | 0 # 2 | 0 | 0
6. Using The Simulator (cont.) 6.3.3. Movement pattern 파일 설명 • ad-hockey 와 run.tcl 에 정보 제공 # nodes: 3, max time: 300.000000, max x: 800.000000, max y: 800.000000 # nominal range: 250.000000 link bw: 2000000.000000 # comm pattern: # background bitmap: 0 0 • Simulation 시간 50초에 node 1이 site 좌표 (472, 472)로 1.0 m/s의 속도로 이동 시작 $ns_ at 50.911688245 "$node_(1) setdest 472.000000000 472.000000000 1.000000000“ • node 1의 시작 위치 (400,400,0) $node_(1) set Z_ 0.0 $node_(1) set Y_ 400.000000000 $node_(1) set X_ 400.000000000 • node 2와 node 3 사이의 가장 짧은 경로는 2 hop $god_ set-dist 2 3 2 • 시간 899초에 node 23과 node 46 사이의 가장 짧은 경로가 2 hop 으로 변화 $ns_ at 899.642 "$god_ set-dist 23 46 2"
6. Using The Simulator (cont.) 6.4. Simulation 결과 추적 • Trace 파일 헤더 M 0.0 nn 3 x 800 y 800 rp cmu/dsr/dsr.tcl M 0.0 sc scen-800x800-3-0-10-1 cp cbr-3-2-10-512 seed 0.0 M 0.0 prop Propagation/TwoRayGround ant Antenna/OmniAntenna • Log File Entry Types • Packet Motion (s,r,D or f) <Type> <Time> <Node id> <Level> <Drop reason> <Uid> <pkt type> <len> [<mac hdr>] ------- [<ip addrs>] <stuff> • <Type> • s = packet sent, r = packet received, D = packet dropped, f = packet forwarded • <Level> - tracer가 가리키는 위치. • AGT(Agent Level), RTR(Routing Trace Level), MAC(MAC Level) • <Uid> – unique packet id • <Pkt type> • message: DSDV routing packets • cbr, tcp: data packets • DSR, TORA, IMEP, AODV: routing protocol packets • <stuff> - extra information that is specific to the particular packet type • ns-src/cmu/cmu-trace.cc 참조
6. Using The Simulator (cont.) • Motion (M) • M = movement of nodes (logged when a node changes direction) • M TIME NODE (current X, Y, Z), (destination X, Y, Z), SPEED M 0.00000 1 (400.00, 400.00, 0.00), (436.00, 436.00), 1.00 M 0.00000 2 (400.00, 200.00, 0.00), (400.00, 236.00), 1.00 M 0.00000 3 (400.00, 600.00, 0.00), (400.00, 623.00), 1.00 • DSR (S*) • S* = DSR information of some type • Sconfig = basic node configuration • SRC = route cache performance analysis messages • SRR = DSR route discovery • SF = packet forwarded according to source route Sconfig 0.00000 tap: on snoop: rts? on errs? on SF 15.557631604 _3_ --- 3 [3 -> 2] [|3 1 2 ] SF 15.560097274 _1_ --- 3 [3 -> 2] [3 |1 2 ] • TORA (T*) • T* = tora information
6. Using The Simulator (cont.) • Trace 파일 예 M 0.0 nn 3 x 800 y 800 rp cmu/dsr/dsr.tcl M 0.0 sc /testroom/scen-800x800-3-0-10-1 cp /testroom/cbr-3-2-10-512 seed 0.0 M 0.0 prop Propagation/TwoRayGround ant Antenna/OmniAntenna Sconfig 0.00000 tap: on snoop: rts? on errs? on Sconfig 0.00000 salvage: on !bd replies? on Sconfig 0.00000 grat error: on grat reply: on Sconfig 0.00000 $reply for props: on ring 0 search: on Sconfig 0.00000 using MOBICACHE M 0.00000 1 (400.00, 400.00, 0.00), (436.00, 436.00), 1.00 s 15.500000000 _2_ AGT --- 0 cbr 512 [0 0 0 0 0] ------- [2:0 3:0 32 0] [0] 0 2 r 15.500000000 _2_ RTR --- 0 cbr 512 [0 0 0 0 0] ------- [2:0 3:0 32 0] [0] 0 2 s 15.506788647 _2_ RTR --- 1 DSR 24 [0 0 0 0 0] ------- [2:255 3:255 32 0] 1 [1 1 0] [0 1 0 0->0] [0 0 0 0->0] s 15.506866936 _2_ MAC --- 1 DSR 76 [20 0 ffffffff 2 800] ------- [2:255 3:255 32 0] 1 [1 1 0] [0 1 0 0->0] [0 0 0 0->0] f 15.556830309 _1_ RTR --- 2 DSR 32 [20 0 ffffffff 2 800] ------- [2:255 3:255 32 0] 2 [1 2 16] [0 2 0 0->0] [0 0 0 0->0] r 15.557285883 _3_ RTR --- 2 DSR 32 [20 0 ffffffff 1 800] ------- [2:255 3:255 32 0] 2 [1 2 16] [0 2 0 0->0] [0 0 0 0->0] SF 15.557631604 _3_ --- 3 [3 -> 2] [|3 1 2 ] s 15.558216177 _1_ MAC --- 0 MAC 44 [1b 28f 3 1 0] r 15.558392860 _3_ MAC --- 0 MAC 44 [1b 28f 3 1 0] r 40.308286076 _3_ AGT --- 16 ack 40 [20 a3 3 1 800] ------- [1:0 3:1 32 3] [1 0] 1 1 r 40.308404877 _1_ MAC --- 0 MAC 38 [1d 0 1 0 0] M 50.91169 1 (436.00, 436.00, 0.00), (472.00, 472.00), 1.00
7. Ad-hockey (cont.) • Ad-hockey란? • Monarch extensions to ns에 의해 사용되는 scenario 파일의 생성과 simulation trace 파일의 시각화(visualization)를 돕는 Perl/Tk 프로그램 • Ad-hockey에서 재생을 위해 출력된 trace 파일(e.g. out.tr)을 로딩 전 viz-trace 프로그램으로 처리(e.g. out.tr.viz) • ad-hockey 윈도우의 크기가 적합하지 않다면, 다음의 변수를 변경. 만약 배경 이미지 파일을 사용한다면 이미지 파일의 크기에 맞게 생성 my $SCREENX = 1200; my $SCREENY = 600; • 사용법 ad-hockey [args] [<scenario file>] [<trace file>] viz-trace <input-trace-file> <output-trace-file> ※ Teresa Yan pointed out this bug and provided the fix. ad-hockey doesn't know how to display MAC events. She updated viz-trace to remove the MAC events from the replay trace. < if (/^[srf] /) { > if (/^[srf] / && !/MAC/) {
“site” node1 node2 node3 “slowdown scroller”재생시 실제시간과 시뮬레이션 시간 사이의 비율을 조정 “color panel”4개까지 노드에 색상 지정 가능 “message window”현재 simulation 시간 등 상태 및 정보 표시 7. Ad-hockey Hold Button-2 and drag in the site: pointer의 현재 위치를 메시지 윈도우에 표시Enter a node with the pointer: 메시지 윈도우에 노드 이름 표시, 노란색으로 밝게 표시, 범위 표시Double Button-1 click on a node: 회색으로 노드의 중간지점(waypoint)과 궤도(trajectory) 표시, 2번 클릭 시 편집 윈도우에서 궤도 편집 가능Button-3 click: Toggle the simulator between “stop” and “start”