问题描述:
在搭建简易的SDN真实网络时,在计算机上用ovs模拟OpenFlow交换机,一台计算机搭建Floodlight模拟控制器,同时利用ovsdb-client通过OVSDB进行远程配置,在利用自动连接管理交换机时,发现无法连接到OVS。但是在原本在mininet上测试的时候,可以正常连通。
问题排查:
首先,测试两台计算机之间的连通性,发现能够ping通两台机子,同时控制器连接也是正常的,但是位于同一台计算机的ovsdb-client程序却无法连通ovs。
考虑到端口是否被占用,修改了原本连接的端口号,将6640改成6666,发现还是无法连通。
查看官方OVS官方文档,对于设置manager的操作只提到了两种,active模式:
ovs-vsctl set-manager tcp:<ip>:<port>
passive模式:
ovs-vsctl set-manager ptcp:<port>
于是测试了用passive模式连接,还是无法连上。
索性暴力点,搜索了所有官方文档有关manager的地方,发现一个关键的问题:
These commands manipulate the manager_options column in the Open_vSwitch table and rows in the Managers table. When ovsdb−server is configured to use the manager_options column for OVSDB connections (as described in the startup scripts provided with Open vSwitch; the corresponding ovsdb−server command option is --remote=db:Open_vSwitch,Open_vSwitch,manager_options), this allows the administrator to use ovs−vsctl to configure database connections。
这段话里提到,需要设置manager_options才能够连接远端管理,查看了我的ovsdb-server启动配置语句,
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \ --remote=db:Open_vSwitch,Open_vSwitch --private-key=db:Open_vSwitch,SSL,private_key \ --certificate=db:Open_vSwitch,SSL,certificate \ --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \ --pidfile --detach
其中并为设置manager_options,所以在对应的地方加上,如下
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \ --remote=db:Open_vSwitch,Open_vSwitch,manager_options \ --private-key=db:Open_vSwitch,SSL,private_key \ --certificate=db:Open_vSwitch,SSL,certificate \ --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \ --pidfile --detach
重新启动ovsdb-server,发现连接manger成功。
问题总结:
在安装ovs的时候,直接参照网上的教程一步步做的,并不知道其中真正的意义是什么,所以在配置ovsdb-server初始化的时候,并没有考虑到自身需求,造成问题难以排查。所以,尽量多看官方文档!!!