Chapter 45. Using nmstate-autoconf to automatically configure the network state using LLDP

download PDF

Network devices can use the Link Layer Discovery Protocol (LLDP) to advertise their identity, capabilities, and neighbors in a LAN. The nmstate-autoconf utility can use this information to automatically configure local network interfaces.


The nmstate-autoconf utility is provided as a Technology Preview only. Technology Preview features are not supported with Red Hat production Service Level Agreements (SLAs), might not be functionally complete, and Red Hat does not recommend using them for production. These previews provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

See Technology Preview Features Support Scope on the Red Hat Customer Portal for information about the support scope for Technology Preview features.

45.1. Using nmstate-autoconf to automatically configure network interfaces

The nmstate-autoconf utility uses LLDP to identify the VLAN settings of interfaces connected to a switch to configure local devices.

This procedure assumes the following scenario and that the switch broadcasts the VLAN settings using LLDP:

  • The enp1s0 and enp2s0 interfaces of the RHEL server are connected to switch ports that are configured with VLAN ID 100 and VLAN name prod-net.
  • The enp3s0 interface of the RHEL server is connected to a switch port that is configured with VLAN ID 200 and VLAN name mgmt-net.

The nmstate-autoconf utility then uses this information to create the following interfaces on the server:

  • bond100 - A bond interface with enp1s0 and enp2s0 as ports.
  • prod-net - A VLAN interface on top of bond100 with VLAN ID 100.
  • mgmt-net - A VLAN interface on top of enp3s0 with VLAN ID 200

If you connect multiple network interfaces to different switch ports for which LLDP broadcasts the same VLAN ID, nmstate-autoconf creates a bond with these interfaces and, additionally, configures the common VLAN ID on top of it.


  • The nmstate package is installed.
  • LLDP is enabled on the network switch.
  • The Ethernet interfaces are up.


  1. Enable LLDP on the Ethernet interfaces:

    1. Create a YAML file, for example ~/enable-lldp.yml, with the following content:

        - name: enp1s0
          type: ethernet
            enabled: true
        - name: enp2s0
          type: ethernet
            enabled: true
        - name: enp3s0
          type: ethernet
            enabled: true
    2. Apply the settings to the system:

      # nmstatectl apply ~/enable-lldp.yml
  2. Configure the network interfaces using LLDP:

    1. Optional, start a dry-run to display and verify the YAML configuration that nmstate-autoconf generates:

      # nmstate-autoconf -d enp1s0,enp2s0,enp3s0
      - name: prod-net
        type: vlan
        state: up
          base-iface: bond100
          id: 100
      - name: mgmt-net
        type: vlan
        state: up
          base-iface: enp3s0
          id: 200
      - name: bond100
        type: bond
        state: up
          mode: balance-rr
          - enp1s0
          - enp2s0
    2. Use nmstate-autoconf to generate the configuration based on information received from LLDP, and apply the settings to the system:

      # nmstate-autoconf enp1s0,enp2s0,enp3s0

Next steps


  1. Display the settings of the individual interfaces:

    # nmstatectl show <interface_name>

Additional resources

  • nmstate-autoconf(8) man page
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.