龙空技术网

RHCE试题EX300详解(五)配置链路聚合

神小威 120

前言:

当前兄弟们对“linux服务器双网卡链路聚合”大体比较注意,我们都想要剖析一些“linux服务器双网卡链路聚合”的相关资讯。那么小编在网络上网罗了一些有关“linux服务器双网卡链路聚合””的相关知识,希望小伙伴们能喜欢,你们一起来了解一下吧!

题目要求:配置链路聚合

在 server0 和 desktop0 之间按以下要求配置链路聚合

l 此链路使用接口 eth1 和 eth2l 此链路在一个接口失效后,仍然能工作l 此链路在 server0 上使用地址 192.168.0.11/24l 此链路在 desktop0 上使用地址 192.168.0.10/24l 此链路在系统重启后依然保持正常状态知识点小贴士:

Linux 链路聚合:链路聚合与双网卡绑定几乎相同,可以实现多网卡绑定主从荣誉,负载均衡,提高网络访问流量。但链路聚合与双网卡绑定技术(bond)不同点就在于,双网卡绑定只能使用两个网卡绑定,而链路聚合最多可将8个网卡汇聚同时做绑定,此聚合模式称之为team。默认情况下NetworkManager程序中集成了teamd功能就来配置链路聚合。

team 四种模式

广播容错:"broadcast"平衡轮询:"roundrobin"主备:"activebackup"负载均衡:"loadbalance"解题步骤:

(1)首先在desktop0上查找可复制的帮助命令及参考例子:由于nmcli 下的命令都比较长,所以我们不用死记,新版里的帮助和命令参数的tab补全特别好用,可以帮助我们搞定记不住的东西,通过man nmcli-examples查看和复制:

man nmcli-examples

[root@desktop0 ~]# man -k nmclinmcli (1)            - command - line tool for controlling ...nmcli-examples (5)   - usage examples of nmcli
[root@desktop0 ~]# man nmcli-examples | grep team | grep \\$<standard input>:183: warning [p 2, 7.7i]: can't break line           $ nmcli con add type team con-name Team1 ifname Team1 config team1-master-json.conf           $ nmcli con add type team-slave con-name Team1-slave1 ifname em1 master Team1           $ nmcli con add type team-slave con-name Team1-slave2 ifname em2 master Team1
[root@desktop0 ~]# man teamd.conf | grep backup              activebackup — Watches for  link  changes  and              Default for activebackup runner: 1              Default for activebackup runner: 1         "runner": {"name": "activebackup"},       This configuration  uses  active-backup  runner  with         "runner": {"name": "activebackup"},         "runner": {"name": "activebackup"},       "runner": {"name": "activebackup"},

(2)复制上述命令,在Server0上修改相关配置,补全内容即可:

第一步:teamed的配置

 [root@server0 ~]# nmcli con add type team con-name Team1 ifname Team1 config '{"runner": {"name": "activebackup"}}'Connection 'Team1' (ce8cdd24-03a9-4bfe-9c35-900b14c0f279) successfully added.[root@server0 ~]# nmcli con add type team-slave con-name Team1-slave1 ifname eth1 master Team1Connection 'Team1-slave1' (465600d7-8aa2-4e2c-b6f6-d5d9b8138d07) successfully added.[root@server0 ~]# nmcli con add type team-slave con-name Team1-slave2 ifname eth2 master Team1Connection 'Team1-slave2' (e4908548-7eef-44bf-a83b-bbacb13cf179) successfully added.

第二步:为Team1接口配置IP地址

[root@server0 ~]# nmcli connection modify Team1 ipv4.method manual ipv4.addresses 192.168.0.11/24 connection.autoconnect true[root@server0 ~]# systemctl restart network

(3)查看验证验证Server0的配置:

[root@server0 ~]# teamdctl Team1 statesetup:  runner: activebackupports:  eth1    link watches:      link summary: up      instance[link_watch_0]:        name: ethtool        link: up  eth2    link watches:      link summary: up      instance[link_watch_0]:        name: ethtool        link: uprunner:  active port: eth1
[root@server0 ~]# ping -c 3 192.168.0.11PING 192.168.0.11 (192.168.0.11) 56(84) bytes of data.64 bytes from 192.168.0.11: icmp_seq=1 ttl=64 time=0.050 ms64 bytes from 192.168.0.11: icmp_seq=2 ttl=64 time=0.107 ms64 bytes from 192.168.0.11: icmp_seq=3 ttl=64 time=0.056 ms--- 192.168.0.11 ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2000msrtt min/avg/max/mdev = 0.050/0.071/0.107/0.025 ms

(4)在Desktop0上重复上述操作配置

[root@desktop0 ~]# nmcli con add type team con-name Team1 ifname Team1 config '{"runner": {"name": "activebackup"}}'Connection 'Team1' (98692ec9-67b3-4757-a4e1-3a274e0d3199) successfully added.[root@desktop0 ~]# nmcli con add type team-slave con-name Team1-slave1 ifname eth1 master Team1Connection 'Team1-slave1' (9b76c92d-1454-43d0-9684-42a2814036c1) successfully added.[root@desktop0 ~]# nmcli con add type team-slave con-name Team1-slave2 ifname eth2 master Team1Connection 'Team1-slave2' (dfa79ef3-4ac0-41e0-9f82-d433a84f3580) successfully added.[root@desktop0 ~]# nmcli connection modify Team1 ipv4.method manual ipv4.addresses 192.168.0.10/24 connection.autoconnect true

(5)查看验证验证Desktop0的配置:

[root@desktop0 ~]# systemctl restart network[root@desktop0 ~]# teamdctl Team1 statesetup:  runner: activebackupports:  eth1    link watches:      link summary: up      instance[link_watch_0]:        name: ethtool        link: up  eth2    link watches:      link summary: up      instance[link_watch_0]:        name: ethtool        link: uprunner:  active port: eth1[root@desktop0 ~]# ping -c 3 192.168.0.10PING 192.168.0.10 (192.168.0.10) 56(84) bytes of data.64 bytes from 192.168.0.10: icmp_seq=1 ttl=64 time=0.043 ms64 bytes from 192.168.0.10: icmp_seq=2 ttl=64 time=0.126 ms64 bytes from 192.168.0.10: icmp_seq=3 ttl=64 time=0.407 ms--- 192.168.0.10 ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2000msrtt min/avg/max/mdev = 0.043/0.192/0.407/0.155 ms

标签: #linux服务器双网卡链路聚合