网桥与kvm桥接

网桥的功能有两个:
一.连接不同的网段,使得不同网段的主机之间无需通过路由就可以传输数据,交换机就起到这种功能。如果两个不同网段通过网桥连接的话,那么每台主机的route表都应当包含这两个网段的路由选项了。也就理解了鸟哥的route表这么奇怪了:
[root@linux ~]# route -n 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface        192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0 
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0 
0.0.0.0         192.168.10.30   0.0.0.0         UG    0      0        0 eth0 
二.体会最深的就是虚拟机的桥接了。
ubuntu下kvm桥接,先安装
apt-get install bridge-utils uml-utilities
配置/etc/network/interfaces:
 
    
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
 address 192.168.2.110
 network 192.16821.0
 netmask 255.255.255.0
 gateway 192.168.2.1
 broadcast 192.168.2.255

auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user yourname
auto br0
iface br0 inet static 
address 192.168.1.111
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge_ports eth0 tap0
bridge_stp off
 
     
bridge_fd 0
bridge_maxwait 0

启动kvm虚拟机:
kvm -smp 2 -m 1024 -net nic,vlan=0,macaddr=52-54-00-12-34-01 -net tap,vlan=0,ifname=tap0,script=no -hda ~/kvm/image/ubuntu11.10.qcow2

参考资料:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值