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

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

文章分类

全部博文(388)

文章存档

2018年(9)

2017年(13)

2016年(19)

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 www.redhat.com


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:


http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.4/html/Virtualization_Guide/sect-Virtualization-Network_Conf iguration-Bridged_networking_with_libvirt.html

 Reference :http://kbase.redhat.com/faq/docs/DOC-19071

 

阅读(585) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册