Red Hat Training

A Red Hat training course is available for RHEL 8

16.3. 使用 nmstatectl 永久配置网络设备来接受所有流量

您可以使用 nmstatectl 工具永久将网络设备配置为接受所有流量,而不考虑 MAC 地址。

先决条件

  • nmstate 软件包已安装。
  • 用于配置设备的 enp1s0.yml 文件可用。

步骤

  1. 编辑 enp1s0 连接的现有 enp1s0.yml 文件,并将以下内容添加到其中:

    ---
    interfaces:
      - name: enp1s0
        type: ethernet
        state: up
        accept -all-mac-address: true
  2. 应用网络设置:

    # nmstatectl apply ~/enp1s0.yml

验证

  • 验证是否启用了 802-3-ethernet.accept-all-mac-addresses 模式:

    # nmstatectl show enp1s0
    interfaces:
      - name: enp1s0
        type: ethernet
        state: up
        accept-all-mac-addresses:     true
    ...

    802-3-ethernet.accept-all-mac-addresses: true 表示该模式已启用。

其他资源

  • nmstatectl(8) 手册页
  • /usr/share/doc/nmstate/examples/ directory