Introduction

A basic understanding of networking is important for system admin. Not only is it essential for getting your services online and running smoothly, it also give you the insight to diagnose problems.

This article will privides an overview of the common network related operations.

Network Connection

New connection

nmcli connection add type ethernet ifname eno0 con-name wired

Assign static ip addresses

nmcli connection modify wired ipv4.method static ipv4.address 192.168.249.174/24

Bring it up/down

up

[will@rhel ~]$ sudo nmcli connection up ethernet-eno0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)

down

[will@rhel ~]$ sudo nmcli connection down ethernet-eno0
Connection 'ethernet-eno0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)

View connections

nmcli connection show

sample output:

[will@rhel ~]$ nmcli connection show
NAME UUID TYPE DEVICE
ethernet-eno0 5e9bb5b5-6be7-4de4-8fb2-7a221f07a0ac 802-3-ethernet eno0

Rename a connection

nmcli connection modify wired connection.id ethernet-eno0

Consistent network device name

A rule in /usr/lib/udev/rules.d/60-net.rules instructs the udev helper utility, /lib/udev/rename_device, to look into all /etc/sysconfig/network-scripts/ifcfg-suffix files. If it finds an ifcfg file with a HWADDR entry matching the MAC address of an interface it renames the interface to the name given in the ifcfg file by the DEVICE directive.

nmcli connection modify ethernet-eno0 802-3-ethernet.mac-address 00:0c:29:73:d9:04

this will write HWADDR to ifcfg-suffix file, verify it

[will@rhel ~]$ grep HWADDR /etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/ifcfg-ethernet-eno0:HWADDR=00:0C:29:73:D9:04

Hostname

Show hostname

[will@rhel ~]$ nmcli general hostname
localhost.localdomain

Modify hostname

nmcli general hostname rhel.vmg

Verify hostname

[will@rhel ~]$ cat /etc/hostname
rhel.vmg