**
NetworkManager command line tool
基于会话的网路管理
NetworkManager服务(在后边进行实践时 会用到)
对网络图形界面的管控
network 服务 :代表的是所有的网络服务
二者相比 network的管控范围较大一些
为什么要将网卡聚合绑定?
1.为了保证数据能够安全传输 将网卡绑定;
2.为了保证在大量数据传输时 分担设备的压力 通过多条链路聚合 从而使得如果链路故障时 会存在备份链路承载流量,不会造成更大的影响。
如下图:
在传输过程中你觉得可以有几种传输方式?
广播模式 Broadcast | 传输来自所有端口的包 如图中 四条链路都进行传输 |
---|---|
轮询模式 roundrobin | 以轮询的模式传递所有端口的包 如图中 按照一定顺序进行循环 |
主备模式activebakup | 设定某条链路为主链路 只有当主链路发生故障时,才会启动备份链路进行数据传输 |
loadbalance均衡模式 | 监控流量并使用哈希函数以尝试在选择端口的时候达到完美均衡 例如带宽 |
LACP | 链路聚合基于IEEE802.3ad标准的LACP(Link Aggregation Control Protocol,链路汇聚控制协议)是一种实现链路动态汇聚的协议。LACP协议通过LACPDU(Link Aggregation Control Protocol Data Unit,链路汇聚控制协议数据单元)与对端交互信息。 |
**
team配置网卡聚合链路
**
创建虚拟网卡 team0 分别将真实的物理网卡加入到 虚拟网卡team0的会话中,从而实现绑定的效果。
下边让我们看看在 虚拟机上如何实现该过程:
**
绑定两个网卡测试
**:
第一步 在主界面进行添加两个网络适配器;模式要求必须一样
下一步:
下一步:
再次以同样的方法进行添加 注意两个网络适配器的模式必须一样
虚拟机自动重启;
也可以在这进行检查你是否添加成功
开启连接 存在两种方式:
第一种 直接申请ip
[root@localhost ~]# dhclient
第二种 将每个网络适配器进行手动连接
查看示例文件
[root@localhost ~]# cd /usr/share/doc/teamd-1.17/example_configs/
进入主备模式的示例文件:
[root@localhost example_configs]# vim activebackup_tipc.conf
复制其中的内容:
“runner”: {“name”: “activebackup”}
创建新的设备和会话
[root@localhost example_configs]# nmcli connection add type team con-name team1 ifname team1 config ‘{“runner”: {“name”: “activebackup”}}’
成功添加的连接 ‘team1’(59b38026-ad5f-44d9-a084-7735194e30fc)。
添加设备到team1 (黄色的为会话名称 自己定义)
[root@localhost example_configs]# nmcli connection add type team-slave con-name team1-port1 ifname eno33554984 master team1
成功添加的连接 ‘team1-port1’(9a048613-cf77-4e96-b23b-84aaffb31351)。
[root@localhost example_configs]# nmcli connection add type team-slave con-name team1-port2 ifname eno50332208 master team1
成功添加的连接 ‘team1-port2’(6f6a0e9b-2251-4a5c-b45b-ec8bd9b89592)。
激活从设备
[root@localhost example_configs]# nmcli connection up team1-port1
成功激活的连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/10)
[root@localhost example_configs]# nmcli connection up team1-port2
成功激活的连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/11)
激活主设备
[root@localhost example_configs]# nmcli connection up team1
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
查看主设备状态
[root@localhost example_configs]# teamdctl team1 state
Ip a 查看 team1 设备的IP地址 通过ping测试一下
主备模式 可以看出现在的主为eno3 所以将eno3停用后 看是否切换到eno5
**
主备模式切换
**
[root@localhost example_configs]# nmcli connection down team1-port1
Connection ‘team1-port1’ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/13)
[root@localhost example_configs]# teamdctl team1 state
配置team桥接
虚拟机和window主机的桥接:
虚拟机 通过
首先和上述的方法相同
修改team0 的 配置
[root@localhost example_configs]# nmcli connection modify team1 ipv4.addresses 172.24.8.111/24 ipv4.gateway 172.24.8.1 ipv4.dns 114.114.114.114 ipv4.method manual connection.autoconnect yes
[root@localhost example_configs]# nmcli connection up team1
成功激活的连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/11)
因为上边已经创建了team0 则只需在创建一个桥接网卡 与team 设备进行关联即可
[root@localhost example_configs]# nmcli device disconnect team1
Device ‘team1’ successfully disconnected.
[root@localhost example_configs]# systemctl stop NetworkManager
NetworkManager-dispatcher.service NetworkManager.service
[root@localhost example_configs]# systemctl stop NetworkManager.service
[root@localhost example_configs]# systemctl disable
Too few arguments.
[root@localhost example_configs]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vim ifcfg-team1
[root@localhost network-scripts]# vim ifcfg-team1-port1
[root@localhost network-scripts]# vim ifcfg-br0
[root@localhost network-scripts]# systemctl restart NetworkManager
[root@localhost network-scripts]# nmcli device connect team1
Device ‘team1’ successfully activated with ‘81460dd4-acc7-45b3-969b-e059fdaf1ce3’.
查看 检验 :
使用DHCP br0 和 team1 是一样的IP地址