After completing this section, you should be able to modify network configuration by editing configuration files.
By default, changes made with nmcli con mod name are automatically saved to /etc/sysconfig/network-scripts/ifcfg-.
That file can also be manually edited with a text editor.
After doing so, run nmcli con reload so that NetworkManager reads the configuration changes.
name
For backward-compatibility reasons, the directives saved in that file have different names and syntax than the nm-settings(5) names.
The following table maps some of the key setting names to ifcfg-* directives.
Table 12.7. Comparison of nm-settings and ifcfg-* Directives
| nmcli con mod |
ifcfg-* file
| Effect |
|---|---|---|
ipv4.method manual
|
BOOTPROTO=none
| IPv4 addresses configured statically. |
ipv4.method auto
|
BOOTPROTO=dhcp
| Looks for configuration settings from a DHCPv4 server. If static addresses are also set, will not bring those up until we have information from DHCPv4. |
ipv4.addresses 192.0.2.1/24
|
|
Sets static IPv4 address and network prefix.
If more than one address is set for the connection, then the second one is defined by the IPADDR1 and PREFIX1 directives, the third one by the IPADDR2 and PREFIX2 directives, and so on.
|
ipv4.gateway 192.0.2.254
|
| Sets the default gateway. |
ipv4.dns 8.8.8.8
|
DNS1=8.8.8.8
|
Modify /etc/resolv.conf to use this nameserver.
|
ipv4.dns-search example.com
|
DOMAIN=example.com
|
Modify /etc/resolv.conf to use this domain in the search directive.
|
ipv4.ignore-auto-dns true
|
PEERDNS=no
| Ignore DNS server information from the DHCP server. |
ipv6.method manual
|
IPV6_AUTOCONF=no
| IPv6 addresses configured statically. |
ipv6.method auto
|
IPV6_AUTOCONF=yes
| Configures network settings using SLAAC from router advertisements. |
ipv6.method dhcp
|
| Configures network settings by using DHCPv6, but not SLAAC. |
ipv6.addresses 2001:db8::a/64
|
|
Sets static IPv6 address and network prefix.
If more than one address is set for the connection, IPV6ADDR_SECONDARIES takes a double-quoted list of space-delimited address/prefix definitions.
|
ipv6.gateway 2001:db8::1
|
| Sets the default gateway. |
ipv6.dns fde2:6494:1e09:2::d
|
DNS1=fde2:6494:...
|
Modify /etc/resolv.conf to use this nameserver.
Exactly the same as IPv4.
|
ipv6.dns-search example.com
|
IPV6_DOMAIN=example.com
|
Modify /etc/resolv.conf to use this domain in the search directive.
|
ipv6.ignore-auto-dns true
|
IPV6_PEERDNS=no
| Ignore DNS server information from the DHCP server. |
connection.autoconnect yes
|
ONBOOT=yes
| Automatically activate this connection at boot. |
connection.id ens3
|
NAME=ens3
| The name of this connection. |
connection.interface-name ens3
|
DEVICE=ens3
| The connection is bound to the network interface with this name. |
802-3-ethernet.mac-address ...
|
HWADDR=...
| The connection is bound to the network interface with this MAC address. |
It is also possible to configure the network by directly editing the connection configuration files.
Connection configuration files control the software interfaces for individual network devices.
These files are usually named /etc/sysconfig/network-scripts/ifcfg-, where namename refers to the name of the device or connection that the configuration file controls.
The following are standard variables found in the file used for static or dynamic IPv4 configuration.
Table 12.8. IPv4 Configuration Options for ifcfg File
| Static | Dynamic | Either |
|---|---|---|
|
|
|
|
In the static settings, variables for IP address, prefix, and gateway have a number at the end. This allows multiple sets of values to be assigned to the interface. The DNS variable also has a number used to specify the order of lookup when multiple servers are specified.
After modifying the configuration files, run nmcli con reload to make NetworkManager read the configuration changes. The interface still needs to be restarted for changes to take effect.
[root@host ~]#nmcli con reload[root@host ~]#nmcli con down "static-ens3"[root@host ~]#nmcli con up "static-ens3"
nmcli(1) man page
For more information, refer to the Configuring and Managing Networking Guide at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_networking/