一.非桥接模式:
配置:/etc/sysconfig/network-scripts/ifcfg-eth0,如下:
DEVICE="eth0"
HWADDR="11:11:11:11:11:11"NM_CONTROLLED="yes"ONBOOT="yes"BOOTPROTO=staticIPADDR=192.168.77.103NETMASK=255.255.255.0GATEWAY=192.168.77.1二.桥接模式:
1.配置/etc/sysconfig/network-scripts/ifcfg-eth0,如下:
DEVICE="eth0"
TYPE=ethernetHWADDR="11:11:11:11:11:11"NM_CONTROLLED="no"ONBOOT="yes"#BOOTPROTO=static#IPADDR=192.168.77.103#NETMASK=255.255.255.0#GATEWAY=192.168.77.1BRIDGE=br02.配置/etc/sysconfig/network-scripts/ifcfg-br0,如下:
DEVICE="br0"TYPE=BridgeBOOTPROTO=staticIPADDR=192.168.77.103NETMASK=255.255.255.0#NETWORK=192.168.1.0GATEWAY=192.168.77.1#HWADDR="11:11:11:11:11:11"#NM_CONTROLLED="yes"ONBOOT="yes"NM_CONTROLLED=no3.[可略]配置/etc/sysconfig/network-scripts/ifcfg-eth1,如下:
DEVICE="eth1"HWADDR="78:2B:CB:65:25:EC"NM_CONTROLLED="yes"ONBOOT="yes"BOOTPROTO=staticIPADDR=10.10.10.103#netmask=255.255.255.0#GATEWAY=10.10.10.14.修改/etc/sysctl.conf 文件,并增加如下:
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0net.bridge.bridge-nf-call-arptables = 0net.bridge.bridge-nf-filter-vlan-tagged=0保存退出。5.重启网络: /etc/init.d/network restart
三.查询验证:
1.brctl show:
bridge name bridge id STP enabled interfaces
br0 8000.782bcb6525eb no eth0 vnet0virbr0 8000.000000000000 yes2.ifconfig查询结果类似,则表明br0桥接配置成功:
[root@compute3RHEL6 network-scripts]# ifconfig
br0 Link encap:Ethernet HWaddr 11:11:11:11:11:11 inet addr:192.168.77.103 Bcast:192.168.77.255 Mask:255.255.255.0 inet6 addr: fe80::1111:1111:1111:1111/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:14328578 errors:0 dropped:0 overruns:0 frame:0 TX packets:4650570 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4459176095 (4.1 GiB) TX bytes:320844851 (305.9 MiB)eth0 Link encap:Ethernet HWaddr 11:11:11:11:11:11 inet6 addr: fe80::7a2b:cbff:fe65:25eb/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:14338630 errors:0 dropped:0 overruns:0 frame:0 TX packets:4651391 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4718080971 (4.3 GiB) TX bytes:362095405 (345.3 MiB) Interrupt:36 Memory:da000000-da012800eth1 Link encap:Ethernet HWaddr 78:2B:CB:65:25:EC inet6 addr: 1111::1111:1111:1111:25ec/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:32644 errors:0 dropped:0 overruns:0 frame:0 TX packets:445 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2548629 (2.4 MiB) TX bytes:41490 (40.5 KiB) Interrupt:48 Memory:dc000000-dc012800lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1028 errors:0 dropped:0 overruns:0 frame:0 TX packets:1028 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1180221 (1.1 MiB) TX bytes:1180221 (1.1 MiB)virbr0 Link encap:Ethernet HWaddr 11:11:11:11:11:11 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:31 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:4276 (4.1 KiB)vnet0 Link encap:Ethernet HWaddr 11:11:11:11:11:11 inet6 addr: 1111::1111:11:1111:1111/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:70 errors:0 dropped:0 overruns:0 frame:0 TX packets:2062 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:12016 (11.7 KiB) TX bytes:178631 (174.4 KiB)