1. Disable NetworkManager
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start
# ifdown eth0
2. Create a new bridge
a. Create a new network script file in the /etc/sysconfig/network-scripts/ directory.
This example creates a file named ifcfg-bridge0
# cd /etc/sysconfig/network-scripts/
# vi ifcfg-bridge0
DEVICE=bridge0
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.44.16
PREFIX=24
GATEWAY=192.168.44.200
DNS1=210.22.84.3
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
DELAY=0
Note: The line, TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'
vi ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
NM_CONTROLLED=yes
HWADDR=00:0C:29:87:79:59
IPV6INIT=no
BRIDGE=bridge0
ifup eth0
ifup bridge0
# brctl show
bridge name bridge id STP enabled interfaces
bridge0 8000.000c29877959 no eth0
virbr0 8000.525400e39bab yes virbr0-nic
3.Security configuration
Configure iptables to allow all traffic to be forwarded across the bridge.
# iptables -I INPUT -i bridge0 -j ACCEPT
# service iptables save
# service iptables restart
4.Dsiable STP on virbr0
# brctl stp virbr0 off
# brctl show
bridge name bridge id STP enabled interfaces
bridge0 8000.000c29877959 no eth0
virbr0 8000.525400e39bab no virbr0-nic
转载于:https://blog.51cto.com/hj192837/1033378