Network Settings
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 wiredAssign static ip addresses
nmcli connection modify wired ipv4.method static ipv4.address 192.168.249.174/24Bring 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 showsample output:
[will@rhel ~]$ nmcli connection show
NAME UUID TYPE DEVICE
ethernet-eno0 5e9bb5b5-6be7-4de4-8fb2-7a221f07a0ac 802-3-ethernet eno0Rename a connection
nmcli connection modify wired connection.id ethernet-eno0Consistent network device name
A rule in
/usr/lib/udev/rules.d/60-net.rulesinstructs the udev helper utility,/lib/udev/rename_device, to look into all/etc/sysconfig/network-scripts/ifcfg-suffixfiles. If it finds an ifcfg file with aHWADDRentry matching the MAC address of an interface it renames the interface to the name given in the ifcfg file by theDEVICEdirective.
nmcli connection modify ethernet-eno0 802-3-ethernet.mac-address 00:0c:29:73:d9:04this 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:04Hostname
Show hostname
[will@rhel ~]$ nmcli general hostname
localhost.localdomainModify hostname
nmcli general hostname rhel.vmgVerify hostname
[will@rhel ~]$ cat /etc/hostname
rhel.vmg