RHEL6.0 QEMU/KVM 建立新的虚拟机之配置Birdged Networking

 

Bridged networking (aka, physical device sharing)被用来为Virtual machine 指定一个专门的物理网卡设备。

首先, 由于NetworkManager不支持bridging,所以,需要disable NetworkManager servcie. 这样才可以使用network scripts(/etc/sysconfig/network-scripting/ 目录下)来管理网络。

chkconfig NetworkManager off

chkconfig network on

service NetworkManager stop

service network start

接下来 创建bridge

1 chdir 到network scripts directory

# cd /etc/sysconfig/network-scripts

2 修改network interface来创建一个bridge

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

DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:1E:0B:EA:4C:C4"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
BRIDGE=br0

# eth0成为bridge的一部分

3 创建bridge script

在/etc/sysconfig/network-scripts/下创建一个新的network script ifcfg-br0。 主要注意br0是新建bridge的名字。新的ifcfg-br0的内容如下:

DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0

 

4配置完成以后,需要重启networking 或者reboot

service network restart

5 配置iptables

Configure iptables to allow all traffic to be forwarded across the bridge.
# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
# service iptables save
# service iptables restart

或者 disable iptables on bridges: 在/etc/sysctl.conf 配置文件中,添加如下行:

net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

通过sysctl 命令,然后重新加载kernel parameter

sysctl –p /etc/sysctl.conf

 

6 重新启动libvirt service

service libvirtd reload

7 验证bridge

brctl show

output:

bridge name bridge id STP enabled interfaces
virbr0 8000.000000000000 yes
br0 8000.000e0cb30550 no eth0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值