ovs交换机配置保存指南




ovs本身具有保存部分配置功能的方法,即通过ovs db保存配置,但是openflow流表在重启后无法保存。


在openvswitch的安装指南(INSTALL.md)中,有如下段话:
https://github.com/openvswitch/ovs/blob/master/INSTALL.md


An upgrade of userspace daemons means that they have to be restarted. Restarting the daemons means that the OpenFlow flows in the ovs-vswitchd daemon will be lost. One way to restore the flows is to let the controller re-populate it. Another way is to save the previous flows using a utility like ovs-ofctl and then re-add them after the restart. Restoring the old flows is accurate only if the new Open vSwitch interfaces retain the old 'ofport' values.


话里提到有两种方法避免丢失配置
1 使用控制器再下发一次流表
2 使用工具,例如ovs-ofctl重新添加一次。


我们目前未使用控制器,暂时采用方法2.


方法如下,
系统:Centos7
Step1: 创建ovsconfig.service
文件目录:/lib/systemd/system
Step2: 创建ovs-config
文件目录:/usr/bin/
文件权限:可执行(chmod +x /usr/bin/ovs-config)
Step3: 设置使用服务
systemctl enable ovsconfig.service
此时查看状态
systemctl status ovsconfig.service
状态应该为正常启动
此时重启系统,系统应该正常下发流表。


附件:
1 ovsconfig.service内容
这是systemd配置服务内容,内容如下,
[Unit]
Description=Openvswitch Openflow Saver
After=openvswitch.service
Requires=openvswitch.service


[Service]
ExecStart=/usr/bin/ovs-config
ExecReload=ovs-config
Type=oneshot
KillMode=none


[Install]
WantedBy=multi-user.target


2 ovs-config内容
这是ovs配置流表内容,内容如下,


#!/bin/sh
ovs-ofctl add-flow br-in "in_port=101,actions=bundle(eth_src,0,hrw,ofport,slaves:102,103)"




  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值