用nmcli命令配置网络组
发布时间:2019-10-08 09:14:28
作者:ynkulusi
网络组:将多个网卡聚合在一起的方法,实现容错和提高吞吐量,提供更高的性能和扩展性
直接给两块网卡设置同一IP地址是不可以的,通过网络组,虚拟一块网卡对外提供连接,物理网卡的MAC地址被修改为相同的MAC地址,指向网络组接口的MAC
网络组由内核驱动和teamd守护进程实现
多种方式runner( broadcast / roundrobin / activebackup / loadbalance / lacp )
创建网络组,连接名con-name和接口名ifname都是team0,运行方式是主备模式
# nmcli connection add type team con-name team0 ifname team0 team.runner activebackup
配置监视链路,修改team0连接,配置一个名为ethtool的监视链路
# nmcli connection modify team0 team.link-watchers "name=ethtool"
监视链路支持不同参数,要为监视链路设置参数,在name属性中以空格分隔,名称属性必须用引号;例如:给名为ethtool的监视链路设置delay-up属性,值为2500毫秒,即2.5秒.
# nmcli connection modify team0 team.link-watchers "name=ethtool delay-up=2500"
配置多个监视链路,并为每个链路设置特定的参数,用逗号把链路分开
# nmcli connection modify team0 team.link-watchers "name=ethtool delay-up=2, name=arp_ping source-host=192.0.2.1 target-host=192.0.2.2"
ipv4配置方式
# nmcli connection modify team0 ipv4.addresses '192.0.2.1/24'
# nmcli connection modify team0 ipv4.gateway '192.0.2.254'
# nmcli connection modify team0 ipv4.dns '192.0.2.253'
# nmcli connection modify team0 ipv4.method manual
Ipv6配置方式
# nmcli connection modify team0 ipv6.addresses '2001:db8::1/32'
# nmcli connection modify team0 ipv6.gateway '2001:db8::fffe'
# nmcli connection modify team0 ipv6.dns '2001:db8::fffd'
# nmcli connection modify team0 ipv6.method manual
把port接口分配到网络组中(enp7s0和enp8s0加到网络组中)
# nmcli connection add type ethernet slave-type team con-name team0-port1 ifname enp7s0
master team0
# nmcli connection add type ethernet slave-type team con-name team0-port2 ifname enp8s0
master team0
激活网络组连接
# nmcli connection up team0
显示网络组状态信息
# teamdctl team0 state
setup:
runner: activebackup
ports:
enp7s0
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
enp8s0
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: enp7s0
直接给两块网卡设置同一IP地址是不可以的,通过网络组,虚拟一块网卡对外提供连接,物理网卡的MAC地址被修改为相同的MAC地址,指向网络组接口的MAC
网络组由内核驱动和teamd守护进程实现
多种方式runner( broadcast / roundrobin / activebackup / loadbalance / lacp )
创建网络组,连接名con-name和接口名ifname都是team0,运行方式是主备模式
# nmcli connection add type team con-name team0 ifname team0 team.runner activebackup
配置监视链路,修改team0连接,配置一个名为ethtool的监视链路
# nmcli connection modify team0 team.link-watchers "name=ethtool"
监视链路支持不同参数,要为监视链路设置参数,在name属性中以空格分隔,名称属性必须用引号;例如:给名为ethtool的监视链路设置delay-up属性,值为2500毫秒,即2.5秒.
# nmcli connection modify team0 team.link-watchers "name=ethtool delay-up=2500"
配置多个监视链路,并为每个链路设置特定的参数,用逗号把链路分开
# nmcli connection modify team0 team.link-watchers "name=ethtool delay-up=2, name=arp_ping source-host=192.0.2.1 target-host=192.0.2.2"
ipv4配置方式
# nmcli connection modify team0 ipv4.addresses '192.0.2.1/24'
# nmcli connection modify team0 ipv4.gateway '192.0.2.254'
# nmcli connection modify team0 ipv4.dns '192.0.2.253'
# nmcli connection modify team0 ipv4.method manual
Ipv6配置方式
# nmcli connection modify team0 ipv6.addresses '2001:db8::1/32'
# nmcli connection modify team0 ipv6.gateway '2001:db8::fffe'
# nmcli connection modify team0 ipv6.dns '2001:db8::fffd'
# nmcli connection modify team0 ipv6.method manual
把port接口分配到网络组中(enp7s0和enp8s0加到网络组中)
# nmcli connection add type ethernet slave-type team con-name team0-port1 ifname enp7s0
master team0
# nmcli connection add type ethernet slave-type team con-name team0-port2 ifname enp8s0
master team0
激活网络组连接
# nmcli connection up team0
显示网络组状态信息
# teamdctl team0 state
setup:
runner: activebackup
ports:
enp7s0
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
enp8s0
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: enp7s0
分类:network
评论数:0
阅读数:883