Network Configuraton Management in Linux
Working with NetworkManager
NetworkManager serves as a dynamic network controller and configuration system that maintains device connectivity and activation when network resources become available.
To start the NetworkManager service:
- Device - The physical network interface (e.g., enp3s0, virbr0, team0, eth0)
- Connection - A logical configuration profile that defines how a device should operate
Important: A single device can have multiple connection profiles, but only one can be active at any given time.
Example scenarios: A network interface might have configuration profiles such as "office-dhcp" for dynamic IP assignment and "server-static" for static IP configuration.
Basic NetworkManager Commands
NAME UUID TYPE DEVICE ens37 a73e4d29-6012-3b67-c234-9876a2bc8914 ethernet ens37
</div>To inspect detailed information for a specific device:
<div>```
[root@server-01 ~]# nmcli device show ens37
Creating a New Connection Profile
Parameters explained:
autoconnect yes - Automatically activate when the primary connection fails con-name - Name identifier for this connection profile ifname - Physical device to which this profile applies type - Device type specification
</div>#### Activating a Connection Profile
<div>```
[root@server-01 ~]# nmcli connection # Verify created profiles
[root@server-01 ~]# nmcli connection up office-dhcp # Activate the profile
# Before activation: IP=192.168.10.100, Netmask=255.255.255.0, Gateway=192.168.10.1
# After activation: IP=10.10.10.50, Netmask=255.255.255.0, Gateway=10.10.10.254
Locating the Configuration Directory
Disabling NetworkManager for Manual Control
Stopping and Disabling NetworkManager
Checking the Current Hostname
Temporary Hostname Modification
The /etc/hosts file provides static IP-to-hostname resolution for local name queries.
Example entries:
127.0.0.1 localhost localhost.localdomain 192.168.10.50 webserver.example.org webserver 10.10.10.25 database.internal dbserver
</div>