赞
踩
目录
(1) 主机
表1 宿主机
主机 | 架构 | 软件 | IP | 网卡 | 备注 |
ovs_controller | 控制端 | karaf 0.7.3 | 192.168.204.63 | 1个NAT网卡 (204网段) | |
ovs_server01 | 服务端 | OpenvSwitch v2.5.1 | 192.168.204.61 | 1个NAT网卡 (204网段), 1个仅主机网卡 (88网段) | 已部署 |
ovs_server02 | 服务端 | OpenvSwitch v2.5.1 | 192.168.204.62 | 1个NAT网卡 (204网段), 1个仅主机网卡 (88网段) | 已部署 |
表2 目标云主机
云主机 | IP | 备注 |
cloudserver01 | 172.16.1.1 | 宿主机ovs_server01 |
cloudserver02 | 172.16.1.2 | 宿主机ovs_server02 |
(2) 查看IP
ovs_controller
ovs_server01
ovs_server02
(3)查看OVS
ovs-vsctl show
ovs_server01
ovs_server02
(4)打印OVS的汇总信息
ovs_server01
ovs-appctl fdb/show ovs01
ovs_server02
ovs-appctl fdb/show ovs02
(1)查阅OpenDaylight
- 1)下载
- https://docs.opendaylight.org/en/latest/downloads.html
-
- 2)按照说明
- https://docs.opendaylight.org/en/latest/getting-started-guide/installing_opendaylight.html
(2)创建目录
mkdir /opt/java
(3)jre解压
- cp server-jre-8u301-linux-x64.tar.gz /opt/java
- cd /opt/java
- tar -zxvf server-jre-8u301-linux-x64.tar.gz
(4)修改环境变量
- vim /etc/profile
- ……
- export JAVA_HOME=/opt/java/jdk1.8.0_301
- export JRE_HOME=/opt/java/jdk1.8.0_301
- export CLASSPATH=$JRE_HOME/lib/rt.jar:$JRE_HOME/lib/ext
- export PATH=$PATH:$JRE_HOME/bin
(5)更新环境变量
source /etc/profile
(6)odl解压
unzip karaf-0.7.3.zip
(7)关闭防⽕墙
- systemctl stop firewalld.service
- systemctl disable firewalld.service
(8)开启ODL服务
/root/karaf-0.7.3/bin/karaf
(9)按照特性功能插件
- feature:install odl-restconf
- feature:install odl-l2switch-switch-ui
- feature:install odl-mdsal-apidocs
- feature:install odl-dluxapps-applications
- feature:install odl-dluxapps-yangui
- feature:install odl-restconf-all
(10)访问
http://192.168.204.63:8181/index.html#/login
(11)登录
- 账户: admin
- 密码: admin
进入系统
(1)服务端添加云交换机
ovs_server01
- ovs-vsctl add-br ovs11
- ovs-vsctl show
ovs_server02
- ovs-vsctl add-br ovs12
- ovs-vsctl show
(2)服务端云交换机添加控制器
ovs_server01
- ovs-vsctl set-controller ovs11 tcp:192.168.204.63:6633
- ovs-vsctl show
ovs_server02
- ovs-vsctl set-controller ovs12 tcp:192.168.204.63:6633
- ovs-vsctl show
(3)ODL查看
Nodes节点信息
Topology拓扑信息
(4)服务端查看网络信息
ovs_server01的仅主机网卡为ens36
ovs_server02的仅主机网卡为ens36
(5)服务端云交换机添加物理端⼝(仅主机网卡)
ovs_server01
- ovs-vsctl add-port ovs11 ens36
- ovs-vsctl show
ovs_server02
- ovs-vsctl add-port ovs12 ens36
- ovs-vsctl show
(6)ODL查看
Nodes节点连接变为2
Topology拓扑信息变为连接状态
(7) 查看OVS流表节点
ovs_server01
ovs-ofctl show ovs11 -O OpenFlow13
ovs_server02
ovs-ofctl show ovs12 -O OpenFlow13
(8) 查看OVS流表信息
ovs_server01
ovs-ofctl dump-flows ovs11 -O OpenFlow13
ovs_server02
ovs-ofctl dump-flows ovs12 -O OpenFlow13
(9)LLDP流量抓包
ovs_server01 的MAC地址为00:0c:29:50:7a:08,openflow流表为52232747528
ovs_server02的MAC地址为 00:0c:29:d5:c1:24 ,openflow流表为52241482020
(9)服务端云交换机添加接口
ovs_server01
- ovs-vsctl add-port ovs11 if11 -- set interface if11 type=internal
- ovs-vsctl show
ovs_server02
- ovs-vsctl add-port ovs12 if12 -- set interface if12 type=internal
- ovs-vsctl show
(9)ODL查看
Nodes节点连接变为3
(10) 查看OVS流表节点
ovs_server01
ovs-ofctl show ovs11 -O OpenFlow13
ovs_server02
ovs-ofctl show ovs12 -O OpenFlow13
(11)cloudserver01云主机修改网卡
进入
已关闭
修改网卡为if11
开机(选择命令行模式)
进入系统
(12)cloudserver02云主机修改网卡
进入
已关闭
修改网卡为if12
开机(选择命令行模式)
进入系统
(13)云主机修改网卡
cloudserver01
-
- sudo ifconfig eth0 172.16.1.1 netmask 255.255.255.0
cloudserver02
sudo ifconfig eth0 172.16.1.2 netmask 255.255.255.0
(14)测试网络
云主机1 ping 云主机2 ,目前不通
(1) 查看OVS流表节点
ovs_server01
ovs-ofctl show ovs11 -O OpenFlow13
ovs_server02的云主机需要从2口进,1口出
ovs-ofctl show ovs12 -O OpenFlow13
(2)流量分析
表3 流量分析
云主机cloudserver01 | 流向 | 云主机cloudserver01 |
in_port=2,action=output:1 | → | in_port=1,action=output:2 |
in_port=1,action=output:2 | ← | in_port=2,action=output:1 |
(3)服务端添加流表
ovs_server01
- ovs-ofctl add-flow ovs11 -O Openflow13 in_port=1,action=output:2
- ovs-ofctl add-flow ovs11 -O Openflow13 in_port=2,action=output:1
ovs_server02
- ovs-ofctl add-flow ovs12 -O Openflow13 in_port=1,action=output:2
- ovs-ofctl add-flow ovs12 -O Openflow13 in_port=2,action=output:1
(3) 查看OVS流表信息
ovs_server01
ovs-ofctl dump-flows ovs11 -O OpenFlow13
ovs_server02
ovs-ofctl dump-flows ovs12 -O OpenFlow13
(4) 测试网络
云主机1 ping 云主机2 ,目前已通
(1) 云主机关机
cloudserver01
cloudserver02
(2)云主机切换原网卡
cloudserver01
cloudserver02
(3)服务端删除云交换机
ovs_server01
- ovs-vsctl del-br ovs11
- ovs-vsctl show
ovs_server02
- ovs-vsctl del-br ovs12
- ovs-vsctl show
(4)查看ODL
目前为空
(1)开启
/root/karaf-0.7.3/bin/karaf
(2)查询
feature:list -i
(1)报错
添加2条流表后显示不全
(2)原因分析
ODL未开启。
(3)解决方法
开启ODL:
/root/karaf-0.7.3/bin/karaf
显示成功:
(1)删除
ovs_server01
- ovs-ofctl del-flows ovs11 -O Openflow13 in_port=1,out_port=2
- ovs-ofctl del-flows ovs11 -O Openflow13 in_port=2,out_port=1
ovs_server02
- ovs-ofctl del-flows ovs12 -O Openflow13 in_port=1,out_port=2
- ovs-ofctl del-flows ovs12 -O Openflow13 in_port=2,out_port=1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。