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

cd mininetmn --link=tc,bw=10,delay=1ms,loss=5
mn --link=tc,bw=10,delay='1ms',loss=0h1 ping h2xterm h1 h2
iperf -s -i 1
iperf -c 10.0.0.2 -t 100
h1 ping -c 1000 -i 0.01 h2
exitmn --link=tc,bw=10,delay='10ms',loss=2h1 ping -c 1000 -i 0.01 h2
xterm h1 h2 h1 h2iperf -s -i 1 -p 5555 > tcp
iperf -c 10.0.0.2 -p 5555 -t 100
iperf -s -i 1 -p 6666 -u | tee udp
iperf -c 10.0.0.2 -p 6666 -u -b 3M -t 100
exitmn --link=tc,bw=100,delay='10ms',loss=2xterm h1 h2
iperf -c -i 1 -p 5555 | tee tee
iperf -c 10.0.0.2 -t 100 -p 5555
exitmn --link=tc,bw=10,delay='10ms',loss=0xterm h1 h2 h1 h2
iperf -c -i 1 -p 5555 | tee tcp
iperf -c 10.0.0.2 -t 100 -p 5555
iperf -c -i 1 -p 6666 -u | tee udp
iperf -c 10.0.0.2 -p 6666 -u -b 3M -t 100
exitcat tcp | grep "sec" | head -n 100 | tr "-" " " | awk '{print $4,$8}' > mytcpcat udp | grep "sec" | head -n 100 | tr "-" " " | awk '{print $4,$8}' > myudpGnuplot
gnuplotplot "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"
report
使用腳本建立 Mininet

建立腳本
gedit 1.py
python 1.pyneth1 ifconfigh2 ifconfig
h1 ping -c 3 h2exitcp 1.py 2.pygedit 2.py
python 2.pyxterm h1 h2 r
ifconfigifconfig 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 -n
ping 192.168.1.254
ping 192.168.1.1
ping 192.168.2.254
arp -nip ro sh
ifconfigifconfig 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 -n
ping 192.168.2.1ping 192.168.1.254ping 192.168.1.1
ping 192.168.1.1
ifconfig
ifconfig 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-eth1ifconfig
ip add sh
ifconfig 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-eth1ifconfig
cat /proc/sys/net/ipv4/ip_forwardecho 1 > /proc/sys/net/ipv4/ip_forwardcat /proc/sys/net/ipv4/ip_forward
net
gedit 3.py
python 3.pynet
練習:安裝 P4
生成 SSH ( GitHub 新增 )
apt-get install sshls -al ~/.ssh
ssh-keygen -t rsa -C "xiaoji850312@gmail.com"ssh-add ~/.ssh/id_rsacat /root/.ssh/id_rsa.pub
apt install python3.8
apt install python3.8-distutils
wget https://bootstrap.pypa.io/get-pip.pypython3.8 get-pip.py.1
git clone git@github.com:p4lang/behavioral-model.git
cd behavioral-model./install_deps.sh
./autogen.sh
./configure
make
make install
練習:安裝 Mininet-WiFi ( 失敗 )
cd ..apt-get install git
git clone https://github.com/intrig-unicamp/mininet-wifi
cd mininet-wifiutil/install.sh -Wlnfv
mn --wifiLast updated
Was this helpful?
