SDN控制器——POX基本使用

POX可以说是NOX的同胞兄弟,其是使用python语言开发的,是一款快速的平台和网络原型的控制软件。

  1. 安装完后可以先体验一下
root@mininet-vm:/home/mininet/pox# ./pox.py  openflow.of_01 --address=127.0.0.1
POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.
INFO:core:POX 0.2.0 (carp) is up.

在这里pox.py是程序的入口,openflow.of_01库用来解释后面的参数,Pox默认开启6633端口监听,

2.在address后面指定port。

root@mininet-vm:/home/mininet# ./pox/pox.py  openflow.of_01 --address=127.0.0.1 --port=6667
POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.
INFO:core:POX 0.2.0 (carp) is up.

3.运行组件,即要用到的app

root@mininet-vm:/home/mininet/pox# ./pox.py  openflow.of_01 --address=127.0.0.1 --port=6666 py
POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.
INFO:core:POX 0.2.0 (carp) is up.
Ready.
POX>

在上面的POX>输入提示符中可以编辑MSG或者调用组件的接口。

4.运行Minine连接Pox控制器。

root@mininet-vm:/home/mininet# mn  --controller=remote,ip=127.0.0.1,port=6666
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller
c0 
*** Starting 1 switches
s1 ...
*** Starting CLI:
root@mininet-vm:/home/mininet/pox# ./pox.py  openflow.of_01 --address=127.0.0.1 --port=6666 py
POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.
INFO:core:POX 0.2.0 (carp) is up.
Ready.
POX> INFO:openflow.of_01:[None 1] closed
INFO:openflow.of_01:[00-00-00-00-00-01 2] connected
  1. Pox运行l2_pairs组件,该组件可以抽取packet_in中的dst_mac和src_mac,根据源端口和目的端口下发的flow entry到switch,即工作在交换机模式。

Pox端:

root@mininet-vm:/home/mininet/pox# ./pox.py  openflow.of_01 --address=127.0.0.1 --port=8888 pox.forwarding.l2_pairs
POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.
INFO:forwarding.l2_pairs:Pair-Learning switch running.
INFO:core:POX 0.2.0 (carp) is up.
INFO:openflow.of_01:[None 1] closed
INFO:openflow.of_01:[00-00-00-00-00-01 2] connected

mininet端:

root@mininet-vm:/home/mininet# mn --controller=remote,ip=127.0.0.1,port=8888
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller
c0 
*** Starting 1 switches
s1 ...
*** Starting CLI:

查看下交换机的flow entry,可以发现无flow entry

mininet> dpctl dump-flows
*** s1 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):

使用h1 ping h2,发现出现了两条flow entry.

mininet> h1 ping h2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=50.7 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.043 ms
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.127 ms
64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=0.075 ms
^C
--- 10.0.0.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 0.043/12.747/50.745/21.938 ms
mininet> dpctl dump-flows
*** s1 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=453.315s, table=0, n_packets=5, n_bytes=434, idle_age=448, dl_src=8e:71:af:1f:ac:62,dl_dst=9e:c3:2e:b5:cd:4f actions=output:2
 cookie=0x0, duration=453.277s, table=0, n_packets=6, n_bytes=476, idle_age=448, dl_src=9e:c3:2e:b5:cd:4f,dl_dst=8e:71:af:1f:ac:62 actions=output:1
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 黑客帝国 设计师:白松林 返回首页