红联Linux门户
Linux帮助

OpenvSwitch 2.1.2安装完成后启动与停止shell脚本

发布时间:2014-09-16 10:19:58来源:linux网站作者:svap1

OpenvSwitch 2.1.2 安装完成后,会经常遇到启动与停止的情况,为了避免重复手写启动停止的终端代码,最好将其写在不同的脚本里,方便下次调用。前提是已经安装好了openvswitch,并按照下面到语句建立好了数据库conf.db


mkdir -p /usr/local/etc/openvswitch
ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema


开始脚本:

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


开启ovsdb-server、-vswtichd服务。

停止脚本:

kill `cd /usr/local/var/run/openvswitch && cat ovsdb-server.pid ovs-vswitchd.pid`
##cat ovs-brcompatd.pid ovs-controller.pid ovs-monitor-ipsec.pid##


进入OpenvSwitch的安装路径,杀死ovsdb-server 、ovs-vswitchd 进程。