little foxes at the keyboards little foxes making clicky-clacky little foxes on the servers little foxes all untame there's a black hat and a white hat and a grey one and fun for everyone! and they're all making clicky-clacky and they're all in your mainframe
ifconfig has been deprecated in favour of the ip utility for many years and was removed in RHEL/CentOS 7. Being a creature of habit, I choose to install it anyway so when I reach for it I don't waste time realizing and correcting my mistake. It is available in the net-misc package:
dnf install net-misc
As of CentOS Stream 9 the package is now named net-tools:
screen was included in the default repositories distributed with RHEL/CentOS 7 and earlier. Since RHEL/CentOS 8 it is now necessary to configure the Extra Packages for Enterprise Linux (EPEL) repos, which you're probably going to need eventually anyway.
Having discovered nmtui only some time after familiarizing myself with nmcli - under the incorrect assumption that it would be necessary - I am adding this some time since publishing the body of the following article so that you might not make the same error:
I realize that for 99% of readers I am about to kill an article, but better for you to get the goods off the bat than to waste anyone's time. Before we dig into nmcli it would be remiss for me to not inform you of its menu-based ncurses relative that is so much easier that it does not even warrant its own article: nmtui. It is quick and feature-full enough to render knowing nmcli syntax relevant more-or-less exclusively to those looking to implement interfacing with Network Manager within shell scripts.
For those of you remaining so-inclined, I present the following...
Introduction
I have always favoured directly editing network configuration plaintext files (e.g: /etc/sysconfig/network-scripts/ifcfg-ifname on RedHat flavours). However it has for some time been more ideologically correct to manage the network configuration on many distributions via the NetworkManager daemon. More importantly, it is intrusive, obnoxious and annoying to disable NM such that it does not interfere with manual configurations (lookin' at you, Ubuntu). So this is my attempt to find religion.
Unless there is a crazy good reason, I don't do GUIs on servers. nmcli is provided to interface with NetworkManager from the command line. It can be used in CLI (direct) or shell (interactive) mode, as root/via sudo:
As root/via sudo: nmcli connection edit eth0
===| nmcli interactive connection editor |===
Editing existing '802-3-ethernet' connection: 'eth0'
Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [.]' for detailed property descrIPtion.
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, IPv4, IPv6, tc, proxy
nmcli> set IPv4.address 192.168.0.100/24nmcli> set IPv4.gateway 192.168.0.1nmcli> set IPv4.dns 192.168.0.1,8.8.8.8,8.8.4.4nmcli> set IPv4.method manualnmcli> save
Connection 'eth0' successfully updated.
nmcli> quit
Again the connection must either be reloaded or raised to take effect: nmcli connection up eth0orifup eth0
When troubleshooting network services it is essential to be able to see that a service is not just running but also accessible. Not every tool we cover will be available in any given environment; lsof in particular is rarely a part of default installations. It may not be possible to quickly or easily install your favourite utility, particularly on an outdated system. Therefore it is helpful to carry many tools in your belt. A listening service is not necessarily open; we will also cover using a port scanner like nmap to verify accessibility from remote hosts and how to check your netfilter rules with iptables.