惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
P
Privacy International News Feed
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 叶小钗
F
Fortinet All Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 最新话题
AWS News Blog
AWS News Blog
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
Recent Announcements
Recent Announcements
Recent Commits to openclaw:main
Recent Commits to openclaw:main
PCI Perspectives
PCI Perspectives
Cloudbric
Cloudbric
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
IT之家
IT之家
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
J
Java Code Geeks
M
MIT News - Artificial intelligence
Cisco Talos Blog
Cisco Talos Blog
V2EX - 技术
V2EX - 技术
Webroot Blog
Webroot Blog
Microsoft Security Blog
Microsoft Security Blog
Cyberwarzone
Cyberwarzone
博客园 - 聂微东
G
Google Developers Blog
W
WeLiveSecurity
罗磊的独立博客
P
Privacy & Cybersecurity Law Blog
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
T
Tailwind CSS Blog
V
Visual Studio Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Secure Thoughts
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
Google DeepMind News
Google DeepMind News
雷峰网
雷峰网
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
F
Full Disclosure
Blog — PlanetScale
Blog — PlanetScale
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed

博客园 - YY哥

在github上写博客 从veth看虚拟网络设备的qdisc 深入学习golang(5)—接口 深入学习golang(4)—new与make 深入学习golang(3)—类型方法 深入学习golang(2)—channel 深入学习golang(1)—数组与切片 Docker实践(6)—CentOS7上部署Kubernetes CoreOS实践(2)—在coreos上安装Kubernetes Docker实践(5)—资源隔离 CoreOS实践(1)—CoreOS初体验 Docker实践(4)—network namespace与veth pair Ceph monitor故障恢复探讨 环回接口(loopback interface)的新认识 Docker实践(3)—浅析device mapper的thin provision Docker实践(2)—虚拟网络 Docker实践(1)—入门 gpg的一些常用操作 Open vSwitch实践——VLAN
CentOS6.5下安装Open vSwitch
YY哥 · 2014-07-12 · via 博客园 - YY哥

准备

yum install openssl-devel redhat-rpm-config kernel-devel -y

#yum install kvm libvirt python-virtinst qemu-kvm virt-viewer

编译

wget http://openvswitch.org/releases/openvswitch-1.9.3.tar.gz

#tar -zxf openvswitch-1.9.3.tar.gz

# cd openvswitch-1.9.3

cp ../openvswitch-1.9.3.tar.gz ~/rpmbuild/SOURCES/

cp rhel/openvswitch-kmod.files ~/rpmbuild/SOURCES/

cp rhel/openvswitch.spec ~/rpmbuild/SPECS/

rpmbuild  -ba ~/rpmbuild/SPECS/openvswitch.spec

cp rhel/openvswitch-kmod-rhel6.spec ~/rpmbuild/SPECS/

ls ~/rpmbuild/RPMS/x86_64/ |grep open

kmod-openvswitch-1.9.3-1.el6.x86_64.rpm

openvswitch-1.9.3-1.x86_64.rpm

openvswitch-debuginfo-1.9.3-1.x86_64.rpm

rpm -ihv openvswitch-1.9.3-1.x86_64.rpm  kmod-openvswitch-1.9.3-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

   1:kmod-openvswitch       ########################################### [ 50%]

WARNING: /lib/modules/2.6.32-431.el6.x86_64/weak-updates/openvswitch/brcompat.ko needs unknown symbol ovs_dp_ioctl_hook

   2:openvswitch            ########################################### [100%]

使用openvswitch

virsh net-destroy default

virsh net-autostart --disable default

service openvswitch start

/etc/openvswitch/conf.db does not exist ... (warning).

Creating empty database /etc/openvswitch/conf.db [  OK  ]

Starting ovsdb-server [  OK  ]

Configuring Open vSwitch system IDs [  OK  ]

Inserting openvswitch module [  OK  ]

Starting ovs-vswitchd [  OK  ]

Enabling gre with iptables [  OK  ]

NewImage

ovs-vsctl add-br br0

/etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0

ONBOOT=yes

DEVICETYPE=ovs

TYPE=OVSBridge

BOOTPROTO=static

IPADDR=172.16.213.131

NETMASK=255.255.255.0

GATEWAY=172.16.213.2

HOTPLUG=no

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

DEVICETYPE=ovs

TYPE=OVSPort

OVS_BRIDGE=br0

BOOTPROTO=none

HOTPLUG=no

service network restart

ovs-vsctl show

1bc18f94-0b5c-44c2-afd5-ac7d370499f1

    Bridge "br0"

        Port "eth0"

            Interface "eth0"

        Port "br0"

            Interface "br0"

                type: internal

ovs_version: "1.9.3"

NewImage

KVM中使用OVS

yum install bridge-utils tunctl

[root@yinye ~]# virt-install --name=centos65 --ram 512 --vcpus=1  -f /root/kvm/centos65.qcow2 --cdrom /root/CentOS-6.5-x86_64-minimal.iso --graphics vnc,listen=0.0.0.0,port=5920,  --network bridge=br0

WARNING  KVM acceleration not available, using 'qemu'

开始安装......

ERROR    Unable to add bridge br0 port vnet0: Operation not supported

Domain installation does not appear to have been successful.

If it was, you can restart your domain by running:

  virsh --connect qemu:///system start centos65

otherwise, please restart your installation.

如果不在命令行指定bridgeopenvswitch类型 libvirt会尝试linux默认的bridge,而virt-install又不支持openvswitch

详细参考

https://www.redhat.com/archives/libvirt-users/2013-May/msg00043.html

virt-install --connect qemu:///system --name=centos65 --ram 512 --vcpus=1  -f /home/kvm/centos65.qcow2 --cdrom /home/kvm/CentOS-6.5-x86_64-minimal.iso --graphicsvnc,listen=0.0.0.0,port=5920,  --nonetworks

NewImage

NewImage

NewImage

virsh # edit centos65

增加

<interface type='bridge'>

 <source bridge='br0'/>

 <virtualport type='openvswitch' />

 <model type='virtio'/>

</interface>

virsh # start centos65

NewImage

配置guest os的网卡

cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

TYPE=Ethernet

HWADDR=52:54:00:D8:D7:FB

BOOTPROTO=dhcp

#ifup eth0


作者:YY哥
出处:http://www.cnblogs.com/hustcat/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。