44.3. 使用 nmstatectl 永久配置网络设备,以接受所有流量


使用 nmstatectl 工具将设备配置为接受所有流量,而不考虑通过 Nmstate API 的 MAC 地址。Nmstate API 确保设置配置后,结果与配置文件匹配。如果有任何失败,nmstatectl 会自动回滚更改以避免系统处于不正确的状态。

先决条件

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

流程

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

    ---
    interfaces:
      - name: enp1s0
        type: ethernet
        state: up
        accept -all-mac-address: true

    这些设置将 enp1s0 设备配置为接受所有流量。

  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/ 目录
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.