20210315 Gnuplot
Last updated
Was this helpful?
Last updated
Was this helpful?
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
iperf -c 10.0.0.2 -t 100
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
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
exit
mn --link=tc,bw=100,delay='10ms',loss=2
xterm h1 h2
iperf -c -i 1 -p 5555 | tee tee
iperf -c 10.0.0.2 -t 100 -p 5555
exit
mn --link=tc,bw=10,delay='10ms',loss=0
xterm 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
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
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
建立腳本
gedit 1.py
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.py
net
h1 ifconfig
h2 ifconfig
h1 ping -c 3 h2
exit
cp 1.py 2.py
gedit 2.py
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.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
ifconfig
ifconfig h2-eth0 0
ip addr add 192.168.2.1/24 brd + dev h2-eth0
ip ro sh
route -n
ip ro add default via 192.168.2.254
ip ro sh
route -n
ping 192.168.2.1
ping 192.168.1.254
ping 192.168.1.1
ping 192.168.1.1
ifconfig
ifconfig r-eth0 0
ifconfig r-eth1 0
ip addr add 192.168.1.254 brd + dev r-eth0
ip addr add 192.168.2.254 brd + dev r-eth1
ifconfig
ip add sh
ifconfig r-eth0 0
ifconfig r-eth1 0
ip addr add 192.168.1.254/24 brd + dev r-eth0
ip addr add 192.168.2.254/24 brd + dev r-eth1
ifconfig
cat /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/ip_forward
cat /proc/sys/net/ipv4/ip_forward
net
gedit 3.py
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.py
net
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
cd ..
apt-get install git
git clone https://github.com/intrig-unicamp/mininet-wifi
cd mininet-wifi
util/install.sh -Wlnfv
mn --wifi