Questo contenuto non è disponibile nella lingua selezionata.
Chapter 18. Configuring the loopback interface by using nmcli
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 when users want to configure the loopback interface are as follows:
-
Assign additional IP addresses to the
lointerface - Define DNS addresses
-
Change the Maximum Transmission Unit (MTU) size of the
lointerface
Procedure
Create a new connection of type
loopback:# nmcli connection add con-name example-loopback type loopbackConfigure custom connection settings, for example:
To assign an additional IP address to the interface, enter:
# nmcli connection modify example-loopback +ipv4.addresses 192.0.2.1/24NoteNetworkManager manages the
lointerface by always assigning the IP addresses127.0.0.1and::1that are persistent across the reboots. You cannot override127.0.0.1and::1. However, you can assign additional IP addresses to the interface.To set a custom Maximum Transmission Unit (MTU), enter:
# nmcli con mod example-loopback loopback.mtu 16384To set an IP address to your DNS server, enter:
# nmcli connection modify example-loopback ipv4.dns 192.0.2.0If you set a DNS server in the loopback connection profile, this entry is always available in the
/etc/resolv.conffile. The DNS server entry remains independent of whether or not the host roams between different networks.
Activate the connection:
# nmcli connection up example-loopback
Verification
Display the settings of the
lointerface:# 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 foreverVerify the DNS address:
# cat /etc/resolv.conf ... nameserver 192.0.2.0 ...