1.)#vi/etc/modprobe.conf
后添加
aliasbond0bonding
optionsbondingmax_bonds=1
2.)#viifcfg-bond0
加入如下内容
#IntelCorporation82545EMGigabitEthernetController(Copper)
DEVICE=bond0
BOOTPROTO=none
BROADCAST=192.168.100.255
IPADDR=192.168.100.12
NETMASK=255.255.255.0
NETWORK=192.168.100.0
ONBOOT=yes
BONDING_OPTS="mode=1miimon=100primary=eth0"
3.)修改ifcfg-eth0ifcfg-eth1
#viifcfg-eth0
修改为如下内容
#IntelCorporation82545EMGigabitEthernetController(Copper)
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
#cpifcfg-eth0ifcfg-eth1
#viifcfg-eth1
修改为如下内容
#IntelCorporation82545EMGigabitEthernetController(Copper)
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
4.)重启服务
#servicenetworkrestart
查看一下
[root@localhost~]#ifconfig-a
bond0Linkencap:EthernetHWaddr00:0C:29:27:C3:F3
inetaddr:192.168.100.141Bcast:192.168.100.255Mask:255.255.255.0
inet6addr:fe80::20c:29ff:fe27:c3f3/64Scope:Link
UPBROADCASTRUNNINGMASTERMULTICASTMTU:1500Metric:1
RXpackets:9024errors:0dropped:0overruns:0frame:0
TXpackets:1518errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:929203(907.4KiB)TXbytes:249989(244.1KiB)
eth0Linkencap:EthernetHWaddr00:0C:29:27:C3:F3
UPBROADCASTRUNNINGSLAVEMULTICASTMTU:1500Metric:1
RXpackets:3572errors:0dropped:0overruns:0frame:0
TXpackets:1429errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:376305(367.4KiB)TXbytes:240448(234.8KiB)
eth1Linkencap:EthernetHWaddr00:0C:29:27:C3:F3
RXpackets:5457errors:0dropped:0overruns:0frame:0
TXpackets:102errors:0dropped:0overruns:0carrier:0
RXbytes:553198(540.2KiB)TXbytes:11527(11.2KiB)
或者
1.新建ifcfg-bond0
[root@dexnetwork-scripts]#cd/etc/sysconfig/network-scripts/ [root@dexnetwork-scripts]#cpifcfg-eth0ifcfg-bond0 [root@dexnetwork-scripts]#viifcfg-bond0 加入如下内容 #IntelCorporation82545EMGigabitEthernetController(Copper) DEVICE=bond0 BOOTPROTO=none BROADCAST=192.168.100.255 IPADDR=192.168.100.12 NETMASK=255.255.255.0 NETWORK=192.168.100.0 ONBOOT=yes 2.修改ifcfg-eth0ifcfg-eth1 [root@dexnetwork-scripts]#viifcfg-eth0 修改为如下内容 #IntelCorporation82545EMGigabitEthernetController(Copper) DEVICE=eth0 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes [root@dexnetwork-scripts]#cpifcfg-eth0ifcfg-eth1 [root@dexnetwork-scripts]#viifcfg-eth1 修改为如下内容 #IntelCorporation82545EMGigabitEthernetController(Copper) DEVICE=eth0 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes 3.修改/etc/modprobe.conf文件 [root@dexnetwork-scripts]#vi/etc/modprobe.conf 加入如下两行 aliasbond0bonding optionsbond0miimon=100mode=1 mode=0表示两块网卡同时工作,提供负载均衡 mode=1表示提供冗余功能(主备模式)
原文链接:https://www.f2er.com/centos/378171.html