Suchen

Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 15. Configuring the loopback interface by using nmcli

download PDF

By default, NetworkManager does not manage the loopback (lo) interface. After creating a connection profile for the lo interface, you can configure this device by using NetworkManager. Some of the examples are as follows:

  • Assign additional IP addresses to the lo interface
  • Define DNS addresses
  • Change the Maximum Transmission Unit (MTU) size of the lo interface

Procedure

  1. Create a new connection of type loopback:

    # nmcli connection add con-name example-loopback type loopback
  2. Configure custom connection settings, for example:

    1. To assign an additional IP address to the interface, enter:

      # nmcli connection modify example-loopback +ipv4.addresses 192.0.2.1/24
      Note

      NetworkManager manages the lo interface by always assigning the IP addresses 127.0.0.1 and ::1 that are persistent across the reboots. You can not override 127.0.0.1 and ::1. However, you can assign additional IP addresses to the interface.

    2. To set a custom Maximum Transmission Unit (MTU), enter:

      # nmcli con mod example-loopback loopback.mtu 16384
    3. To set an IP address to your DNS server, enter:

      # nmcli connection modify example-loopback ipv4.dns 192.0.2.0

      If you set a DNS server in the loopback connection profile, this entry is always available in the /etc/resolv.conf file. The DNS server entry remains independent of whether or not the host roams between different networks.

  3. Activate the connection:

    # nmcli connection up example-loopback

Verification

  1. Display the settings of the lo interface:

    # ip address show lo
    
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16384 qdisc noqueue state UNKNOWN group default qlen 1000
    
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet 192.0.2.1/24 brd 192.0.2.255 scope global lo valid_lft forever preferred_lft forever
    
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
  2. Verify the DNS address:

    # cat /etc/resolv.conf
    ...
    nameserver 192.0.2.0
    ...
Red Hat logoGithubRedditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

© 2024 Red Hat, Inc.