mininet搭建网络拓扑后,新添加的主机不能被ping通的问题。
首先、建立了一个线性拓扑,如下:
root@sdnhubvm:/home/ubuntu# mn --topo=linear,2
*** No default OpenFlow controller found for default switch!
*** Falling back to OVS Bridge
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1 s2
*** Adding links:
(h1, s1) (h2, s2) (s2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
*** Starting 2 switches
s1 s2 ...
*** Starting CLI:
然后、添加一台主机h3,并建立连接和配置IP
mininet> py net.addHost('h3')
<Host h3: pid=3034>
mininet> py net.addLink(s1,net.get('h3'))
<mininet.link.Link object at 0x7f7b8acec150>
mininet> py s1.attach('s1-eth3')
mininet> py net.get('h3').cmd('ifconfig h3-eth0 10.3')
如果不指定控制器,使用mininet自带控制器,那么新添加的主机就能够被ping通。如果指定控制器(我这里是在同一个虚拟机内安装的mininet和ODL控制器),创建网络时加上--controller=remote,ip=127.0.0.1,port=6633(控制器运行正常),那么新建主机就不能被ping通。通过抓包发现,用h1 ping h3时,连接h3的s1交换机的s1-eth3口没有抓到ARP请求,其他端口正常。流表如下:
*** s1 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x2b00000000000000, duration=89.255s, table=0, n_packets=18, n_bytes=1530, idle_age=4, priority=100,dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x2b00000000000000, duration=83.811s, table=0, n_packets=10, n_bytes=448, idle_age=28, priority=2,in_port=1 actions=output:2,CONTROLLER:65535
cookie=0x2b00000000000001, duration=83.802s, table=0, n_packets=2, n_bytes=140, idle_age=80, priority=2,in_port=2 actions=output:1
cookie=0x2b00000000000001, duration=89.255s, table=0, n_packets=9, n_bytes=710, idle_age=48, priority=0 actions=drop
*** s2 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x2b00000000000003, duration=89.230s, table=0, n_packets=18, n_bytes=1530, idle_age=4, priority=100,dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x2b00000000000002, duration=83.804s, table=0, n_packets=11, n_bytes=518, idle_age=28, priority=2,in_port=2 actions=output:1
cookie=0x2b00000000000003, duration=83.800s, table=0, n_packets=1, n_bytes=70, idle_age=80, priority=2,in_port=1 actions=output:2,CONTROLLER:65535
cookie=0x2b00000000000000, duration=89.313s, table=0, n_packets=8, n_bytes=640, idle_age=84, priority=0 actions=drop
不知道是什么原因,为什么用mininet内部控制器就没事,连接指定控制器就不行。请教各位。