ENGINEER 002: 配置用户环境 --- 配置聚合连接

配置用户环境

1、自定义命令(1)linux命令字的来源;(2)alias别名设置

2、用户初始化文件 (1)用户个性化配置文件; (2)全局环境配置

先讲配置高级连接中的,配置聚合连接。

1、配置聚合连接(网卡绑定)

类似于HSRP(热备份路由的协议)。备份网关设备,路由器、三层交换。

①路由器1(IP:192.168.1.254)、②路由器2(IP:192.168.1.253)

 活跃                        备份

③虚拟路由器(IP:192.168.1.200),把所有的pc机把网关指向虚拟路由。

活跃的时候,由路由器1来转发数据。某天挂了,再由备份路由器2(IP:192.168.1.253)转发数据。

 

有一天,活跃路由器1挂了,就由备份路由器2来转发数据。

计算机pc端,网关是指向活跃路由器1,某天挂了,还要手动改网关。

虚拟路由器--->商量一个自动的共同的对外开放的IP。

聚合连接:备份网卡设备

网卡eth1坏了怎么办?

eth1                                           eth2

192.168.1.1                             192.168.1.2

Team(IP:192.168.1.10)

两个网卡共同组成一个队伍。也有活跃、备份之说。

eth1和eth2可以不用配置IP地址。

例如:在未来的集群中也有体现,两台web服务器,其中一台挂了,再找一台就ole。

集群、DNS、数据库,HSRP思想是一样的。冗余备份的

配置聚合连接,是第二阶段号称“第一长的命令”,配置ip只是第二长。   

 

(1)链路聚合的优势

team,聚合连接(也称为链路聚合)

--由多块网卡(team-salve)一起组建而成的虚拟网卡,即“组队”

--作用1:轮询式(roundrobin)的流量负载均衡

--作用2:热备份(activebackup)连接冗余

运行器的类型切换(参考man teamd.conf)---

{"runner":{"name":"roundrobin"}}或者 {"runner":{"name":"activebackup"}}

只讲热备份,轮询后面再讲。

热备份配置: {"runner":{"name":"activebackup"}}  #注意:复制粘贴,不要手打 

       man帮助辅助记忆

       /example   #全文查找example

              #按n  跳转下一个匹配

[root@server0~]# man teamd.conf

 在输入---> /example --->再按n --->复制粘贴,即可。

[root@server0~]# {"runner":{"name":"activebackup"}}  #注意:复制粘贴,不要手打

(2)实现链路聚合的条件

[root@server0~]#  ifconfig

有三张网卡:eth0、eth1(单独准备)、eth2(单独准备)

eth1、eth2做实验,eth0配置ip做挂了就完了! 

未来会做4张网卡。

网络配置的命令,曾经配置IP也用其配,nmcli connetcion 连接网络设备。

[root@server0~]# nmcli connection 【tab】【tab】两下 

[root@server0~]# nmcli connection add type ... ...

(3)nmcli命令行配置

配置文件的准备

---为聚合连接提供配置(类型、连接名、运行器、IP地址)

一、添加team团队设备

配置文件的准备

---为聚合连接提供配置(类型、连接名、运行器、IP地址)

[root@server0~]# nmcli connection add type team con-name team0 ifconfig '{"runner":{"name":"activebackup"}}'

... ...

二、添加成员

---为成员网卡提供配置(类型、连接名、主连接) Slave---奴隶---两个网卡

[root@server0~]# nmcli connection add type team-slave ifname eth1 master team0

[root@server0~]# nmcli connection add type team-slave ifname eth2 master team0

三、配置team0的IP地址

[root@server0~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses '192.168.1.1/24' connection.autoconnect yes

四、激活team0

[root@server0~]# nmcli connection up team-slave-eth1  //激活从设备eth1

[root@server0~]# nmcli connection up team-slave-eth2  //激活从设备eth2

[root@server0~]# nmcli connection up team0         //激活主设备team0

五、验证

[root@server0~]# teamdctl team0 state   //专用于查看team信息

posted @ 2019-05-23 09:53  xiaoredhat  阅读(78)  评论(0编辑  收藏  举报