ovs-vsctl: unix:/usr/local/var/run/openvswitch/db.sock: database connection failed

重装好ovs后直接操作一切正常,但是重启虚拟机后会出现:
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-vsctl
Make 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”.
无法正确添加ovs

原因是:ovs 需要 the ovsdb, ovs-vswitchd, ovs-vsctl, 但是关机后它们会默认关闭

所以解决方法是每次重新开机都运行(run as root):

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
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach

猜你喜欢

转载自blog.csdn.net/xyq54/article/details/51371819