Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3625197
  • 博文数量: 880
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 6155
  • 用 户 组: 普通用户
  • 注册时间: 2016-11-11 09:12
个人简介

To be a better coder

文章分类

全部博文(880)

文章存档

2022年(5)

2021年(60)

2020年(175)

2019年(207)

2018年(210)

2017年(142)

2016年(81)

分类: 网络与安全

2018-06-11 14:32:11

一、两种 OVS fallback behavior
1. standalone
这种模式下,没有运行controller的情况下,OVS会自动调回普通switch模式,如果有controller的情况,ovs会自动变成 openflow switch
命令:
ovs-vsctl set-fail-mode ovs-switch standalone

ovs-switch替换成bridge的名字

2.secure
这种模式下,无论有没有controller, ovs都会作为openflow switch运行, 也就是所有interface在bridge上,等待controller或者用户添加flow到switch来进行通信

ovs-vsctl set-fail-mode ovs-switch secure

二、 OVS常用的两个 command line tool
ovs-vsctl 用来查询和配置ovs-vswitchd
ovs-ofctl 管理配置openflow switch

1. 显示bridge的信息,连接到bridge上的interface,tap和端口号(port)
ovs-ofctl show ovs-switch (ovs-switch代表bridge的名字,也就是虚拟的switch,下同)

2. 显示flow entries
ovs-ofctl dump-flows ovs-switch

3. 添加flow
ovs-ofctl add-flow ovs-switch "in_port=2,actions=output:8"
flow有很多syntax, 一半来说actions之前都是match的部分,常用的一般是

in_port: switch的端口
dl_src: 源mac地址
dl_dst:目的mac地址
dl_type:以太网协议类型 0x0806是arp packet 0x0800是ip packet
nw_src:源IP
nw_dst:目的ip
nw_proto:协议类型 ,注意和dl_type区分,同时也需要和dl_type一起使用,比如dl_type是ip(0x0800),那么nw_proto=1就表示icmp packet
tp_src: tcp udp源端口
tp_dst: tcp udp目的端口
ip   ==dl_type=0x0800.
icmp ==dl_type=0x0800,nw_proto=1.
tcp ==dl_type=0x0800,nw_proto=6.
udp ==dl_type=0x0800,nw_proto=17.
arp ==dl_type=0x0806.
rarp ==dl_type=0x8035.
ip?? ==dl_type=0x8888
ipv6 ==dl_type=0x086dd(5位)

actions:

output:port
controller(key=value) 送到controller作为packet-in 消息,括号内的key value pair可以是:
reason=reason reason 可以是action,no_match,invalid_ttl
id=controller-id 默认是0,特殊的controller会有一个16位的id

mod_dl_src:mac   Sets the source Ethernet address to mac.
mod_dl_dst:mac   Sets the destination Ethernet address to mac.
mod_nw_src:ip    Sets the IPv4 source address to ip.
mod_nw_dst:ip    Sets the IPv4 destination address to ip.
mod_tp_src:port  Sets the TCP or UDP source port to port.
mod_tp_dst:port  Sets the TCP or UDP destination port to port.
阅读(3226) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~