badcode
badcode

Reputation: 9

Mininet can't ping from switch (s1) to host (h1-h4)

I'm creating a simple mininet with a simple command like below. I'm using the OpendayLight SDN controller along with 192.168.20.0/24 subnet. Remote controller IP is hosted at 192.168.8.5. It connects with remote, no problem there. The problem is in short I can't ping from switch (s1) to host (h1-h4) and vice-versa.

sudo mn --topo single,4 --controller=remote,ip=controllerIP --switch ovsk,protocols=OpenFlow13

After that I set IP for hosts and default gateway,

h1 ifconfig h1-eth0 192.168.20.5/24
h2 ifconfig h1-eth0 192.168.20.6/24
h3 ifconfig h1-eth0 192.168.20.7/24
h4 ifconfig h1-eth0 192.168.20.8/24

Gateway:

h1 route add default gw 192.168.20.4
h2 route add default gw 192.168.20.4
h3 route add default gw 192.168.20.4
h4 route add default gw 192.168.20.4

I can ping between hosts like below:

mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3 h4 
h2 -> h1 h3 h4 
h3 -> h1 h2 h4 
h4 -> h1 h2 h3 
*** Results: 0% dropped (12/12 received)

But can't ping from s1 to h1-h4:

mininet> s1 ping h1
PING 192.168.20.5 (192.168.20.5) 56(84) bytes of data.
^C
--- 192.168.20.5 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2039ms

mininet> s1 ping h2
PING 192.168.20.6 (192.168.20.6) 56(84) bytes of data.
^C
--- 192.168.20.6 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2056ms

And vice-versa:

mininet> h1 ping 192.168.20.4
PING 192.168.20.4 (192.168.20.4) 56(84) bytes of data.
^C
--- 192.168.20.4 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1017ms

mininet> h2 ping 192.168.20.4
PING 192.168.20.4 (192.168.20.4) 56(84) bytes of data.
^C
--- 192.168.20.4 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1026ms

Dump flows are below: (I've tried chatGPT, other sites and added a few extra later)

badcode@ovs-mininet:~$ sudo ovs-ofctl dump-flows s1 -O OpenFlow13
 cookie=0x2b00000000000025, duration=7194.065s, table=0, n_packets=139, n_bytes=8974, priority=2,in_port="s1-eth1" actions=output:"s1-eth2",output:"s1-eth3",output:"s1-eth4",output:enp0s10,CONTROLLER:65535
 cookie=0x2b00000000000026, duration=7194.065s, table=0, n_packets=111, n_bytes=7734, priority=2,in_port="s1-eth2" actions=output:"s1-eth1",output:"s1-eth3",output:"s1-eth4",output:enp0s10,CONTROLLER:65535
 cookie=0x2b00000000000027, duration=7194.065s, table=0, n_packets=91, n_bytes=6566, priority=2,in_port="s1-eth3" actions=output:"s1-eth1",output:"s1-eth2",output:"s1-eth4",output:enp0s10,CONTROLLER:65535
 cookie=0x2b00000000000028, duration=7194.065s, table=0, n_packets=88, n_bytes=6376, priority=2,in_port="s1-eth4" actions=output:"s1-eth1",output:"s1-eth2",output:"s1-eth3",output:enp0s10,CONTROLLER:65535
 cookie=0x2b00000000000029, duration=7194.065s, table=0, n_packets=858, n_bytes=506220, priority=2,in_port=enp0s10 actions=output:"s1-eth1",output:"s1-eth2",output:"s1-eth3",output:"s1-eth4",CONTROLLER:65535
 cookie=0x0, duration=2990.045s, table=0, n_packets=42, n_bytes=1902, in_port=LOCAL actions=output:enp0s10
 cookie=0x0, duration=2972.128s, table=0, n_packets=144, n_bytes=84960, in_port=enp0s10 actions=LOCAL
 cookie=0x0, duration=2336.855s, table=0, n_packets=0, n_bytes=0, priority=10,in_port=LOCAL actions=output:"s1-eth1",output:"s1-eth2",output:"s1-eth3",output:"s1-eth4"
 cookie=0x0, duration=2392.952s, table=0, n_packets=0, n_bytes=0, priority=10,ip,nw_dst=192.168.20.4 actions=LOCAL
 cookie=0x2a00000000000100, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=9a:51:97:ef:7a:22,dl_dst=4a:a9:8d:0a:77:d2 actions=output:"s1-eth4"
 cookie=0x2a00000000000101, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=4a:a9:8d:0a:77:d2,dl_dst=9a:51:97:ef:7a:22 actions=output:"s1-eth2"
 cookie=0x2a00000000000108, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=9a:51:97:ef:7a:22,dl_dst=46:d8:9c:ed:b6:cb actions=output:"s1-eth3"
 cookie=0x2a00000000000109, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=46:d8:9c:ed:b6:cb,dl_dst=9a:51:97:ef:7a:22 actions=output:"s1-eth2"
 cookie=0x2a00000000000110, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=d2:d0:60:e4:d5:5e,dl_dst=4a:a9:8d:0a:77:d2 actions=output:"s1-eth4"
 cookie=0x2a00000000000111, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=4a:a9:8d:0a:77:d2,dl_dst=d2:d0:60:e4:d5:5e actions=output:"s1-eth1"
 cookie=0x2a00000000000118, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=d2:d0:60:e4:d5:5e,dl_dst=46:d8:9c:ed:b6:cb actions=output:"s1-eth3"
 cookie=0x2a00000000000119, duration=209.469s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=46:d8:9c:ed:b6:cb,dl_dst=d2:d0:60:e4:d5:5e actions=output:"s1-eth1"
 cookie=0x2a0000000000011c, duration=209.468s, table=0, n_packets=2, n_bytes=84, idle_timeout=600, hard_timeout=300, priority=10,dl_src=9a:51:97:ef:7a:22,dl_dst=d2:d0:60:e4:d5:5e actions=output:"s1-eth1"
 cookie=0x2a0000000000011d, duration=209.468s, table=0, n_packets=3, n_bytes=126, idle_timeout=600, hard_timeout=300, priority=10,dl_src=d2:d0:60:e4:d5:5e,dl_dst=9a:51:97:ef:7a:22 actions=output:"s1-eth2"
 cookie=0x2a0000000000011e, duration=209.468s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=4a:a9:8d:0a:77:d2,dl_dst=46:d8:9c:ed:b6:cb actions=output:"s1-eth3"
 cookie=0x2a0000000000011f, duration=209.468s, table=0, n_packets=0, n_bytes=0, idle_timeout=600, hard_timeout=300, priority=10,dl_src=46:d8:9c:ed:b6:cb,dl_dst=4a:a9:8d:0a:77:d2 actions=output:"s1-eth4"

Ifconfig:

br1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 200.175.2.4  netmask 255.255.255.0  broadcast 200.175.2.255
        inet6 fe80::a00:27ff:fef0:4ada  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:f0:4a:da  txqueuelen 1000  (Ethernet)
        RX packets 24107  bytes 11222188 (11.2 MB)
        RX errors 0  dropped 3995  overruns 0  frame 0
        TX packets 509  bytes 37275 (37.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.4  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::a00:27ff:fec6:694f  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:c6:69:4f  txqueuelen 1000  (Ethernet)
        RX packets 5511  bytes 1095542 (1.0 MB)
        RX errors 0  dropped 3995  overruns 0  frame 0
        TX packets 215  bytes 18327 (18.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a00:27ff:fec6:694f  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:c6:69:4f  txqueuelen 1000  (Ethernet)
        RX packets 1702  bytes 772901 (772.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9837  bytes 1389222 (1.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.8.6  netmask 255.255.255.0  broadcast 192.168.8.255
        inet6 fe80::39e4:4849:bea5:6b62  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:9d:0a:a8  txqueuelen 1000  (Ethernet)
        RX packets 369026  bytes 116598716 (116.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 361966  bytes 177779457 (177.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::59bf:89b5:ed9f:8bdd  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:f0:4a:da  txqueuelen 1000  (Ethernet)
        RX packets 21694  bytes 11275929 (11.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8509  bytes 1168325 (1.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s10: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:dc:21:86  txqueuelen 1000  (Ethernet)
        RX packets 1686  bytes 766328 (766.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9125  bytes 1097566 (1.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 35718  bytes 5114924 (5.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 35718  bytes 5114924 (5.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

s1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.20.4  netmask 255.255.255.0  broadcast 192.168.20.255
        inet6 fe80::a00:27ff:fedc:2186  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:dc:21:86  txqueuelen 1000  (Ethernet)
        RX packets 4205  bytes 415946 (415.9 KB)
        RX errors 0  dropped 4057  overruns 0  frame 0
        TX packets 165  bytes 12118 (12.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

s1-eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::e0df:c0ff:fe6f:7ab0  prefixlen 64  scopeid 0x20<link>
        ether e2:df:c0:6f:7a:b0  txqueuelen 1000  (Ethernet)
        RX packets 192  bytes 13200 (13.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5443  bytes 891826 (891.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

s1-eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::849d:bbff:fe96:31b1  prefixlen 64  scopeid 0x20<link>
        ether 86:9d:bb:96:31:b1  txqueuelen 1000  (Ethernet)
        RX packets 163  bytes 11870 (11.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5471  bytes 893066 (893.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

s1-eth3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::1045:58ff:fed5:a307  prefixlen 64  scopeid 0x20<link>
        ether 12:45:58:d5:a3:07  txqueuelen 1000  (Ethernet)
        RX packets 154  bytes 11324 (11.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5477  bytes 893198 (893.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

s1-eth4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::3847:ebff:fe19:5487  prefixlen 64  scopeid 0x20<link>
        ether 3a:47:eb:19:54:87  txqueuelen 1000  (Ethernet)
        RX packets 152  bytes 11128 (11.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5478  bytes 893304 (893.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Routing table and arp:

mininet> s1 route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.8.1     0.0.0.0         UG    100    0        0 enp0s8
192.168.3.0     0.0.0.0         255.255.255.0   U     0      0        0 br2
192.168.8.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s8
192.168.20.0    0.0.0.0         255.255.255.0   U     0      0        0 s1
200.175.2.0     0.0.0.0         255.255.255.0   U     0      0        0 br1
mininet> h1 route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.20.4    0.0.0.0         UG    0      0        0 h1-eth0
192.168.20.0    0.0.0.0         255.255.255.0   U     0      0        0 h1-eth0
mininet> s1 arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.20.4                     (incomplete)                              br1
192.168.8.1              ether   52:54:00:12:35:00   C                     enp0s8
192.168.3.5              ether   08:00:27:87:ff:98   C                     br2
192.168.3.43                     (incomplete)                              br2
192.168.8.5                      (incomplete)                              br1
200.175.2.5                      (incomplete)                              br2
192.168.8.5                      (incomplete)                              s1
192.168.20.5                     (incomplete)                              s1
192.168.8.5              ether   08:00:27:71:5f:7b   C                     enp0s8
192.168.20.6                     (incomplete)                              s1
192.168.3.5                      (incomplete)                              br1
192.168.8.5                      (incomplete)                              br2
192.168.8.3              ether   08:00:27:f6:22:eb   C                     enp0s8
200.175.2.5              ether   08:00:27:ad:25:87   C                     br1
192.168.3.4                      (incomplete)                              br1
mininet> h1 arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.20.4                     (incomplete)                              h1-eth0
192.168.20.6             ether   9a:51:97:ef:7a:22   C                     h1-eth0
192.168.20.7             ether   46:d8:9c:ed:b6:cb   C                     h1-eth0
192.168.20.8             ether   4a:a9:8d:0a:77:d2   C                     h1-eth0
mininet> 

You can see that the arp resolution says incomplete for s1 (192.168.20.4).

How can I solve the issue and be able to ping from s1 to hosts? I also want to achieve pinging hosts(h1-h4) from other two bridges br1 & br2 (in ifconfig you can see) but s1 isn't pinging so I guess first I need to solve this issue.

Tried port forwarding inside s1:

s1 sysctl net.ipv4.ip_forward=1
s1 sysctl -p

Tried to add explicit flows to handle ARP traffic:

dpctl add-flow s1 -O OpenFlow13 priority=100,arp,actions=output:ALL

Also, to forward ICMP traffic:

dpctl add-flow s1 -O OpenFlow13 priority=100,icmp,actions=output:ALL

Added a flow that matches traffic destined to 192.168.20.4 and forwards it to the LOCAL interface.

dpctl add-flow s1 -O OpenFlow13 priority=10,ip,nw_dst=192.168.20.4,actions=LOCAL

And a flow that forwards traffic from LOCAL (the switch) to the correct host interfaces.

dpctl add-flow s1 -O OpenFlow13 priority=10,in_port=LOCAL,actions=output:s1-eth1,s1-eth2,s1-eth3,s1-eth4

But nothing seems to work.

Upvotes: 0

Views: 42

Answers (0)

Related Questions