20210412 Openvswitch ( 一 )
課堂資料

課堂練習
Openvswitch
mkdir ovs-testcd ovs-testlab1

mkdir lab1cd lab1gedit lab1.py &mnh1 ping h2 -c 5exit

ovs-ofctl dump-flows s1
mn --controller=remoteh1 ping h2h1 arp -n
h1 ping h2 -c 5h1 arp -nh2 arp -nh1 ping h2 -c 5
ovs-ofctl add-flow s1 arp,arp_spa=10.0.0.1,arp_tpa=10.0.0.2,arp_op=1,actions=output:2ovs-ofctl add-flow s1 arp,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,arp_op=1,actions=output:1ovs-ofctl dump-flows s1ovs-ofctl add-flow s1 icpm,nw_src=10.0.0.1,nw_dst=10.0.0.2,icpm_type=8,icpm_code=0,actions=output:2ovs-ofctl add-flow s1 icpm,nw_src=10.0.0.2,nw_dst=10.0.0.1,icpm_type=0,icpm_code=0,actions=output:1ovs-ofctl dump-flows s1
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:2ovs-ofctl add-flow s1 arp,arp_op=1,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1ovs-ofctl add-flow s1 arp,arp_op=2,arp_spa=10.0.0.1,arp_tpa=10.0.0.2,actions=output:2ovs-ofctl add-flow s1 arp,arp_op=2,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1ovs-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:3ovs-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:1ovs-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:3ovs-ofctl add-flow s2 arp,arp_op=1,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1ovs-ofctl add-flow s2 arp,arp_op=2,arp_spa=10.0.0.1,arp_tpa=10.0.0.2,actions=output:3ovs-ofctl add-flow s2 arp,arp_op=2,arp_spa=10.0.0.2,arp_tpa=10.0.0.1,actions=output:1ovs-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:3ovs-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:2ovs-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:2ovs-ofctl dump-flows s3
xterm s3 s2h1 ping h2 -c 5h1 ping s2h1 ping h2 -c 5
ovs-ofctl dump-flows s2ovs-ofctl del-flows s2 icmp,nw_src=10.0.0.2,nw_dst=10.0.0.1,icmp_type=0,icmp_code=0ovs-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:1ovs-ofctl dump-flows s2
h1 ping h2 -c 5
cd ..mkdir lab2cd lab2lab2

gedit lab2.py
python lab2.pyovs-ofctl add-flow s1 ip,nw_src=10.0.0.1,actions=output:2,output:3ovs-ofctl del-flows s1ovs-ofctl add-flow s1 priority=1,ip,nw_dst=10.0.0.1,actions=output:1ovs-ofctl add-flow s1 priority=1,ip,nw_dst=10.0.0.2,actions=output:2ovs-ofctl add-flow s1 priority=1,ip,nw_dst=10.0.0.3,actions=output:3
xterm h1 h2 h3pingall
ovs-ofctl add-flow s1 priority=10,ip,nw_src=10.0.0.1,nw_dst=10.0.0.2,actions=output:2,output:3ovs-ofctl dump-flows s1
ovs-ofctl dump-flows s1ovs-ofctl show s1ovs-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 s1ovs-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:3iperf -s -i 1

iperf -s -i 1

iperf -c 10.0.0.2 -t 100
iperf -c 10.0.0.2 -t 100 -i 1
期中考題練習
ICPM Request / ICPM Reply
mkdir examcd exam
gedit switch.py
gedit router.py
Last updated
Was this helpful?






