xy123321 发表于 2018-5-5 14:28:29

CentOS/Ubuntu 的桥接配置

  测试环境: centos 6
   首先,安装软件包:bridge-utils (yum install bridge-utils)


[*]# cat ifcfg-br0
[*]DEVICE="br0"
[*]BOOTPROTO="static"
[*]NM_CONTROLLED="no"
[*]ONBOOT="yes"
[*]TYPE="Bridge"
[*]IPADDR=192.168.6.219
[*]NETMASK=255.255.255.0
[*]GATEWAY=192.168.6.1
[*]# cat ifcfg-eth0
[*]DEVICE="eth0"
[*]BOOTPROTO="static"
[*]NM_CONTROLLED="no"
[*]ONBOOT="yes"
[*]TYPE="Ethernet"
[*]BRIDGE="br0"
[*]# cat ifcfg-eth1
[*]DEVICE="eth1"
[*]BOOTPROTO="static"
[*]NM_CONTROLLED="no"
[*]ONBOOT="yes"
[*]TYPE="Ethernet"
[*]BRIDGE="br0"
[*]# uname -a
[*]Linux centos 2.6.32-279.19.1.el6.i686 #1 SMP Wed Dec 19 04:30:58 UTC 2012 i686 i686 i386 GNU/Linux
[*]#
  
测试环境:Ubuntu 1204
首先安装bridge-utils (apt-get install bridge-uitls)

[*]auto br0
[*]iface br0 inet static
[*]      address 192.168.6.218
[*]      netmask 255.255.255.0
[*]      bridge_ports eth0 eth1
[*]      bridge_stp on
[*]      bridge_maxwait 0
[*]      gateway 192.168.6.1
[*]      dns-nameservers 202.106.0.20

[*]root@ubuntu:/etc/network# brctl show br0
[*]bridge name   bridge id               STP enabled   interfaces
[*]br0             8000.000c29de7d91       yes             eth0
[*]                                                      eth1
页: [1]
查看完整版本: CentOS/Ubuntu 的桥接配置