在实际的环境中,服务器通过网口绑定技术,可以很容易的实现网口冗余,负载均衡,从而达到高可用的目的,而且可以提升网络的性能,大幅的提升网络I/O。

一般情况下,Linux的多网口绑定使用的是内核中的“bonding”模块,目前发行的各个Linux版本内核中都已经包含了该模块。

这里演示一下绑定的过程。将测试服务器的eth2,eth3两个网卡绑定成一个逻辑接口。

第一步:创建逻辑接口bond0的配置文件;

# vim ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

IPADDR=192.168.5.49

NETMASK=255.255.255.0

DNS2=202.96.128.86

GATEWAY=192.168.5.1

DNS1=202.96.134.133

第二步:配置成员接口;

在成员端口中加入配置:

MASTER=bond0

SLAVE=yes

第三步:修改modprobe相关配置文件;

# echo "alias bond0 bonding" >>/etc/modprobe.d/bonding.conf

# echo "options bonding miimon=100 mode=1" >>/etc/modprobe.d/bonding.conf

第四步:加载bonding模块(如果重启系统,就不需要手动加载)

# modprobe bonding

# lsmod | grep bonding (验证加载结果)

bonding               128245  0

重启网络服务以后查看bond的网卡状态:

# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth2

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth2

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: e8:bd:d1:04:e0:12

Slave queue ID: 0

Slave Interface: eth3

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: e8:bd:d1:04:e0:13

Slave queue ID: 0

上面可以看到连个重要信息。

  1. 模式,这个就是我们配置的Mode=***,上面我们配置的是1。
  2. 可以看到当前Active的网口是eth2

做完以上的操作,基本上就绑定完成了。

通常情况下,我们会配合交换机的链路聚合功能,提高整体的网络性能。这里,我们使用的是华为的5700交换机,在上面启用eth-trunk功能,并配置的是LACP模式。

交换机配置如下:

interface Eth-Trunk5

description Test-DB-Bond-169

port link-type access

port default vlan 5

mode lacp

load-balance src-ip

lacp preempt enable

max active-linknumber 3

注意事项:配置交换机使用是,绑定的模式需要设置为4(802.3ad)

Linux多网口绑定配合华为5700 eth-trunk技术,提高网络性能的更多相关文章

  1. Linux 双网卡绑定技术

    bond技术是在linux2.4以后加入内核. 一般步骤是1.把bonding模块加入内核, 2 编辑要绑定的网卡设置,去除地址设定 3 添加bond设备,设置地址等配置 4  重启网络 5 在交换机 ...

  2. Linux系统网络性能实例分析

    由于TCP/IP是使用最普遍的Internet协议,下面只集中讨论TCP/IP 栈和以太网(Ethernet).术语 LinuxTCP/IP栈和 Linux网络栈可互换使用,因为 TCP/IP栈是 L ...

  3. 华为5700交换机通过外部开源protal和本地aaa用户认证的一些问题

    http://support.huawei.com/ecommunity/bbs/10178271.html?p=1#p0 华为5700交换机通过外部开源protal和本地aaa用户认证的一些问题 各 ...

  4. Linux多网卡绑定(bond)及网络组(team)

    Linux多网卡绑定(bond)及网络组(team)   很多时候,由于生产环境业务的特殊需求,我们需要对服务器的物理网卡实施特殊的配置,从而来满足不同业务场景下对服务器网络的特殊性要求.如高并发的网 ...

  5. Linux双网卡绑定bond详解--单网卡绑定多个IP

    Linux双网卡绑定bond详解 1 什么是bond 网卡bond是通过多张网卡绑定为一个逻辑网卡,实现本地网卡的冗余,带宽扩容和负载均衡,在生产场景中是一种常用的技术.Kernels 2.4.12及 ...

  6. Linux双网卡绑定配置

    Linux双网卡绑定配置                                       环境介绍 Linux Redhat 6.5.4张网卡 需求 4张网卡两两绑定,4张网卡分别是eth ...

  7. Linux 双网卡绑定

    Linux 双网卡绑定 Linux 双网卡绑定双网卡绑定的常用模式:mode1:active-backup 模式,即主备模式.mode0:round-broin 模式,即负载均衡模式(需要交换机配置聚 ...

  8. Linux 多核下绑定硬件中断到不同 CPU(IRQ Affinity) 转

    硬件中断发生频繁,是件很消耗 CPU 资源的事情,在多核 CPU 条件下如果有办法把大量硬件中断分配给不同的 CPU (core) 处理显然能很好的平衡性能.现在的服务器上动不动就是多 CPU 多核. ...

  9. Linux双网卡绑定

    Linux双网卡绑定 作者:Eric 微信:loveoracle11g eth0和eth1绑定为bond0 [root@rac-node1 ~]# cat /etc/sysconfig/network ...

随机推荐

  1. python's metaclass

    [python's metaclass] 和objc中类似,metaclass用于创建一个类对象,但与objc不同的是,objc中每个类对象有各自不同的metaclass,而python中的metac ...

  2. Python基础:函数的介绍及应用

    # 函数的定义 def firstFun(): print("----------------------") print("剑来") print(" ...

  3. 104. Maximum Depth of Binary Tree (Tree; DFS)

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  4. ArcGIS js api开发环境配置

    转自https://blog.csdn.net/lovecarpenter/article/details/53713481#3%E9%85%8D%E7%BD%AEarcgis-api%E5%AE%9 ...

  5. Opencv轮廓计数(学习)

    #include <iostream>#include <opencv2/opencv.hpp>#include <opencv2/xfeatures2d.hpp> ...

  6. 79. Word Search在字母矩阵中查找单词

    [抄题]: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed ...

  7. 万能头文件#include<bits/stdc++.h>

    最近在打cf时赛后翻阅别人的代码总是会发现一个陌生而奇怪的头文件#include<bits/stdc++.h> 奇怪之处就在于基本上所有的代码只要用了这个头文件就不再写其他头文件了. 百度 ...

  8. java基础知识汇总(持续更新中....)

    1.java四大特性:抽象.继承.封装,多态 构造函数: http://blog.csdn.net/qq_33642117/article/details/51909346 2.java数据基本类型: ...

  9. [C++] NULL VS nullptr

    NULL VS nullptr

  10. [C++] Template Function _ Any number of parameters

    Template Function _ Any number of parameters #include<iostream> #include<cstdarg> using ...