[root@localhost ~]# lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release: 5.5
Codename: Tikanga
网卡重命名(eth0 -> eth1):
ifdown eth0
vim /etc/modprobe.conf
alias eth0 e1000 => alias eth1 e1000
mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth0 => DEVICE=eth1
service network restart
网卡绑定:
假设有两块网卡eth0和eth1
做绑定实验前,先分别down掉其中一块测试单块网卡的连通情况
ifdown eht0,ping gateway
ifdown eth1,ping gateway
vim /etc/modprobe.conf
alias bond0 bonding
options bond0 mode=1 miimon=100 user_carrier=0
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-bond0
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.221.244
NETMASK=255.255.255.0
GATEWAY=192.168.221.254
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
MASTER=bond0
SLAVE=yes
BOOTPROTO=static
ONBOOT=yes
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
MASTER=bond0
SLAVE=yes
BOOTPROTO=static
ONBOOT=yes
service network restart
[root@localhost ~]# ifconfig
bond0 Link encap:Ethernet HWaddr 00:0C:29:F7:5A:00
inet addr:192.168.221.244 Bcast:192.168.221.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fef7:5a00/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:3369 errors:0 dropped:0 overruns:0 frame:0
TX packets:1755 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2342730 (2.2 MiB) TX bytes:234018 (228.5 KiB)
eth0 Link encap:Ethernet HWaddr 00:0C:29:F7:5A:00
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:3314 errors:0 dropped:0 overruns:0 frame:0
TX packets:1572 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2330760 (2.2 MiB) TX bytes:199428 (194.7 KiB)
eth1 Link encap:Ethernet HWaddr 00:0C:29:F7:5A:00
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:64 errors:0 dropped:0 overruns:0 frame:0
TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12564 (12.2 KiB) TX bytes:36566 (35.7 KiB)
测试failover(vmware上failover测试不成功):
断掉eth0,ping gateway
断掉eth1,ping gateway
简单排错命令:
查看eth0网卡对应的内核:modprobe -c | grep eth0
检查绑定内核有没有没加载,同样适于网卡内核:lsmod | grep bonding
取消绑定网卡,需要先卸载绑定内核:modprobe -r bonding
在网卡还没起来时查看网卡mac地址:ip addr list
REF: /usr/share/doc/kernel-doc-2.6.18/Documentation/networking/bonding.txt