zoukankan      html  css  js  c++  java
  • 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 machines

    question

    resolution

    By default, kvm uses NAT networking through a libvirt-managed bridge called virbr0. If you require your guest to appear as another host on the same network as the hypervisor, a bridged interface may be used to achieve this. However, virtualization hosts configured to use KVM will not automatically create a bridged interface for the Ethernet devices on your system. A configuration must be created to set up the bridge when the network is started.

    Note: The host should be accessed through a console or serial session as changes to the network configuration files may cause the network access to be lost.

    Configuration Tool

    Red Hat supply a KVM Bridge Configuration tool via the Customer Portal:  https://access.redhat.com/labs/kvmbridgeconfiguration/

    Manual Configuration

    • If the interface that will be bridged is currently running, stop it using the ifdown command. For example:
    # ifdown eth0

    Now two files will be created or modified to setup the bridge (ifcfg-brX) and physical interface (ifcfg-ethX). Change to the /etc/sysconfig/network-scripts directory:

    # cd /etc/sysconfig/network-scripts
    • Open the network script for the device you are adding to the bridge. In this example, ifcfg-eth0 defines the physical network interface which is part of a bridge:
    DEVICE=eth0
    HWADDR=00:16:76:D6:C9:45    # change the hardware address to match the hardware address your NIC uses
    ONBOOT=yes
    BRIDGE=br0
    NM_CONTROLLED=no
    • Create a new network script in the /etc/sysconfig/network-scripts directory called ifcfg-br0 or similar. The br0 is the name of the bridge, this can be anything as long as the name of the file is the same as the DEVICE parameter, and the name is specified correctly in the previously created physical interface configuration (ifcfg-ethX):
    DEVICE=br0
    TYPE=Bridge
    BOOTPROTO=dhcp
    ONBOOT=yes
    DELAY=0

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

    DEVICE=br0
    TYPE=Bridge
    BOOTPROTO=static
    IPADDR=<Static IP address>
    NETMASK=<Netmask>
    GATEWAY=<Gateway>
    ONBOOT=yes
    • Start the Ethernet device and the bridge device using the ifup command:
    # ifup eth0
    # ifup br0
    • Test to make sure that the host can still communicate with the network:
    # ping www.redhat.com
    • Add the lines below into /etc/sysctl.conf:
    net.ipv4.ip_forward = 1
    
    net.bridge.bridge-nf-call-ip6tables = 0
    net.bridge.bridge-nf-call-iptables = 0
    net.bridge.bridge-nf-call-arptables = 0

    Apply the configurations:

    # sysctl -p /etc/sysctl.conf
    • Now, reload the libvirt daemon:
    # service libvirtd reload
    • Check the bridges:
    # brctl show

    For more detailed information about bridged networking on KVM environment, please refer to the RHEL 5 or RHEL 6 Virtualization Guides.

    Alternatively, a bridge can be created using the virt-manager GUI program, however this sort of bridge will be started with the libvirt service on boot, so should not be used as the primary network connectivity for the hypervisor.

    
    
  • 相关阅读:
    uva 1510
    ADN中国团队參加微软的Kinect全国大赛获得三等奖
    在 window7 window8下公布webService注意问题
    html5调用手机摄像头,实现拍照上传功能
    4、深入理解Bean
    恶补jquery(四)jquery中事件--冒泡
    html5css3杂记
    Core Data 和 sqlite3的性能对比【图】3gs,iPhone4,4s,5的性能测试。
    boost 的函数式编程库 Phoenix入门学习
    information_schema模式表介绍 processlist
  • 原文地址:https://www.cnblogs.com/echo1937/p/6236914.html
Copyright © 2011-2022 走看看