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

cd mininet
mn --link=tc,bw=10,delay=1ms,loss=5

mn --link=tc,bw=10,delay='1ms',loss=0
h1 ping h2
xterm h1 h2

iperf -s -i 1

h1 ping -c 1000 -i 0.01 h2

exit
mn --link=tc,bw=10,delay='10ms',loss=2
h1 ping -c 1000 -i 0.01 h2

xterm h1 h2 h1 h2
iperf -s -i 1 -p 5555 > tcp

exit
mn --link=tc,bw=100,delay='10ms',loss=2
xterm h1 h2

iperf -c -i 1 -p 5555 | tee tee

exit
mn --link=tc,bw=10,delay='10ms',loss=0
xterm h1 h2 h1 h2

iperf -c -i 1 -p 5555 | tee tcp

exit
cat tcp | grep "sec" | head -n 100 | tr "-" " " | awk '{print $4,$8}' > mytcp
cat udp | grep "sec" | head -n 100 | tr "-" " " | awk '{print $4,$8}' > myudp
Gnuplot
gnuplot
plot "mytcp" title "tcp_flow" with linespoints, "myudp" title "udp_flow" with linespoints
set xrange [0:100]
set xtics 0,10,100
set yrange [0:10]
set ytics 0,1,10
replot
set xlabel "time(sec)"
set ylabel "throughput(Mbps)"
replot
set title "tcp vs. udp"
replot
set terminal "gif"
set output "a.gif"

report

使用腳本建立 Mininet

建立腳本
gedit 1.py

python 1.py
net
h1 ifconfig
h2 ifconfig

h1 ping -c 3 h2
exit
cp 1.py 2.py
gedit 2.py

python 2.py
xterm h1 h2 r

ifconfig
ifconfig h1-eth0 0
ip addr add 192.168.1.1/24 brd + dev h1-eth0
ip ro sh
route -n
ip ro add default via 192.168.1.254
ip ro sh
route -n

ping 192.168.1.254

ping 192.168.1.1

ping 192.168.2.254

arp -n
ip ro sh

net

gedit 3.py

python 3.py
net

練習:安裝 P4
生成 SSH ( GitHub 新增 )
apt-get install ssh
ls -al ~/.ssh

ssh-keygen -t rsa -C "xiaoji850312@gmail.com"
ssh-add ~/.ssh/id_rsa
cat /root/.ssh/id_rsa.pub

apt install python3.8

apt install python3.8-distutils

wget https://bootstrap.pypa.io/get-pip.py
python3.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-wifi
util/install.sh -Wlnfv

mn --wifi
Last updated
Was this helpful?