Ryu-SDN-IP (二) h4 ping h1

mininet> h1 ping h4 <不同网段>
PING 192.168.4.1 (192.168.4.1) 56(84) bytes of data.
From 192.168.1.254 icmp_seq=1 Destination Net Unreachable
From 192.168.1.254 icmp_seq=2 Destination Net Unreachable
From 192.168.1.254 icmp_seq=3 Destination Net Unreachable
From 192.168.1.254 icmp_seq=4 Destination Net Unreachable
^CsendInt: writing chr(3)

--- 192.168.4.1 ping statistics ---
6 packets transmitted, 0 received, +4 errors, 100% packet loss, time 5121ms
mininet> h4 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
245: h4-eth0@if246: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 1a:f9:e8:cd:94:2c brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.4.1/24 brd 192.168.4.255 scope global h4-eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::18f9:e8ff:fecd:942c/64 scope link 
       valid_lft forever preferred_lft forever
mininet> h1 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
233: h1-eth0@if234: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 92:b2:e7:22:3d:87 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.1/24 brd 192.168.1.255 scope global h1-eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::90b2:e7ff:fe22:3d87/64 scope link 
       valid_lft forever preferred_lft forever
mininet> 
r4-eth1<->h4-eth0 (OK OK)
r1-eth1<->h1-eth0 (OK OK)

mininet> r1 vtysh -c 'show ip  route bgp'
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, P - PIM, A - Babel, N - NHRP,
       > - selected route, * - FIB route

B>* 192.168.0.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:12
B>* 192.168.1.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:07
B>* 192.168.2.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:07
B>* 192.168.3.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:07
mininet> r1 vtysh -c 'show ip  route'
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, P - PIM, A - Babel, N - NHRP,
       > - selected route, * - FIB route

C>* 10.0.4.0/24 is directly connected, r4-eth0 ----------r4的ip
C>* 127.0.0.0/8 is directly connected, lo
B>* 192.168.0.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:20
B>* 192.168.1.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:15
B>* 192.168.2.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:15
B>* 192.168.3.0/24 [20/0] via 10.0.4.101, r4-eth0, 01:27:15
C>* 192.168.4.0/24 is directly connected, r4-eth1
mininet> r1 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
234: r1-eth1@if233: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 26:0a:8f:42:e9:8d brd ff:ff:ff:ff:ff:ff link-netnsid 1
    inet 192.168.1.254/24 scope global r1-eth1
       valid_lft forever preferred_lft forever
236: r1-eth0@if235: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:00:00:00:01:01 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.0.1.1/24 scope global r1-eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::200:ff:fe00:101/64 scope link 
       valid_lft forever preferred_lft forever
mininet> 
mininet> r1 ip r
10.0.1.0/24 dev r1-eth0 proto kernel scope link src 10.0.1.1 
192.168.0.0/24 via 10.0.1.101 dev r1-eth0 proto zebra metric 20 
192.168.1.0/24 dev r1-eth1 proto kernel scope link src 192.168.1.254 
192.168.2.0/24 via 10.0.1.101 dev r1-eth0 proto zebra metric 20 
192.168.3.0/24 via 10.0.1.101 dev r1-eth0 proto zebra metric 20 
mininet> 

 

root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s1 --protocol=openflow13
 cookie=0x0, duration=6045.328s, table=0, n_packets=16088, n_bytes=965280, priority=65535,dl_dst=01:80:c2:00:00:0e,dl_type=0x88cc actions=CONTROLLER:65535
 cookie=0x0, duration=6043.640s, table=0, n_packets=2203, n_bytes=183868, priority=1,ip,dl_dst=00:00:00:00:00:01,nw_dst=10.0.1.101 actions=output:"s1-eth3"
 cookie=0x0, duration=6043.615s, table=0, n_packets=2260, n_bytes=187630, priority=1,ip,dl_dst=00:00:00:00:00:01,nw_dst=10.0.2.101 actions=output:"s1-eth3"
 cookie=0x0, duration=6042.778s, table=0, n_packets=4032, n_bytes=304646, priority=1,ip,dl_dst=00:00:00:00:01:01,nw_dst=10.0.1.1 actions=output:"s1-eth1"
 cookie=0x0, duration=6042.691s, table=0, n_packets=4033, n_bytes=304700, priority=1,ip,dl_dst=00:00:00:00:02:01,nw_dst=10.0.2.1 actions=output:"s1-eth2"
 cookie=0x0, duration=6040.776s, table=0, n_packets=3, n_bytes=294, priority=1,ip,nw_dst=192.168.1.0/24 actions=set_field:00:00:00:00:01:01->eth_dst,output:"s1-eth1"
 cookie=0x0, duration=6040.766s, table=0, n_packets=2, n_bytes=196, priority=1,ip,nw_dst=192.168.2.0/24 actions=set_field:00:00:00:00:02:01->eth_dst,output:"s1-eth2"
 cookie=0x0, duration=6040.757s, table=0, n_packets=1, n_bytes=98, priority=1,ip,nw_dst=192.168.3.0/24 actions=set_field:00:00:00:00:03:01->eth_dst,output:"s1-eth3"
 cookie=0x0, duration=5612.487s, table=0, n_packets=0, n_bytes=0, priority=1,ip,nw_dst=192.168.0.2 actions=set_field:f2:e7:67:58:2c:2d->eth_dst,output:"s1-eth2"
 cookie=0x0, duration=5611.465s, table=0, n_packets=0, n_bytes=0, priority=1,ip,nw_dst=192.168.0.1 actions=set_field:ca:e6:c2:fc:da:77->eth_dst,output:"s1-eth3"
 cookie=0x0, duration=6045.336s, table=0, n_packets=8856, n_bytes=653104, priority=0 actions=CONTROLLER:65535
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s1 --protocol=openflow13 | grep 192.168.4.0         -----------没有哦
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu#
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s1 --protocol=openflow13 | grep 192.168.4.0
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s2 --protocol=openflow13 | grep 192.168.4.0
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s3 --protocol=openflow13 | grep 192.168.4.0
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s4 --protocol=openflow13 | grep 192.168.4.0
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s5 --protocol=openflow13 | grep 192.168.4.0
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s6 --protocol=openflow13 | grep 192.168.4.0
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# 

r4发布路由

mininet> r4 vtysh

Hello, this is Quagga (version 1.2.4).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

ubuntu# show run
Building configuration...

Current configuration:
!
hostname zebra
log stdout
hostname r4
!
password sdnip
!
interface lo
!
interface r4-eth0
!
interface r4-eth1
!
router bgp 65004
 bgp router-id 10.0.4.1
 timers bgp 3 9
 neighbor 10.0.4.101 remote-as 65000
 neighbor 10.0.4.101 ebgp-multihop 255
 neighbor 10.0.4.101 advertisement-interval 5
 neighbor 10.0.4.101 timers connect 5
!
 address-family ipv6
 exit-address-family
 exit
end
ubuntu# router ^H^H
% Unknown command.
ubuntu# bgp ^CsendInt: writing chr(3)
^C

ubuntu# router bgp 65004
% Unknown command.
ubuntu# conf t
ubuntu(config)# router bgp 65004
ubuntu(config-router)# network 192.168.4.0/24
ubuntu(config-router)# quit
ubuntu(config)# wr
% Unknown command.
ubuntu(config)# write
% Unknown command.
ubuntu(config)# quit
% Unknown command.
ubuntu(config)# q
% Unknown command.
ubuntu(config)# exit
ubuntu# wr
Building Configuration...
Configuration saved to /etc/quagga/sdn-ip-topology/configs/zebra.conf
Configuration saved to /etc/quagga/sdn-ip-topology/configs/quagga4.conf
[OK]
ubuntu# show run
Building configuration...

Current configuration:
!
hostname zebra
log stdout
hostname r4
!
password sdnip
!
interface lo
!
interface r4-eth0
!
interface r4-eth1
!
router bgp 65004
 bgp router-id 10.0.4.1
 network 192.168.4.0/24
 timers bgp 3 9
 neighbor 10.0.4.101 remote-as 65000
 neighbor 10.0.4.101 ebgp-multihop 255
 neighbor 10.0.4.101 advertisement-interval 5
 neighbor 10.0.4.101 timers connect 5
!
 address-family ipv6
 exit-address-family
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s1 --protocol=openflow13 | grep 192.168.4.0
 cookie=0x0, duration=122.289s, table=0, n_packets=2, n_bytes=196, priority=1,ip,nw_dst=192.168.4.0/24 actions=set_field:00:00:00:00:04:01->eth_dst,output:2
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s2 --protocol=openflow13 | grep 192.168.4.0
 cookie=0x0, duration=126.656s, table=0, n_packets=2, n_bytes=196, priority=1,ip,nw_dst=192.168.4.0/24 actions=set_field:00:00:00:00:04:01->eth_dst,output:3
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s3 --protocol=openflow13 | grep 192.168.4.0
 cookie=0x0, duration=131.037s, table=0, n_packets=0, n_bytes=0, priority=1,ip,nw_dst=192.168.4.0/24 actions=set_field:00:00:00:00:04:01->eth_dst,output:3
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s4 --protocol=openflow13 | grep 192.168.4.0
 cookie=0x0, duration=134.899s, table=0, n_packets=2, n_bytes=196, priority=1,ip,nw_dst=192.168.4.0/24 actions=set_field:00:00:00:00:04:01->eth_dst,output:3
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s5 --protocol=openflow13 | grep 192.168.4.0
 cookie=0x0, duration=138.819s, table=0, n_packets=0, n_bytes=0, priority=1,ip,nw_dst=192.168.4.0/24 actions=set_field:00:00:00:00:04:01->eth_dst,output:3
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s6 --protocol=openflow13 | grep 192.168.4.0
 cookie=0x0, duration=142.781s, table=0, n_packets=2, n_bytes=196, priority=1,ip,nw_dst=192.168.4.0/24 actions=set_field:00:00:00:00:04:01->eth_dst,output:1
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# ovs-ofctl dump-flows s1 --protocol=openflow13 | grep 192.168.4.0
 cookie=0x0, duration=151.625s, table=0, n_packets=2, n_bytes=196, priority=1,ip,nw_dst=192.168.4.0/24 actions=set_field:00:00:00:00:04:01->eth_dst,output:2
root@ubuntu:/data1/root/ryu/SDN-IP-Ryu# 

怎么都有哦,不会有环路吗?

原文地址:https://www.cnblogs.com/dream397/p/13306906.html