20210315 Gnuplot
課堂資料
課堂練習
建立網路拓樸



















Gnuplot


使用腳本建立 Mininet

建立腳本




















練習:安裝 P4
生成 SSH ( GitHub 新增 )











練習:安裝 Mininet-WiFi ( 失敗 )



Last updated
Was this helpful?






















建立腳本


































Last updated
Was this helpful?
Was this helpful?
cd mininetmn --link=tc,bw=10,delay=1ms,loss=5mn --link=tc,bw=10,delay='1ms',loss=0h1 ping h2xterm h1 h2iperf -s -i 1iperf -c 10.0.0.2 -t 100h1 ping -c 1000 -i 0.01 h2exitmn --link=tc,bw=10,delay='10ms',loss=2h1 ping -c 1000 -i 0.01 h2xterm h1 h2 h1 h2iperf -s -i 1 -p 5555 > tcpiperf -c 10.0.0.2 -p 5555 -t 100iperf -s -i 1 -p 6666 -u | tee udpiperf -c 10.0.0.2 -p 6666 -u -b 3M -t 100exitmn --link=tc,bw=100,delay='10ms',loss=2xterm h1 h2iperf -c -i 1 -p 5555 | tee teeiperf -c 10.0.0.2 -t 100 -p 5555exitmn --link=tc,bw=10,delay='10ms',loss=0xterm h1 h2 h1 h2iperf -c -i 1 -p 5555 | tee tcpiperf -c 10.0.0.2 -t 100 -p 5555iperf -c -i 1 -p 6666 -u | tee udpiperf -c 10.0.0.2 -p 6666 -u -b 3M -t 100exitcat tcp | grep "sec" | head -n 100 | tr "-" " " | awk '{print $4,$8}' > mytcpcat udp | grep "sec" | head -n 100 | tr "-" " " | awk '{print $4,$8}' > myudpgnuplotplot "mytcp" title "tcp_flow" with linespoints, "myudp" title "udp_flow" with linespointsset xrange [0:100]set xtics 0,10,100set yrange [0:10]set ytics 0,1,10replotset xlabel "time(sec)" set ylabel "throughput(Mbps)" replotset title "tcp vs. udp"replotset terminal "gif"set output "a.gif"reportgedit 1.py#!/usr/bin/env python
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.link import Link,TCLink
if '__main__' == __name__:
net = Mininet(link=TCLink)
h1 = net.addHost('h1')
h2 = net.addHost('h2')
Link(h1, h2)
net.build()
CLI(net)
net.stop()python 1.pyneth1 ifconfigh2 ifconfigh1 ping -c 3 h2exitcp 1.py 2.pygedit 2.py#!/usr/bin/env python
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.link import Link,TCLink
if '__main__' == __name__:
net = Mininet(link=TCLink)
h1 = net.addHost('h1')
h2 = net.addHost('h2')
r = net.addHost('r')
Link(h1, r)
Link(h2, r)
net.build()
CLI(net)
net.stop()python 2.pyxterm h1 h2 rifconfigifconfig h1-eth0 0ip addr add 192.168.1.1/24 brd + dev h1-eth0ip ro shroute -nip ro add default via 192.168.1.254ip ro shroute -nping 192.168.1.254ping 192.168.1.1ping 192.168.2.254arp -nip ro shifconfigifconfig h2-eth0 0ip addr add 192.168.2.1/24 brd + dev h2-eth0ip ro shroute -nip ro add default via 192.168.2.254ip ro shroute -nping 192.168.2.1ping 192.168.1.254ping 192.168.1.1ping 192.168.1.1ifconfigifconfig r-eth0 0ifconfig r-eth1 0ip addr add 192.168.1.254 brd + dev r-eth0ip addr add 192.168.2.254 brd + dev r-eth1ifconfigip add shifconfig r-eth0 0ifconfig r-eth1 0ip addr add 192.168.1.254/24 brd + dev r-eth0ip addr add 192.168.2.254/24 brd + dev r-eth1ifconfigcat /proc/sys/net/ipv4/ip_forwardecho 1 > /proc/sys/net/ipv4/ip_forwardcat /proc/sys/net/ipv4/ip_forwardnetgedit 3.py#!/usr/bin/env python
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.link import Link,TCLink
if '__main__' == __name__:
net = Mininet(link=TCLink)
h1 = net.addHost('h1')
h2 = net.addHost('h2')
r1 = net.addHost('r1')
r2 = net.addHost('r2')
Link(h1, r1)
Link(h2, r2)
Link(r1, r2)
net.build()
h1.cmd("ifconfig h1-eth0 0")
h1.cmd("ip addr add 192.168.1.1/24 brd + dev h1-eth0")
h1.cmd("ip route add default via 192.168.1.254")
h2.cmd("ifconfig h2-eth0 0")
h2.cmd("ip addr add 192.168.2.1/24 brd + dev h2-eth0")
h2.cmd("ip route add default via 192.168.2.254")
r1.cmd("ifconfig r1-eth0 0")
r1.cmd("ifconfig r1-eth1 0")
r1.cmd("ip addr add 192.168.1.254/24 brd + dev r1-eth0")
r1.cmd("ip addr add 10.0.0.1/24 brd + dev r1-eth1")
r1.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")
r1.cmd("ip route add 192.168.2.0/24 via 10.0.0.2")
r2.cmd("ifconfig r2-eth0 0")
r2.cmd("ifconfig r2-eth1 0")
r2.cmd("ip addr add 192.168.2.254/24 brd + dev r2-eth0")
r2.cmd("ip addr add 10.0.0.2/24 brd + dev r2-eth1")
r2.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")
r2.cmd("ip route add 192.168.1.0/24 via 10.0.0.1")
CLI(net)
net.stop()python 3.pynetapt-get install sshls -al ~/.sshssh-keygen -t rsa -C "xiaoji850312@gmail.com"ssh-add ~/.ssh/id_rsacat /root/.ssh/id_rsa.pubapt install python3.8apt install python3.8-distutilswget https://bootstrap.pypa.io/get-pip.pypython3.8 get-pip.py.1git clone git@github.com:p4lang/behavioral-model.gitcd behavioral-model./install_deps.sh./autogen.sh./configuremakemake installcd ..apt-get install gitgit clone https://github.com/intrig-unicamp/mininet-wificd mininet-wifiutil/install.sh -Wlnfvmn --wifi