CentOS

1.创建用以桥接的虚拟网卡

# cd /etc/sysconfig/network-scripts 

# cp ifcfg-eth0 ifcfg-br0

2. 编辑 ifcfg-br0

# vi ifcfg-br0 

DEVICE="br0"
TYPE="Bridge"
ONBOOT="yes"
BOOTPROTO=static
IPADDR=192.168.1.17
PREFIX=24
GATEWAY=192.168.1.1
DNS1=202.106.46.151

DELAY=0 

3.编辑ifcfg-eth0 

# vi ifcfg-eth0 

DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BRIDGE="br0"
BOOTPROTO=none
IPADDR=192.168.1.17
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
DNS1=202.106.46.151

HWADDR=00:1E:67:07:EC:30 

4.重新启动网络

# service network restart  

ubuntu

1.编辑interfaces,设置网桥

# vi /etc/network/interfaces

auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.88.3
netmask 255.255.255.0
gateway 192.168.88.1
      bridge_ports eth0
      bridge_fd 0
      bridge_hello 2
      bridge_maxage 12
      bridge_stp off

2.重启网络

# /etc/init.d/networking restart

3. 查看新的网络配置

#brctl show