=^.^=

Installing ifconfig on RedHat Fedora, RHEL, CentOS 7, 8, CentOS Stream 9 and Up

karma

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:

dnf install net-tools

How to Install screen on RedHat (CentOS/RHEL/Fedora/Rocky Linux)

karma

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.

dnf install epel-release

Now you can install screen as usual:

dnf install screen

Basic NFS Server and Client on RHEL/CentOS, Debian/Ubuntu and Derivatives

karma

Server

Install the NFS utilities, start and configure the service to run automatically on boot:

RHEL/CentOS
dnf install nfs-utils nfs4-acl-tools systemctl enable nfs-server.service systemctl start nfs-server.service

To configure firewalld to permit network access to the NFS services run:
firewall-cmd --permanent --add-service=nfs firewall-cmd --permanent --add-service=rpc-bind firewall-cmd --permanent --add-service=mountd firewall-cmd --reload

Debian/Ubuntu
apt install nfs-kernel-server rpcbind systemctl enable nfs-kernel-server systemctl start nfs-kernel-server

To configure ufw to permit network access to the NFS services run:
ufw allow from 192.168.0.0/24 to any port nfs ufw enable

Configuration files are located at /etc/nfs.conf and /etc/nfsmount.conf.

Create or edit /etc/exports:
/mnt/share1 192.168.0.0/24(ro) /mnt/share2 192.168.0.0/24(rw,async) /mnt/share3 192.168.0.0/24(rw,sync) /mnt/share4 192.168.0.0/24(rw,sync,no_all_squash,root_squash)

Specify the single IP address or range in CIDR notation that a share should be accessible to followed by its options in (brackets).

See man exports for detailed information about per-share configuration options.

To reload the exports configuration live, run:
exportfs -ar

To configure disk quotas please see Mass Virtual Hosting Part Three: Disk Quotas (including NFS).

Client

RHEL/CentOS
dnf install nfs-utils nfs4-acl-tools

Debian/Ubuntu
apt install nfs-common

To view the exported shares on the remote server:
showmount -e 192.168.0.100

To mount a remote share:
mount -t nfs 192.168.0.100:/mnt/share1 /mnt/shared

To add a remote share to fstab (automatically mount at boot, simplified mount /mountpoint):
192.168.0.100:/mnt/share1 /mnt/shared nfs defaults 0 0

Basic Network Interface Confguration with NetworkManager via nmcli

karma
[attachment-qFVVzQ]
nmtui's ncurses interface

Preface

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:

CLI

nmcli connection modify eth0 IPv4.address 192.168.0.100/24 nmcli connection modify eth0 IPv4.gateway 192.168.0.1 nmcli connection modify eth0 IPv4.dns 192.168.0.1,8.8.8.8,8.8.4.4 nmcli connection modify eth0 IPv4.method manual

To effect the changes you must raise or reload the interface, using nmcli:
nmcli connection up eth0
or on RedHat flavours simply:
ifup eth0

Note the following:

  • The interface's address is specified in CIDR notation (i.e. including the netmask)
  • Arrays of multiple addresses are defined as comma-delimited lists (e.g: IP1,IP2,IP3). Take care to not include spaces.

The IPv4.method property can be set to any one of: disabled, auto (dhcp), manual or link-local. For a complete list of IPv4 configuration options please see https://developer.gnome.org/NetworkManager/stable/settings-ipv4.html.

IPv6 is configured in the same way; see https://developer.gnome.org/NetworkManager/stable/settings-ipv6.html for IPv6 configuration options and modify your syntax accordingly.

Shell

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/24 nmcli> set IPv4.gateway 192.168.0.1 nmcli> set IPv4.dns 192.168.0.1,8.8.8.8,8.8.4.4 nmcli> set IPv4.method manual nmcli> save Connection 'eth0' successfully updated. nmcli> quit

Again the connection must either be reloaded or raised to take effect:
nmcli connection up eth0 or ifup eth0

Determining Listening Services and Open Ports on Linux with lsof, netstat, ss or nmap

karma

Introduction

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.

lsof

lsof -i -n -P

lsof -i -n -P | grep ":80"

netstat

netstat -plnt

ss

ss -tunlp

nmap

nmap 192.168.0.100 -p 1-65535