Este conteúdo não está disponível no idioma selecionado.

Chapter 19. Configuring NetworkManager DHCP settings


NetworkManager provides different configuration options related to DHCP. For example, you can configure NetworkManager to use the build-in DHCP client (default) or an external client, and you can influence DHCP settings of individual profiles.

19.1. Changing the DHCP client of NetworkManager

By default, NetworkManager uses its internal DHCP client. However, if you require a DHCP client with features that the built-in client does not provide, you can alternatively configure NetworkManager to use dhclient.

Note that RHEL does not provide dhcpcd and, therefore, NetworkManager can not use this client.

Procedure

  1. Create the /etc/NetworkManager/conf.d/dhcp-client.conf file with the following content:

    [main]
    dhcp=dhclient

    You can set the dhcp parameter to internal (default) or dhclient.

  2. If you set the dhcp parameter to dhclient, install the dhcp-client package:

    # yum install dhcp-client
  3. Restart NetworkManager:

    # systemctl restart NetworkManager

    Note that the restart temporarily interrupts all network connections.

Verification

  • Search in the /var/log/messages log file for an entry similar to the following:

    Apr 26 09:54:19 server NetworkManager[27748]: <info>  [1650959659.8483] dhcp-init: Using DHCP client 'dhclient'

    This log entry confirms that NetworkManager uses dhclient as DHCP client.

Additional resources

  • NetworkManager.conf(5) man page on your system

19.2. Configuring the DHCP timeout behavior of a NetworkManager connection

A Dynamic Host Configuration Protocol (DHCP) client requests the dynamic IP address and corresponding configuration information from a DHCP server each time a client connects to the network.

When you enable DHCP in a connection profile, NetworkManager waits, by default, 45 seconds for this request to be completed.

Prerequisites

  • A connection that uses DHCP is configured on the host.

Procedure

  1. Optional: Set the ipv4.dhcp-timeout and ipv6.dhcp-timeout properties. For example, to set both options to 30 seconds, enter:

    # nmcli connection modify <connection_name> ipv4.dhcp-timeout 30 ipv6.dhcp-timeout 30

    Alternatively, set the parameters to infinity to configure that NetworkManager does not stop trying to request and renew an IP address until it is successful.

  2. Optional: Configure the behavior if NetworkManager does not receive an IPv4 address before the timeout:

    # nmcli connection modify <connection_name> ipv4.may-fail <value>

    If you set the ipv4.may-fail option to:

    • yes, the status of the connection depends on the IPv6 configuration:

      • If the IPv6 configuration is enabled and successful, NetworkManager activates the IPv6 connection and no longer tries to activate the IPv4 connection.
      • If the IPv6 configuration is disabled or not configured, the connection fails.
    • no, the connection is deactivated. In this case:

      • If the autoconnect property of the connection is enabled, NetworkManager retries to activate the connection as many times as set in the autoconnect-retries property. The default is 4.
      • If the connection still cannot acquire a DHCP address, auto-activation fails. Note that after 5 minutes, the auto-connection process starts again to acquire an IP address from the DHCP server.
  3. Optional: Configure the behavior if NetworkManager does not receive an IPv6 address before the timeout:

    # nmcli connection modify <connection_name> ipv6.may-fail <value>

Additional resources

  • nm-settings(5) man page on your system
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.