Linux之CentOS 聚合链路配置思路讲解

简介:

centos 6.X   聚合链路


0、查看NetworkManager服务,停止NetworkManager服务。不做这一步很可能出问题
          service NetworkManager status
          service NetworkManager stop

1、修改三类文件
          /etc/sysconfig/network-scripts/下的ifcfg-*文件
          /etc/modprobe.conf 文件
          /etc/init.d/rc.local 文件

2、编辑虚拟网口配置文件 ,记住此文件复制的时候要把MAC地址去掉,去掉UUID
     vi     /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static 
IPADDR=192.168.1.111
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

3、编辑各网卡的配置文件
     vi /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=none
TYPE=Ethernet 
DEVICE=em1
ONBOOT=yes
MASTER=bond0
SLAVE=yes

vi /etc/sysconfig/network-scripts/ifcfg-eth1
BOOTPROTO=none
TYPE=Ethernet
DEVICE=em2
ONBOOT=yes
MASTER=bond0
SLAVE=yes

4、修改/etc/modprobe.conf     centos 6.5 是/etc/modprobe.d/bonding.conf
     最后两行加入
alias bond0 bonding
options bond0 miimon=100 mode=6
//     如果有多个bond配置文件,可按如下方式添加
alias bond1 bonding
options bond1 miimon=100 mode=6

注:
(1)、miimon 是链路监测的时间间隔单位是毫秒,miimon=100的意思就是,每100毫秒检测网卡和交换机之     间是否连通,如不通则使用另外的链路。
(2)、mode=0 表示负载均衡方式,两块网卡都工作,需要交换机作支持
      mode=1 表示冗余方式,网卡只有一个工作,一个出问题启用另外的
      mode=6 表示负载均衡方式,两块网卡都工作,不需要交换机作支持

5、修改/etc/rc.d/rc.local,加入以下内容     ,配置了modprobe.conf 可能不再需要配置rc.local
     modprobe bonding miimon=100 mode=6     // 也有加入 ifenslave bond0 eth0 eth1 这种形式
6、service network  restart     // 查看虚拟接口是否起来
     reboot        // 查看是否开机启动


=====================================================


centos 7.X 聚合链路


redhat 7中的网络管理工具
     有两种方式,一个是命令行 nmcli 一个是图形界面nmtui

     nmcli  [ OPTIONS ] OBJECT { COMMAND | help }

                 OBJECT := { general | networking | radio | connection | device | agent  }

       OPTIONS := {
       -t[erse]
       -p[retty]
       -m[mode] tabular | multiline
       -f[ields] <field1,field2,...> | all | common
       -e[scape] yes | no
       -n[ocheck]
       -a[sk]
       -w[ait] <seconds>
       -v[ersion]
       -h[elp]
       }
 
redhat 7 使用nmcli设置网卡绑定
一、创建组接口
          nmcli con add type team con-name CNAME ifname INAME [config JSON]
          CNAME 指代连接的名称,INAME 接口的名称,JSON(JavaScript Object Notation)指定所使用的处理器(runner)。
          JSON语法格式如下
               ‘{“runner”:{“name”:“METHOD”}}’
                  METHOD 可以是 broadcast、activebackup、roundrobin、loadbalance、lacp
例子:
                    nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'

二、向组接口中添加设备
     nmcli con add type team-slave con-name CNAME ifname INAME master TEAM
     例子:nmcli con add type team-slave con-name team0-port1 ifname eth0 master team0
              nmcli con add type team-slave con-name team0-port2 ifname eth1 master team0

三、配置IP地址
     
     nmcli con mod team0 ipv4.addresses "192.168.1.24/24"
     nmcli con mod team0 ipv4.gateway "192.168.1.1"
     nmcli con mod team0 ipv4.dns "192.168.1.1"
     nmcli con mod team0 ipv4.method manual
     
     nmcli con up team0-port1
     nmcli con up team0
     teamdctl team0 state



本文转自 sunrisenan 51CTO博客,原文链接:http://blog.51cto.com/sunrisenan/1864748

相关文章
|
2天前
|
Ubuntu Linux 编译器
【Linux】详解动静态库的制作和使用&&动静态库在系统中的配置步骤
【Linux】详解动静态库的制作和使用&&动静态库在系统中的配置步骤
|
4天前
|
Unix Shell Linux
在 Linux 上把 Vim 配置为默认编辑器
在 Linux 上把 Vim 配置为默认编辑器
|
4天前
|
存储 Web App开发 Ubuntu
整理16款适用于较旧低配置电脑的最佳Linux发行版
在本指南中,趣云笔记(https://www.ecscoupon.com/)介绍了一些最好的Linux发行版,你可以将它们安装在旧PC上并为其注入新的活力。
23 0
|
4天前
|
Linux 数据安全/隐私保护
Linux 读写权限的配置
Linux 读写权限的配置
11 0
|
5天前
|
存储 安全 Linux
linux centos7中使用 Postfix 和Dovecot搭建邮件系统
linux centos7中使用 Postfix 和Dovecot搭建邮件系统
|
5天前
|
Linux 网络安全 数据库
linux centos系统搭建samba文件服务器 NetBIOS解析 (超详细)
linux centos系统搭建samba文件服务器 NetBIOS解析 (超详细)
|
5天前
|
关系型数据库 MySQL Linux
Linux CentOs7 安装Mysql(5.7和8.0版本)密码修改 超详细教程
Linux CentOs7 安装Mysql(5.7和8.0版本)密码修改 超详细教程
|
5天前
|
Web App开发 安全 Unix
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)
|
5天前
|
网络协议 Linux 开发工具
Linux中 /etc/sysconfig/network-scripts/ifcfg-<interface> 网络接口配置 详解 看这一篇够用
Linux中 /etc/sysconfig/network-scripts/ifcfg-<interface> 网络接口配置 详解 看这一篇够用
|
5天前
|
Linux
CentOS 7 配置yum阿里源 (三步即可)
CentOS 7 配置yum阿里源 (三步即可)