Network Settings

Set hostname.

[[email protected] ~]# hostnamectl set-hostname futurelinux.org

or

[[email protected] ~]# echo "futurelinux.org" > /etc/hostname

Both hostname settings will take effect the next time you log in.

Basic:

You can configure the network using the nmcli command.
It can also be used by shortening the parameters of the command.

For example: To get the list of network devices:

[[email protected] ~]# nmcli device

or

[[email protected] ~]# nmcli dev

or

[[email protected] ~]# nmcli d

they all produce the same output.

Set a static IP address: (Replace [enp3s0] with your interface name)

[1] Display devices.

[[email protected] ~]# nmcli dev
DEVICE  TYPE       STATE         CONNECTION
enp3s0  ethernet   connected      enp3s0    
lo      loopback   unmanaged      --

[2] Set IPv4 address.

[[email protected] ~]# nmcli connection modify enp3s0 ipv4.addresses 10.0.0.2/24

[3] Set gateway.

[[email protected] ~]# nmcli con mod enp3s0 ipv4.gateway 10.0.0.1

[4] Set DNS.

[[email protected] ~]# nmcli con mod enp3s0 ipv4.dns 10.0.0.1

[5] Restart the interface and reload the settings.

[[email protected] ~]# nmcli con down enp3s0
Connection 'enp3s0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)
[[email protected] ~]# nmcli con up enp3s0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)

or

[[email protected] ~]# nmcli con reload

[6] Show settings.

[[email protected] ~]# nmcli con show enp3s0
connection.id:                          enp3s0
connection.uuid:                        28b2a914-bcc5-460b-a606-1810bcce3787
connection.stable-id:                   --
connection.type:                        802-3-ethernet
connection.interface-name:              enp3s0
connection.autoconnect:                 yes
...
ipv4.dns:                               10.0.0.1
...
ipv4.addresses:                         10.0.0.2/24
ipv4.gateway:                           10.0.0.1
...