Bonding orLAG
You will need netcfg from the Official Repositories, as well as the netcfg-bonding package from the AUR.
Edit/create the following files:
Create /etc/network.d/bonded:
/etc/network.d/bonded
CONNECTION="bonding"
INTERFACE="bond0"
SLAVES="eth0 eth1"
IP="dhcp"
DHCP_TIMEOUT=10
Edit your /etc/rc.conf:
/etc/rc.conf
MODULES=(... bonding ...)
...
interface=bond0 #comment other lines (address,netmask,gateway,...)
...
NETWORKS=(... bonded ...)
...
DAEMONS=(... net-profiles ...) #replace network
To activate the new bonded ports modprobe bonding, stop network and start the net-profiles service:
# modprobe bonding
# rc.d stop network
# rc.d start net-profiles
系统环境
CentOS 5.3
目前主流的Linux内核(2.6)已经默认支持bonding模块,无需做特别处理。
配置步骤
编写bond0网卡配置
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
BOOTPROTO=none
ONBOOT=yes
修改eth0和eth1网卡配置
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
加载bonding模块
# vi /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=6
#注: bond options中miimon指定了MII连接监控频率(微秒),mode指定bond的策略,6为balance-alb模式,此模式不需要交换机特别配置支持,bond的参数具体参考这里
装载bonding模块
# modprobe bonding
重启网络服务
# service network restart
检查配置生效
# cat /proc/net/bonding/bond0
# ifconfig
Manualassignment
You can assign a static IP address in theconsole:
# ip addr add <ip address>/<netmask> dev <interface>
For example:
# ip addr add 192.168.1.2/24 dev eth0
For more options, see: man ip
Add your gateway like so:
# ip route add default via <ip address>
(Substitute your own gateway's IP address)
For example:
# ip route add default via 192.168.1.1