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 ...
随机推荐
- shell之dialog提示窗口
dialog 提示窗口 1.msgbox dialog --msgbox text 20 10 2.yesno dialog --title "Please answer&q ...
- php学习ing
cmd运行,表示在本地d:/php/workspace下文件映射在127.0.0.1的8080端口下,-S -t不要忘记 php -S 127.0.0.1:8080 -t E:\class_manag ...
- HDU 3954 Level up (线段树特殊懒惰标记)
http://blog.csdn.net/acm_cxlove/article/details/7548087 感觉最巧的是定义了min_dis……将区间内有无英雄升级分开处理 #include &l ...
- 熊猫(i)
题目描述 熊猫喜欢吃数,熊猫对与每个数都有他独特的评价.具体来说,熊猫对数 xx 的评价是个四元组 (a, b, c, d)(a,b,c,d),计算方式如下: 首先将 xx 写成二进制形式(不含前导零 ...
- Springboot-plus 安装使用的一些问题
最近在研究一些springboot的框架,然后看到了这个款 springboot plus ,下载下来研究下. 将安装部署的一些问题记录下来了. 第一个,就是部署的时候,我使用的MySQL数据库,导 ...
- Spring 3 MVC深入研究
一.前言: 大家好,Spring3 MVC是非常优秀的MVC框架,由其是在3.0版本发布后,现在有越来越多的团队选择了Spring3 MVC了.Spring3 MVC结构简单,应了那句话简单就是美,而 ...
- vue项目--favicon设置以及动态修改favicon
最近写公司项目时,动态更新favicon 动态更新之前需要有一个默认的favicon. 目前vue-cli搭建的vue项目里面已经有了一个static文件夹,存放静态文件. favicon图片放到该文 ...
- [ CodeVS冲杯之路 ] P3038
不充钱,你怎么AC? 题目:http://codevs.cn/problem/3038/ 按照题目给定的方法,一步步推下去,直到推到1就输出次数 至于-1的话,一开始想直接用数组判重,但是怕T掉,于是 ...
- 求LCA最近公共祖先的离线Tarjan算法_C++
这个Tarjan算法是求LCA的算法,不是那个强连通图的 它是 离线 算法,时间复杂度是 O(m+n),m 是询问数,n 是节点数 它的优点是比在线算法好写很多 不过有些题目是强制在线的,此类离线算法 ...
- Windows下安装Redis并注册为服务
1.安装 下载地址:https://github.com/MSOpenTech/redis/releases. Redis 支持 32 位和 64 位.这个需要根据你系统平台的实际情况选择,这里我们下 ...