Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1743347
  • 博文数量: 391
  • 博客积分: 8464
  • 博客等级: 中将
  • 技术积分: 4589
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-13 15:12
个人简介

狮子的雄心,骆驼的耐力,孩子的执著!

文章分类

全部博文(391)

文章存档

2023年(4)

2018年(9)

2017年(13)

2016年(18)

2014年(7)

2013年(29)

2012年(61)

2011年(49)

2010年(84)

2009年(95)

2008年(22)

分类: 虚拟化

2010-01-08 15:53:01

How do I configure a bridged network interface for KVM using Red Hat Enterprise Linux 5.4 or later?
 

Issue

How do I configure a bridged network interface for KVM using Red Hat Enterprise Linux 5.4 or later?

Environment

Red Hat Enterprise Linux 5.4 or later versions

Resolution

By default, kvm uses NAT networking. If you want your guest to appear as another host on the LAN which is the same network with the host, you need to use bridged network. However, virtualization hosts configured to use KVM will not automatically create a bridged interface for the Ethernet devices on your system.


Before performing the following steps, you should connect to the server using a physical or serial session as changes to the network configuration files may cause the network interfaces to not restart correctly.


Stop the Ethernet device that you plan to create a bridge for using the ifdown command


# ifdown eth0


To create the bridged interface named 'br0' you must edit your /etc/sysconfig/network-scripts/ifcfg-ethX file and include the line:


BRIDGE=br0


Once this has been done, the configuration file will look similar to:


DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
BRIDGE=br0


If using static IP, the configuration file will look similar to:


DEVICE=eth0
BOOTPROTO=static
HWADDR=XX:XX:XX:XX:XX:XX
IPADDR=
NETMASK=
GATEWAY=
ONBOOT=yes
BRIDGE=br0


Now create a file /etc/sysconfig/network-scripts/ifcfg-br0 (replace br0 with the chosen name for the bridge) with the following contents:


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


Start the Ethernet device and the bridge device using the ifup command


	

#service libvirtd start

#service messagebus start

#service haldaemon start # ifup eth0 # ifup br0


Test to make sure that the host can still communicate with the network


# ping 


If a firewall is running on your host system, you need to add a new rule shown below into the /etc/sysconfig/iptables file.


-A RH-Firewall-1-INPUT -i br0 -j ACCEPT 


Then, restart firewall:


# service iptables restart 


For more detailed information about bridged networking on KVM environment, please refer to the following official document:


 Reference :

 

阅读(746) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~