在 mininet 中,交换机默认创建为二层交换机,并且默认有多个规则。你可以使用
sh ovs-ofctl dump-flows s1
检查s1中的流规则。
所以在更改 h1 和 h2 的 IP 地址之前,规则如下:
NXST_FLOW reply (xid=0x4)
这是空的。
然后你输入pingall,交换机会根据原来的IP地址(10.0.0.1 & 10.0.0.2)添加规则,可能是这样的:
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=1.376s, table=0, n_packets=2, n_bytes=196, idle_timeout=60, idle_age=1, priority=65535,icmp,in_port=2,vlan_tci=0x0000,dl_src=f6:6b:f6:42:44:ac,dl_dst=06:37:92:eb:2c:a0,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:1
cookie=0x0, duration=1.375s, table=0, n_packets=1, n_bytes=98, idle_timeout=60, idle_age=1, priority=65535,icmp,in_port=2,vlan_tci=0x0000,dl_src=f6:6b:f6:42:44:ac,dl_dst=06:37:92:eb:2c:a0,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:1
cookie=0x0, duration=1.374s, table=0, n_packets=1, n_bytes=98, idle_timeout=60, idle_age=1, priority=65535,icmp,in_port=1,vlan_tci=0x0000,dl_src=06:37:92:eb:2c:a0,dl_dst=f6:6b:f6:42:44:ac,nw_src=10.0.0.1,nw_dst=10.0.0.2,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:2
而 mininet 会将“h1”映射到 10.0.0.1,将“h2”映射到 10.0.0.2
现在如果您将 IP 更改为 192.168.1.1/24 和 192.168.1.2/24。规则仍然适用于 10.0.0.1 和 10.0.0.2。然后在 60 秒空闲超时后,它再次变为空。
因此,如果您想使用新 IP 相互连接。您可以尝试对主机名使用单 ping,例如:
h1 ping h2
h2 ping h2
要更改Mininet中的映射,然后可以再次相互ping通。