码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu14.04安装配置Open vSwitch

时间:2015-06-27 16:18:21      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

最近在研究学习Open vSwitch,准备在本地Ubuntu14.04机器上安装一下,并基于其创建一个KVM虚拟机,下面就简要记录下在Ubuntu14.04系统上安装Open vSwitch的过程。

1、由于之前安装了KVM,所以在本机生成了一个名为virbr0的bridge,这里我们需要事先将其删除,否则可能会与Open vSwitch产生不兼容的问题,命令如下:

??  virsh net-destroy default
Network default destroyed

??  virsh net-autostart --disable default
Network default unmarked as autostarted

2、这里我们同样也不需要bridge模块:

??  sudo aptitude purge ebtables
The following packages will be REMOVED:  
  ebtables{p} 
0 packages upgraded, 0 newly installed, 1 to remove and 37 not upgraded.
Need to get 0 B of archives. After unpacking 379 kB will be freed.
Do you want to continue? [Y/n/?] y
(Reading database ... 230918 files and directories currently installed.)
Removing ebtables (2.0.10.4-3ubuntu1) ...
 * Clearing ebtables rulesets                                                                                                                   [ OK ] 
Purging configuration files for ebtables (2.0.10.4-3ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...

3、下面开始安装openvswitch相关包:

??  sudo apt-get install openvswitch-switch

4、查看下ovs的运行状况:

??  ps -ea | grep ovs
10637 ?        00:00:00 ovsdb-server
10647 ?        00:00:00 ovs-vswitchd

5、查看下安装的ovs的版本:

??  ovs-appctl --version
ovs-appctl (Open vSwitch) 2.0.2
Compiled May 13 2015 18:49:53

6、查看下当前ovs支持的OpenFlow协议的版本:

??  ovs-ofctl --version
ovs-ofctl (Open vSwitch) 2.0.2
Compiled May 13 2015 18:49:53
OpenFlow versions 0x1:0x4

7、通过ovs创建一个网桥 br0,供kvm虚拟机使用:

??  sudo ovs-vsctl add-br br0
??  ifconfig
br0       Link encap:Ethernet  HWaddr 12:72:fd:75:e5:4b  
          inet6 addr: fe80::4c0a:7bff:fec6:98d7/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:578 (578.0 B)

通过ifconfig命令,我们发现多了一个br0网桥。

8、将物理网卡eth0添加到br0上:

??  sudo ovs-vsctl add-port br0 eth0

这步执行后,发现无法再访问外网,不过没关系,我们可以按照如下步骤解决:

1)先清除eth0的配置:

??  sudo ifconfig eth0 0

2)让br0自动获取ip地址:

??  sudo dhclient br0

3)此时就又可以通外网了:

??  ping www.baidu.com
PING www.a.shifen.com (119.75.217.109) 56(84) bytes of data.
64 bytes from 119.75.217.109: icmp_seq=1 ttl=54 time=30.9 ms
64 bytes from 119.75.217.109: icmp_seq=2 ttl=54 time=31.9 ms

9、最后查看下目前br0和eth0的情况:

??  sudo ovs-vsctl show
1e6548a9-956e-4b86-b743-f8da0aa2b922
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "eth0"
            Interface "eth0"
    ovs_version: "2.0.2"

 

Ubuntu14.04安装配置Open vSwitch

标签:

原文地址:http://www.cnblogs.com/CasonChan/p/4603873.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!