登录并查看
login as: root
root@192.168.11.160's password:
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:A8:6C:61
inet addr:192.168.11.160 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fea8:6c61/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:114 errors:0 dropped:0 overruns:0 frame:0
TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9166 (8.9 KiB) TX bytes:6535 (6.3 KiB)lo 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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
查看当前网络接口配置文件
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
UUID="f0bd6d3b-c8dc-4e8a-8d9d-91938a5f4be1"
HWADDR=00:50:56:A8:6C:61
IPADDR=192.168.11.160
PREFIX=24
GATEWAY=192.168.11.1
DNS1=202.96.128.86
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
[root@localhost network-scripts]#
[root@localhost network-scripts]# cat ifcfg-eth1
DEVICE="eth1"
BOOTPROTO="dhcp"
HWADDR="00:50:56:A8:6C:62"
NM_CONTROLLED="yes"
ONBOOT="no"
TYPE="Ethernet"
UUID="fce1b80b-9e63-4468-aaaa-529e991a5cff"
[root@localhost network-scripts]#
修改内核模块加载参数
[root@localhost ~]# cd /etc/modprobe.d/
[root@localhost modprobe.d]# vi bonding.conf
alias bond0 bonding
options bond0 miimon=80 mode=5
mode参数所支持的选项
modes:
mode=0 (Balance Round Robin)
mode=1 (Active backup)
mode=2 (Balance XOR)
mode=3 (Broadcast)
mode=4 (802.3ad)
mode=5 (Balance TLB)
mode=6 (Balance ALB)
创建绑定接口的配置文件
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vi ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.11.160
NETMASK=255.255.255.0
NETWORK=192.16.11.0
BROADCAST=192.168.11.255
GATEWAY=192.168.11.1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
修改网卡配置文件
[root@localhost network-scripts]# vi ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
[root@localhost network-scripts]# vi ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
重启网络服务
[root@localhost network-scripts]# service network restart > 2012
/etc/sysconfig/network-scripts/ifdown-eth: line 116: /sys/class/net/bond0/bonding/slaves: No such file or directory
[root@localhost network-scripts]# cat 2012
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
[root@localhost network-scripts]#
^
[root@localhost ~]# ifconfig
bond0 Link encap:Ethernet HWaddr 00:50:56:A8:6C:61
inet addr:192.168.11.160 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fea8:6c61/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:892 errors:0 dropped:0 overruns:0 frame:0
TX packets:983 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:68406 (66.8 KiB) TX bytes:87517 (85.4 KiB)eth0 Link encap:Ethernet HWaddr 00:50:56:A8:6C:61
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:518 errors:0 dropped:0 overruns:0 frame:0
TX packets:650 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:45276 (44.2 KiB) TX bytes:66535 (64.9 KiB)eth1 Link encap:Ethernet HWaddr 00:50:56:A8:6C:62
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:374 errors:0 dropped:0 overruns:0 frame:0
TX packets:334 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23130 (22.5 KiB) TX bytes:21216 (20.7 KiB)lo 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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
s
修改内核模块加载参数
span style=”color: #008000;”