玩转Openvwitch第二站:Bridge和Controller

以下内容已屏蔽图片优化访问速度
Bridge表结构如下:
[IMG]


我们先看其中的一项,就是Controller



[IMG]


OpenFlow配置项:从架构图中我们可以看出,openvwitch的一个bridge可以通过openflow协议,被一个统一的controller管理的。


一旦一个bridge连到一个openflow controller,则flow table就由controller统一管理,如果连接断了:
secure: 这个bridge会试图一直连接controller,并不自己建立flow table
standalone:一旦bridge三次连不上controller,就自己建立和管理flow table


OpenFlow Controller多种多样
[IMG]ubuntu_br上


[IMG]


[IMG]


[IMG]


[IMG]


[IMG]


安装floodlight
[IMG]clone git://github.com/floodlight/floodlight.git
cd floodlight/
ant
nohup java -jar target/floodlight.jar > floodlight.log 2>&1 &


设置Controller


ovs-vsctl set-controller ubuntu_br tcp:192.168.100.1:6633


[IMG]


访问floodlight的界面


[IMG]API


[IMG]API设定规则,只允许Instance01和Instance03之间相互通信


curl -d '{"switch": "00:00:2a:96:0e:c7:85:49", "name":"static-flow1", "cookie":"0", "priority":"32768", "src-mac":"52:54:00:9b:d5:11","active":"true", "actions":"output=12"}'  [IMG]-d '{"switch": "00:00:2a:96:0e:c7:85:49", "name":"static-flow2", "cookie":"0", "priority":"32768", "src-mac":"52:54:00:9b:d5:77","active":"true", "actions":"output=10"}'  [IMG]API清除所有规则


curl [IMG]-d '{"switch": "00:00:2a:96:0e:c7:85:49", "name":"static-flow1", "cookie":"0", "priority":"32768", "dst-mac":"52:54:00:9b:d5:11","active":"true", "actions":"output=10"}'  [IMG]-d '{"switch": "00:00:2a:96:0e:c7:85:49", "name":"static-flow2", "cookie":"0", "priority":"32768", "dst-mac":"52:54:00:9b:d5:33","active":"true", "actions":"output=11"}'  [IMG]-d '{"switch": "00:00:2a:96:0e:c7:85:49", "name":"static-flow3", "cookie":"0", "priority":"32768", "dst-mac":"52:54:00:9b:d5:77","active":"true", "actions":"output=12"}'  [IMG]Instance03,用tcpdump监听Instance02和Instance03,在这个过程中,用REST API将Instance03的包转发给Instance02


curl -d '{"switch": "00:00:2a:96:0e:c7:85:49", "name":"static-flow3", "cookie":"0", "priority":"32768", "dst-mac":"52:54:00:9b:d5:77","active":"true", "actions":"output=11"}'  http://16.158.166.150:8080/wm/staticflowentrypusher/json


[IMG]
借款2万,就能一口口吃掉你350万的房子!高校退休老师深陷“套路贷”,人民法院怒了! 容器化的本质?基于镜像的跨环境迁移 315晚会漏选名单:它们没上,可惜了! 《超级演说家》冠军刘媛媛:寒门出身到北大才女,优秀的人都在这件事上下苦功夫 究竟啥才是互联网架构“高并发”(有彩蛋)
好看吗?
总执行时间0.07768416404724121,文章查询时间0.05057716369628906,分类查询时间0.009894847869873047,其他脚本0.0003566741943359375,模板渲染0.016855478286743164