2.14. 按接口名称,使用单个连接配置文件配置多个以太网接口
在大多数情况下,一个连接配置文件包含一个网络设备的设置。但是,当您在连接配置文件中设置接口名称时,NetworkManager 也支持通配符。如果主机在具有动态 IP 地址分配的以太网之间漫游,则您可以使用此功能创建可用于多个以太网接口的单一连接配置文件。
先决条件
- 服务器配置中存在多个物理或虚拟以太网设备。
- 网络中有 DHCP 服务器。
- 主机上不存在连接配置文件。
流程
添加可应用于以
enp
开头的所有接口名称的连接配置文件:nmcli connection add con-name "Wired connection 1" connection.multi-connect multiple match.interface-name enp* type ethernet
# nmcli connection add con-name "Wired connection 1" connection.multi-connect multiple match.interface-name enp* type ethernet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
显示单个连接配置文件的所有设置:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 3
表示接口在特定的时间可以被多次激活。连接配置文件使用与match.interface-name
参数中的模式匹配的所有设备,因此连接配置文件具有相同的通用唯一识别符(UUID)。显示连接的状态:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow