20210412 Openvswitch ( 一 )
課堂資料

課堂練習
Openvswitch
mkdir ovs-test
cd ovs-test
lab1

mkdir lab1
cd lab1
gedit lab1.py &
mn
h1 ping h2 -c 5
exit

mn --controller=remote
h1 ping h2
h1 arp -n

h1 ping h2 -c 5
h1 arp -n
h2 arp -n
h1 ping h2 -c 5

python lab1.py
Ruler S1
ovs-ofctl add-flow s1 arp,arp_op=1,arp_spa=10.0.0.1,arp_tpa=10.0.0.2,actions=output:2
ovs-ofctl add-flow s1 arp,arp_op=1,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1
ovs-ofctl add-flow s1 arp,arp_op=2,arp_spa=10.0.0.1,arp_tpa=10.0.0.2,actions=output:2
ovs-ofctl add-flow s1 arp,arp_op=2,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1
ovs-ofctl add-flow s1 icmp,nw_src=10.0.0.1,nw_dst=10.0.0.2,icmp_type=8,icmp_code=0,actions=output:3
ovs-ofctl add-flow s1 icmp,nw_src=10.0.0.2,nw_dst=10.0.0.1,icmp_type=0,icmp_code=0,actions=output:1
ovs-ofctl dump-flows s1

Ruler S2
ovs-ofctl add-flow s2 arp,arp_op=1,arp_spa=10.0.0.1,arp_tpa=10.0.0.2,actions=output:3
ovs-ofctl add-flow s2 arp,arp_op=1,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1
ovs-ofctl add-flow s2 arp,arp_op=2,arp_spa=10.0.0.1,arp_tpa=10.0.0.2,actions=output:3
ovs-ofctl add-flow s2 arp,arp_op=2,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1
ovs-ofctl add-flow s2 icmp,nw_src=10.0.0.1,nw_dst=10.0.0.2,icmp_type=8,icmp_code=0,actions=output:3
ovs-ofctl add-flow s2 icmp,nw_src=10.0.0.2,nw_dst=10.0.0.1,icmp_type=0,icmp_code=0,actions=output:2
ovs-ofctl dump-flows s2

Ruler S3
ovs-ofctl add-flow s3 icmp,nw_src=10.0.0.1,nw_dst=10.0.0.2,icmp_type=8,icmp_code=0,actions=output:2
ovs-ofctl dump-flows s3

xterm s3 s2
h1 ping h2 -c 5
h1 ping s2
h1 ping h2 -c 5

ovs-ofctl dump-flows s2
ovs-ofctl del-flows s2 icmp,nw_src=10.0.0.2,nw_dst=10.0.0.1,icmp_type=0,icmp_code=0
ovs-ofctl add-flow s2 icmp,nw_src=10.0.0.2,nw_dst=10.0.0.1,icmp_type=0,icmp_code=0,actions=output:1
ovs-ofctl dump-flows s2

h1 ping h2 -c 5

cd ..
mkdir lab2
cd lab2
lab2

gedit lab2.py

python lab2.py
xterm h1 h2 h3
iperf -s -i 1 -u

pingall

ovs-ofctl dump-flows s1
ovs-ofctl show s1
ovs-ofctl add-flow s1 priority=10,ip,nw_src=10.0.0.1,nw_dst=10.0.0.2,actions=output:2,mod_nw_dst=10.0.0.3,output:3

ovs-ofctl dump-flows s1
ovs-ofctl add-flow s1 priority=100,ip,nw_src=10.0.0.1,nw_dst=10.0.0.2,actions=output:2,mod_nw_dst=10.0.0.3,mod_dl_dst=00:00:00:03,output:3
iperf -s -i 1


iperf -s -i 1


期中考題練習
ICPM Request / ICPM Reply
mkdir exam
cd exam

gedit switch.py
Last updated
Was this helpful?