linux双网卡负载均衡bonding使用方法
2017-06-13 16:02
1361 查看
Bonding orLAG
You will need netcfg fromthe 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
相关文章推荐
- 转贴:Linux 环境下多网卡使用一个IP提高效率--Bonding
- Linux系统下使用HAProxy配置HTTP负载均衡系统的方法
- linux和安卓上(ppp widget)使用3g网卡的方法
- Linux双网卡绑定实现负载均衡(Bonding双网卡绑定)
- linux下使用无线网卡的命令行方法(wifi,iwconfig)
- 生产环境中linux bonding 主备模式slave网卡切换的方法
- Windows以及Linux下双网卡内外网同时使用、设置域名解析优先级的方法
- Linux同一网段使用不同网卡的方法
- Linux中使用team方法绑定网卡
- linux虚拟网卡使用方法
- 生产环境中linux bonding 主备模式slave网卡切换的方法
- linux下网卡配置的使用方法
- bonding-多网卡绑定一起,作为一个网卡使用,实现负载均衡和提高带宽
- [linux网络] 双网卡bonding实现冗余/负载均衡
- linux下使用无线网卡的命令行方法
- Linux平台双网卡绑定技术实现负载均衡(网卡聚合)bonding
- Linux 2.4 内核中iptables的使用方法
- Linux单网卡绑定多IP与多网卡共用单IP的实现方法
- linux-Vi使用方法(备查)
- linux系统启动自动激活网卡的解决方法