网络组相关实验
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了网络组相关实验相关的知识,希望对你有一定的参考价值。
网络组相关实验网络组是centos7上新出的一个技术,它的作用和bonding类似,是将多个网卡聚合在一起方法,从而实现冗错和提高吞吐量,不同于旧版中bonding技术,网路组提供更好的性能和扩展性,它是由内核驱动和teamd守护进程实现。
网路组可以工作在多种方式(runner)
broadcast
roundrobin
activebackup
loadbalance
lacp (implements the 802.3ad Link Aggregation Control Protocol)
实验环境:
一台CentOS7主机,网卡2块。
创建网络组
1.创建网路网
[[email protected] ~]# nmcli connection add con-name team0 ifname team0 type team ipv4.method manual ipv4.addresses 192.168.172.100 config ‘{"runner":{"name":"loadbalance"}}‘
Connection ‘team0‘ (24db0099-b9fa-4aae-ace0-9421e3c69278) successfully added.
2.添加物理网卡
分别将ens33和ens37添加至网路组内
[[email protected] ~]# nmcli connection add con-name team0-ens33 ifname ens33 type team-slave master team0
Connection ‘team0-ens33‘ (0d00650a-e379-4c70-9f62-ba268af1a208) successfully added.
[[email protected] ~]# nmcli connection add con-name team0-ens37 ifname ens37 type team-slave master team0
Connection ‘team0-ens37‘ (2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7) successfully added.
3.将物理网卡和网络组关联起来
#由于刚才只是将物理网卡添加至网络组内,所以此时team0-ens33和team0-ens37并未启用
[[email protected] ~]# nmcli connection
NAME UUID TYPE DEVICE
ens33 fca2f13f-7310-4595-bbb1-e6d0e3662aff ethernet ens33
team0 24db0099-b9fa-4aae-ace0-9421e3c69278 team team0
virbr0 803d85ba-4e80-470f-bcf5-1b22b5653026 bridge virbr0
Wired connection 1 3f019cd5-7685-3368-960c-101e35cd6ce7 ethernet ens37
team0-ens33 0d00650a-e379-4c70-9f62-ba268af1a208 ethernet --
team0-ens37 2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7 ethernet --
#将网络组内的物理网卡关联起来
[[email protected] ~]# nmcli connection up team0-ens33
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[[email protected] ~]# nmcli connection up team0-ens37
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
#此时team-ens33和team-ens37都已经启用,网络组创建成功
[[email protected] ~]# nmcli connection
NAME UUID TYPE DEVICE
team0 24db0099-b9fa-4aae-ace0-9421e3c69278 team team0
team0-ens33 0d00650a-e379-4c70-9f62-ba268af1a208 ethernet ens33
team0-ens37 2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7 ethernet ens37
virbr0 803d85ba-4e80-470f-bcf5-1b22b5653026 bridge virbr0
ens33 fca2f13f-7310-4595-bbb1-e6d0e3662aff ethernet --
Wired connection 1 3f019cd5-7685-3368-960c-101e35cd6ce7 ethernet --
4.查看网络组状态
[[email protected] ~]# teamdctl team0 state
setup:
runner: loadbalance
ports:
ens33
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
ens37
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
网络组的删除
1.删除相关配置文件
由于nmcli命令在执行时会自动生成网卡的配置文件,所以删除网路组时需要将相应的配置文件进行删除
[[email protected] ~]# rm -vf /etc/sysconfig/network-scripts/ifcfg-team0*
removed ‘/etc/sysconfig/network-scripts/ifcfg-team0’
removed ‘/etc/sysconfig/network-scripts/ifcfg-team0-ens33’
removed ‘/etc/sysconfig/network-scripts/ifcfg-team0-ens37’
2.取消相关网卡的关联
#将网络组中的ens33及ens37取消关联
[[email protected] ~]# nmcli connection down team0-ens33
Connection ‘team0-ens33‘ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[[email protected] ~]# nmcli connection down team0-ens37
Connection ‘team0-ens37‘ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
#删除链接ens33和ens37
[[email protected] ~]# nmcli connection delete team0-ens33
Connection ‘team0-ens33‘ (0d00650a-e379-4c70-9f62-ba268af1a208) successfully deleted.
[[email protected] ~]# nmcli connection delete team0-ens37
Connection ‘team0-ens37‘ (2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7) successfully deleted.
3.将网路组删除
#先禁用网路组
[[email protected] ~]# nmcli connection down team0
Connection ‘team0‘ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
#将网路组删除
[[email protected] ~]# nmcli connection delete team0
Connection ‘team0‘ (24db0099-b9fa-4aae-ace0-9421e3c69278) successfully deleted.
此时网路组已经从主机上删除
[[email protected] ~]# nmcli connection
NAME UUID TYPE DEVICE
ens33 fca2f13f-7310-4595-bbb1-e6d0e3662aff ethernet ens33
virbr0 803d85ba-4e80-470f-bcf5-1b22b5653026 bridge virbr0
Wired connection 1 3f019cd5-7685-3368-960c-101e35cd6ce7 ethernet ens37
以上是关于网络组相关实验的主要内容,如果未能解决你的问题,请参考以下文章