现在的位置: 首页 > 综合 > 正文

how to config bridge in RHEL

2019年03月12日 ⁄ 综合 ⁄ 共 2634字 ⁄ 字号 评论关闭

文/一觉亮天

 

Bridging is a forwarding technique used in packet-switched computer networks. Unlike routing, bridging makes no assumptions about where in a network a
particular address is located. Instead, it depends on flooding and examination of source addresses in received packet headers to locate unknown devices. Once a device has been located, its location is recorded in a table where the MAC address is stored so
as to preclude the need for further broadcasting. The utility of bridging is limited by its dependence on flooding, and is thus only used in local area networks.[ref-1]

 

Above description is a traditional interpretation and logical concept. After virtualization era comes, bridges may exist in a host with virtual machines
running on it, and service as interfaces for virtual machines’ communicating with outer world.

 

For example,
a KVM virtual machine running on RHEL 5 has two options in terms of networking connectivity. [ref-3]

 

One option is for it to be connected to a virtual network running within the operating system of the host computer.
In this configuration any virtual machines on the virtual network can see each other but access to the external network is provided by Network Address Translation (NAT). When using the virtual network and NAT, each virtual machine is represented on the external
network (the network to which the host is connected) using the IP address of the host system. This is the default behavior for KVM virtualization and requires no additional configuration, other than selecting the Virtual network option on the Network screen
of the virt-manager new virtual machine wizard. Typically, a single virtual network is created by default, represented by the name default and the device virbr0.

 

In order for guests to appear as individual and independent systems on the external network (i.e. with their own
IP addresses), they must be configured to share a physical network interface on the host. This is achieved by configuring a network bridge interface on the host system to which the guests can connect. In the remainder of this chapter we will cover the steps
necessary to configure an RHEL 5 network bridge for use by KVM based guest operating systems.

 

Suppose we have only 1 network interface which is eth0, and we want to configure a bridge named kvm and assign an IP to it. In /etc/sysconfig/network-scripts
directory, configure a fake interface with the name “ifcfg-kvm” besides ifcfg-eth0. Execute “service network restart” and then the IP takes effect. Pay attention to DEVICE name, “BRIDGE=kvm”, and “TYPE=Bridge”. [ref-2]

 

Followed config files. 

 

#ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=none

HWADDR=1C:C1:DE:04:5F:D8

BRIDGE=kvm

 

#ifcfg-kvm

DEVICE=kvm

TYPE=Bridge

ONBOOT=yes

IPADDR=192.168.1.2

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

 

Reference

[ref-1]

http://en.wikipedia.org/wiki/Network_bridge

[ref-2]

http://www.cyberciti.biz/faq/rhel-linux-kvm-virtualization-bridged-networking-with-libvirt/

[ref-3]

http://www.techotopia.com/index.php/Creating_an_RHEL_5_KVM_Networked_Bridge_Interface

 

 

 

 

抱歉!评论已关闭.