启动Mininet时报ovsdb-server没有启动的错误

来源:互联网 发布:org域名申请 编辑:程序博客网 时间:2024/05/18 18:02

前言

今天重启了虚拟机 B 192.168.1.198 一波,可是发现在使用mn命令时报了以下错误:

错误提示:
*** Creating  network*** Adding controller*** Adding hosts:h1 h2 *** Adding switches:ovs-vsctl: unix:/usr/local/var/run/openvswitch/db.sock: database connection failed (No such file or directory)ovs-vsctl exited with code 1*** Error connecting to ovs-db with ovs-vsctlMake sure that Open vSwitch is installed, that ovsdb-server is running, and that"ovs-vsctl show" works correctly.You may wish to try "service openvswitch-switch start"

解决过程

  1. 一开始看到 You may wish to try “service openvswitch-switch start”
    以为真的是没有安装openvswitch,于是重新安装了一波openvswitch,在安装的过程中要注意openvswitch与内核版本之间的支持关系。以下是他们版本之间的对应表:
Open vSwitch Linux kernel 1.4.x 2.6.18 to 3.2 1.5.x 2.6.18 to 3.2 1.6.x 2.6.18 to 3.2 1.7.x 2.6.18 to 3.3 1.8.x 2.6.18 to 3.4 1.9.x 2.6.18 to 3.8 1.10.x 2.6.18 to 3.8 1.11.x 2.6.18 to 3.8 2.0.x 2.6.32 to 3.10 2.1.x 2.6.32 to 3.11 2.3.x 2.6.32 to 3.14 2.4.x 2.6.32 to 4.0 2.5.x 2.6.32 to 4.3 2.6.x 3.10 to 4.7 2.7.x 4.8及以上

其实,报错信息中,只是数据库服务器没有启动而矣,
2. 安装后启动ovsdb-server

#:ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --pidfile --detach#:ovs-vsctl --no-wait init#:ovs-vswitchd --pidfile --detach --log-file

如果有:

2017-04-24T00:12:11Z|00005|reconnect|INFO|unix:/usr/local/var/run/openvswitch/db.sock: connected

显示就说明启动交换机数据库成功

看来 系统重启后,这个交换机数据库没有自动重新启动,可以写一个自启的简单脚本。
3. 编写 数据库自启脚本:

#!/bin/bashovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --pidfile --detachovs-vsctl --no-wait initovs-vswitchd --pidfile --detach --log-file

修改权限位:chmod 777 autorun.sh

设置开机自启:

# 把刚刚的文件链接到/etc/init.d/下面ln autorun.sh /etc/init.d/autorun.sh#设置开机自启cd /etc/init.d/update-rc.d autorun defaults 90

重启

重启后 再启动 mininet
mn –controller=remote,ip=192.168.1.197,port=6653
反馈信息:

*** Creating network*** Adding controller*** Adding hosts:h1 h2 *** Adding switches:s1 *** Adding links:(h1, s1) (h2, s1) *** Configuring hostsh1 h2 *** Starting controllerc0 *** Starting 1 switchess1 ...*** Starting CLI:

ok,已经连接成功,而且也说明开机自启了.

0 0
原创粉丝点击