KVM Network Bridging
from http://hzqtc.github.io/2012/02/kvm-network-bridging.html
http://wiki.ubuntu.org.cn/Kvm_%E7%BD%91%E7%BB%9C%E6%A1%A5%E6%8E%A5%E6%96%B9%E6%A1%88
http://lilinji.blog.51cto.com/5441000/1264307
https://help.ubuntu.com/community/KVM/Networking
As many other hypervisors, KVM provide several types of networking. KVM use NAT in default, in which case the guest can reach the outside world (the host and all place the host can reach) but the outside world cannot reach the guest. That means, if you don’t need to access the guest through network (SSH for example), NAT is good enough for you. However, if you want more, let me introduce you the bridging way.
Concept
In a typical bridged network environment, all guest are connected to a virtual bridge. A host network interface is also connected to the bridge. The packets are forwarded to the guests based on their MAC address, just like any other bridges. In more detai, each guest has a corresponding tap device in the host. These tap devices are both connected to the bridge and the guest, as a network channel.

桥接基本原理:
eth0(本地物理网卡)<---br0(桥)--->tap0,tap1….(tap是给kvm guest使用的接口)
1、创建桥
#一般一个机器一个桥即可
sudo brctl addbr br0
2、创建若干tap,KVM需要几个虚拟网卡,就几个
sudo tunctl -t tap0 -u liheyuan
sudo tunctl -t tap1 -u liheyuan
……
3、把eth0,tapX绑定到br0上,eth0肯定要绑定 不然没法上网,tap若干个绑定
sudo brctl addif br0 eth0
sudo brctl addif br0 tap0
sudo brctl addif br0 tap1
……
4、把br0设置成原来eth0的IP,eth0设置为混杂模式
sudo ifconfig br0 192.168.1.33
sudo ifconfig eth0 0.0.0.0 promisc
5、启动所有的tapX,br0是默认启动的,tapX不是
sudo ifconfig tap0 up
sudo ifconfig tap1 up
……
6、修改默认网关,改默认网关,不然只能内网通信!
sudo route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.1.1
6、KVM启动
#tap0 guest的eth0
-net nic,name=k1,macaddr=00:11:22:33:66:55
-net tap,vlan=0,name=k1,ifname=tap0,script=no,downscript=no
#tap1 guest的eth1
-net nic,name=k2,macaddr=00:11:22:33:66:56
-net tap,vlan=0,name=k2,ifname=tap1,script=no,downscript=no
--------------------------------------------------------------------------------------------------------------------------------------------
KVM桥接网络的方法:大部分不能桥接无线网卡。。。只能桥接PCI网卡。
KVM Network Bridging的更多相关文章
- kvm虚拟化二: 字符界面管理及 无人值守安装
1. 安装必要工具yum install / tigervnc //vnc远程桌面客户端 virt-viewer //虚拟机查看器 2.安装虚拟机virt-install / -n 名字 //虚拟机名 ...
- [转]Debugging the Mac OS X kernel with VMware and GDB
Source: http://ho.ax/posts/2012/02/debugging-the-mac-os-x-kernel-with-vmware-and-gdb/ Source: http:/ ...
- zabbix 3.2 高可用实现方式二-pacemaker+corosync实现zabbix高可用集群
一.pacemaker 是什么 1.pacemaker 简单说明 2.pacemaker 由来 二.pacemaker 特点 三.pacemaker 内部结构 1.群集组件说明: 2.功能概述 四.c ...
- VNF网络性能提升解决方案及实践
VNF网络性能提升解决方案及实践 2016年7月 作者: 王智民 贡献者: 创建时间: 2016-7-20 稳定程度: 初稿 修改历史 版本 日期 修订人 说明 1.0 20 ...
- OpenStack Networking – FlatManager and FlatDHCPManager
最好的分析FlatDHCPManager的源文,有机会把这篇翻译了 =========================== Over time, networking in OpenStack has ...
- Virtual Machine Definition File 2.2
Virtual Machine Definition File 2.2 http://archives.opennebula.org/documentation:archives:rel2.2:tem ...
- minikube 安装试用
目前使用k8s 要么用的物理机搭建的环境,要么就是使用docker for mac 中kubernetes 的特性,为了本地调试方便,使用下minikube minukube 包含的特性 负载均衡器 ...
- minikube国内在线部署体验
问题描述: 快速学习k8s的各个组件的作用及yml的编写,minikube很适合. how to install Minikube, a tool that runs a single-node Ku ...
- Configure a bridged network interface for KVM using RHEL 5.4 or later?
environment Red Hat Enterprise Linux 5.4 or later Red Hat Enterprise Linux 6.0 or later KVM virtual ...
随机推荐
- springboot13 Hikari 和Introspector
SpringBoot Initializr Introspector(内省) class TestReflect { @Test fun testReflect() { //获取字节码对象 val c ...
- Codeforces Round #329(Div2)
CodeForces 593A 题意:n个字符串,选一些字符串,在这些字符串中使得不同字母最多有两个,求满足这个条件可选得的最多字母个数. 思路:用c[i][j]统计文章中只有i,j对应两个字母出现的 ...
- J2EE的十三种技术——JNDI
背景: 上一篇博客中介绍了J2EE的十三种技术之一--JDBC,主要用于提供了统一访问多种数据库的方式.这篇文章我们继续介绍J2EE的技术--JNDI. JNDI: Java Naming and D ...
- java 两个csv文件数据去重
1.pom.xml配置 <dependency> <groupId>commons-io</groupId> <artifactId>commons-i ...
- table隔行变色【转】
table tr:nth-child(odd){background:#F4F4F4;} table td:nth-child(even){color:#C00;} table tr:nth-chil ...
- HDU 1087 最大上升子序列的和
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- angular控制器controller里获取不到ng-model的值,获取为undefined
所遇问题: html:ng-model=“test”, 但是在controller里打印的$scope属性里面并未发现test,控制台打印test为undefined,页面上{{test}}却可以正常 ...
- 转:Java NIO(3)
要想讲清楚nio的原理和它的优点得先清楚Java应用程序的文件读写原理和虚拟内存的原理.Java文件读取原理可参见如下图: 当应用程序需要读取文件的时候,内核首先通过DMA技术将文件内容从磁盘读入内核 ...
- 关于SelectedValue的众多解决方案
Combox联动效果
- [bzoj2127]happiness——最小割
这个题太恶心了...并不想继续做了... 本代码在bzoj上TLE! 大致说一下思路: 建立ST,首先由S连边(S,u,a)a代表学文的分数,连向T(u,T,b)b表示学理的分数,这样构造出了两个人独 ...