📄 em.tcl
字号:
# tem.tcl - test emulation# be careful here, as the tap agents will# send out whatever they are given#set dotrace 1set stoptime 20.0set me [exec hostname]set ns [new Simulator]if { $dotrace } { set allchan [open em-all.tr w] $ns trace-all $allchan set namchan [open em.nam w] $ns namtrace-all $namchan}$ns use-scheduler RealTimeset livenet1 [new Network/Pcap/Live]$livenet1 set promisc_ trueset livenet2 [new Network/Pcap/Live]$livenet2 set promisc_ trueset nd1 [$livenet1 open] ;# open some appropriate device (devname is optional)set nd2 [$livenet2 open] ;# open some appropriate device (devname is optional)puts "ok, got network devices $nd1 and $nd2"set f1len [$livenet1 filter "icmp and src $me"]set f2len [$livenet2 filter "icmp and dst $me"]puts "filter 1 len: $f1len, filter 2 len: $f2len"puts "link1 address: [$livenet1 linkaddr]"puts "link2 address: [$livenet2 linkaddr]"set a1 [new Agent/Tap]set a2 [new Agent/Tap]puts "install nets into taps..."$a1 network $livenet1#############$a2 network $livenet2set node0 [$ns node]set node1 [$ns node]$ns duplex-link $node0 $node1 8Mb 5ms DropTail## attach-agent sets "target" of the agents to the node entrypoint$ns attach-agent $node0 $a1$ns attach-agent $node1 $a2# let's detach the thingsset null [$ns set nullAgent_]###$a1 target $null###$a2 target $null$ns connect $a1 $a2puts "scheduling termination at t=$stoptime"$ns at $stoptime "exit 0"puts "let's rock"$ns run
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -