We’re skipping netplan, PPP configuration, and systemd .service config files.

Configuring network interfaces

Older Linux versions would name Ethernet interfaces eth0, eth1, eth2 and name WiFi interfaces wlan0, wlan1, and so on. SystemD gets creative and gives them names like enp0s3 and wlp8s0 based on what data bus they’re physically connected to.

Your first step should always be figure out how interfaces are configured on your system.

Are you using the ip set of commands, or ifconfig? Remember to run sudo ifconfig when you check, because ifconfig is often a root-only program. If ip a works, you’re probably on a fairly recent SystemD system. Technically you can still install net-tools and get the ifconfig command back, even on a SystemD system, but it’s not the recommended way of doing things.

Older Linux networking

Check if any config files exist:
nano /etc/network/interfaces
ls /etc/network/interfaces.d/*
service networking status
systemctl status networking

SystemD networkd

Check if your system has SystemD networkd installed and running:
systemctl status systemd-networkd
nano /etc/systemd/networkd.conf
ls /etc/systemd/network/

We won’t be configuring networkd in this course.

NetworkManager

NetworkManager is often installed when a desktop environment is set up. Linux distributions that are aimed at server usage and don’t install a DE might not install NetworkManager.

NetworkManager depends on systemd to work but doesn’t use the same config files.

Check if the Network Manager service is running:

systemctl status NetworkManager

Check if the Network Manager config file exists:

nano /etc/NetworkManager/NetworkManager.conf

If a network interface is listed in /etc/network/interfaces or a file under /etc/network/interfaces.d/, NetworkManager will assume you want to manually configure it and won’t touch it.

Configuring NetworkManager

NetworkManager is designed to be used in the GUI, but it does include some commandline tools.

You’ll mostly be using the nmcli command to show infomation:

nmcli
nmcli device show
nmcli device status eth0

To open a text-based interface for editing connections, run

nmtui

To open the GUI applet for editing network connections, run

nm-connection-editor

Netplan

Don’t worry about it.

DNS:

/etc/hosts contains a list of manually created IP/hostname pairs. It’s basically doing DNS the hard way.
/etc/resolv.conf tells Linux which DNS servers to use.

Commands

CommandPurposeUsage
lspciList all PCI devices, not just network interfaces
ethtool
ifconfigOnly exists on older Linux systems. Stand for “Interface Config”. Used to list network adapters and their config info.ifconfig to list all adapters
ifconfig eth0 to list info for eth0
ifdown eth0 to disable the eth0 interface
ifup eth0 to turn eth0 back on
ipOnly exists on newer SystemD-based Linux systems.ip addr show to list network adapters and their IP addresses
ip a does the same thing
ip route is the equivalent of route
dhclientDHCP Client, forces an interface to request a DHCP addressdhclient eth0 to have eth0 request a DHCP address
netplanOnly exists on Ubuntu.We won’t be using netplan in this class.
nmcliNetworkManager Command Line Interface. Used to show and edit network connections from the terminal.

Only exists on newer SystemD-based Linux systems using NetworkManager.
nmcli device status<br>nmcli device show ens33
nmtuiNetworkManager Text User Interface. Used to edit network connections from the terminal in a pseudo-GUI.nmtui<br>nmtui edit eth0
nm-connection-editorNetworkManager Connection Editor. Used to edit network connections in a graphical user interface.nm-connection-editor
whois
hostUses DNS to find the IP address associated with a given domain name.
dig
hostnameShows the current hostname, temporarily changes the hostname until next reboot.hostname
hostname minty
hostnamectlEdits /etc/hostname to permanently change the hostname.hostnamectl set-hostname debian01.csec100.dom
resolvectl
sysctlNot a network-specific command. Used to set almost any /proc/sys file setting.
tracerouteTraces the route to a destination IP by using malformed ICMP pings with a very low TTL.
netstatNetwork Statistics, replaced by ss on newer systems.-a to show all ports/sockets
-t to show TCP connections
-u to show UDP connections
-l to show only listening ports
-p to show the program associated with each connection
-n to show numeric addresses
ssSocket Statistics, newer replacement for most of netstat’s functionality

If you’re configuring networks through the desktop GUI, you’re almost always doing it through NetworkManager.

DNS

/etc/hosts is basically a text file that’s checked for IP/domain name pairs before reaching out to DNS. /etc/resolv.conf is a file that defines what DNS servers are contacted and when they’re used.

Routing

A computer connected to more than one network is called a multihomed host.

By default, Linux hosts won’t route traffic between networks. You can change that by running the following commands:

echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding

When you enable forwarding on a server, it will start routing traffic between any networks it’s connected to, like your RRAS routes traffic between 192.168.1.0 and 10.1.1.0.

If you’re using ifconfig, you’ll use the route command to monitor routes. If you’re using iproute2, you’ll run ip route.

Network services to know

Telnet, SSH, VNC, RDP, FTP,

For the AD week:
SMB, NFS, LDAP,

Setting up a VNC server
Setting up an FTP server
Using SCP (Secure Copy Protocol, basically file copying over SSH instead of FTP/SMB/NFS)
Using SFTP (SSH File Transfer Protocol, basically SCP but better, still using port 22)
One small detail with SCP: it can use the Secure Copy Protocol (somewhat outdated, not the best option) or the SSH File Transfer Protocol