Show Table of Contents
附录 E. 网络接口模板示例
在这个附录中包括了一组 Heat 模板示例,它们展示了网络接口的配置。
E.1. 配置接口
每个接口可能会需要根据实际情况进行修改。例如,如果您需要使用第二个 NIC 连接到一个使用 DHCP 地址的网络,并使用第 3 和第 4 个 NIC 进行网络绑定时,您所需要进行的修改如下:
network_config:
# Add a DHCP infrastructure network to nic2
-
type: interface
name: nic2
use_dhcp: true
-
type: ovs_bridge
name: br-bond
members:
-
type: ovs_bond
name: bond1
ovs_options: {get_param: BondInterfaceOvsOptions}
members:
# Modify bond NICs to use nic3 and nic4
-
type: interface
name: nic3
primary: true
-
type: interface
name: nic4
网络接口模板可以使用实际的接口名("eth0"、"eth1"、"enp0s25"),或使用一组接口编号("nic1"、"nic2"、"nic3")。当使用接口编号(如
nic1、nic2 等)而不是使用接口名(如 eth0、eno2 等)时,在一个角色中的主机网络接口不需要是完全相同的。例如,一个主机可能有接口 em1 和 em2,而另外一个主机有接口 eno1 和 eno2,您可以使用 nic1 和 nic2 来指代这两个主机的接口。
编号的接口顺序与使用名称的网络接口类型相对应:
ethX接口,如eth0、eth1等。这些通常是板上的内置接口。enoX接口,如eno0、eno1等。这些通常是板上的内置接口。enX接口,以字母顺序排序,如enp3s0、enp3s1、ens3等。这些通常是额外附加的接口。
编号的 NIC 机制只会考虑有效的接口(如有网线连接到交换机)。如果您有一些带有 4 个接口的 主机,另外还有一些带有 6 个接口的主机,则应该使用
nic1 到 nic4,并只在每个主机中的 4 个接口中连接网线。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.