Week 01: Configure Network Connections
This module covers connecting Linux computers together. Topics include Linux network configuration files, command line network configuration, and basic to advanced network troubleshooting.
Learning Objectives
- Describe Network Configuration Files
- Configure Networks with the Linux command line
- Perform Basic Network Troubleshooting
- Perform Advanced Network Troubleshooting
Network Configuration Files
Every Linux distribution uses network configuration files to define network settings. Debian-based distributions use interface files (e.g., /etc/network/interfaces). Red Hat-based distributions use scripts in /etc/sysconfig/network-scripts/. openSUSE uses /etc/sysconfig/network.
Example Debian static IP configuration for eth0:
iface eth0 inet static
address 192.168.1.55
netmask 255.255.255.0
gateway 192.168.1.1
iface eth0 inet6 static
address 2001:db8::1
netmask 64
For DHCP (Debian):
iface eth0 inet dhcp
iface eth0 inet6 dhcp
Red Hat uses two files: one per interface (e.g., ifcfg-enp0s8) and a global /etc/sysconfig/network. Example interface file for DHCP:
DEVICE=enp0s8
BOOTPROTO=dhcp
ONBOOT=yes
Global network file:
HOSTNAME=centosServer
GATEWAY=192.168.1.1
Command Line Network Configuration
NetworkManager is a service for managing network configurations. It provides a GUI, but also command line tools: nmtui (text-based menu) and nmcli (comand line interface).
Common nmcli commands:
nmcli con show– list connectionsnmcli con add– add new connectionnmcli con mod– modify existing connectionnmcli con del– delete a connection
Example to set static IPv4:
nmcli con mod eth0 ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.dns 8.8.8.8
Basic Network Troubleshooting
ping – sends ICMP echo requests to test connectivity. Useful options: -c (count), -i (interface), -4 or -6.
host – queries DNS. Examples:
host google.com
host 8.8.8.8
host -t ns google.com
dig – more flexible DNS query tool. Example:
dig google.com
dig @8.8.8.8 google.com
nslookup – also queries DNS. Example:
nslookup google.com
nslookup 8.8.8.8
nslookup -type=ns google.com
Advanced Network Troubleshooting
netstat – displays network connections, routing tables, and interface statistics. Common options: -a (all connections), -r (routing table), -t (TCP), -u (UDP).
ss – a modern alternative to netstat for socket statistics. Examples:
ss
ss -l (listening sockets)
ss -t (TCP sockets)
ss -u (UDP sockets)
Week 02: Administering Users and Groups
Learning Objectives
- Add Linux Users
- Manage Linux User Groups
- Set up the Linux Environment for Users
- Interrogate Current User Information
Linux Users
Key files for user management:
/etc/login.defs– default settings for passwords, UID ranges, etc./etc/default/useradd– defaults for new users (group, home, shell, etc.)/etc/skel/– skeleton directory; files here are copied to new user's home directory (.bashrc,.profile, etc.)/etc/passwd– user account information (username, UID, GID, home, shell)/etc/shadow– encrypted passwords and password aging info
The /etc/passwd format:
username:x:UID:GID:comment:home_directory:login_shell
Example:
aspeno:x:1001:1001:Aspeno:/home/aspeno:/bin/bash
The /etc/shadow format:
username:encrypted_password:last_change:min_age:max_age:warn:inactive:expire
Common commands:
useradd username– create user. Options:-d(home directory),-s(shell)passwd username– set/change password. Options:-d(delete),-e(force expire),-l(lock)
Linux User Groups
Files: /etc/group (stores group info: group name, GID, member list). Types: primary group (default for file creation) and secondary (supplementary) groups.
Commands:
groupadd groupname– create group. Options:-g GID,-p passwordusermod -g groupname username– change primary groupusermod -aG groupname username– add user to supplementary group (preserve other groups)
Example: add user aspeno to the sudo group:
usermod -aG sudo aspeno
User Configuration
Environment files depend on shell startup method:
- Login shell: reads
~/.bash_profile,~/.bash_login,~/.profile(first found) - Interactive non-login shell: reads
~/.bashrc - Global files:
/etc/profile,/etc/bashrc,/etc/profile.d/*
Common environment variables: HISTSIZE, PATH, PS1.
Query User Information
whoami– current userwho– list all logged-in usersw– detailed user info (login time, idle, CPU usage, currant command)id– user/group IDs. Example:id aspeno,id -u aspeno,id -g aspeno,id -G aspenolast– historical login records
Week 03: Manage Disk Storage
Learning Objectives
- Partition Hard Drives
- Manage Linux File Systems
- Mount Linux File Systems
- Monitor Linux File Systems
Hard Drive Partitions
Two partition schemes: MBR (Master Boot Record) supports up to 4 primary partitions; GPT (GUID Partition Table) supports up to 128 partitions. GPT is required for disks > 2TB and UEFI boot.
Tools: fdisk for MBR, gdisk for GPT. Common interactive commands: n (new), d (delete), p (print), w (write).
Example:
fdisk /dev/sdb
# then use n, p, w etc.
gdisk /dev/sdb
Linux File Systems
Linux uses a virtual directory tree rooted at /. Standard directories per FHS: /boot (boot files), /home (user data), /usr (programs), /var (variable data), /mnt and /media (mount points).
Common file system types: ext3, ext4 (journaling, ext4 supports up to 16TB files), swap (virtual memory), NTFS (Microsoft), VFAT (USB drives, compatible across OS).
Linux File Systems Management
mkfs -t ext4 /dev/sda1– create an ext4 file system on a partitionmount -t ext4 /dev/sda1 /mnt/media– temporary mount/etc/fstab– file to automatically mount at boot. Format:device mount_point fstype options dump pass. Example:/dev/sda1 / ext4 defaults 0 1
Linux File Systems Monitoring
df -h– disk usage by partition (human-readable)du -h /path– disk usage by directoryiostat -d– real-time disk statisticslsblk– list block devices (partitions and mount points)
Week 04: Managing Software Packages
Learning Objectives
- Compile Open-Source Packages
- Use Repository Tools
- Install and Update Packages
Open-Source Packages
- wget and curl – download files from the web. Example:
wget http://example.com/file.tar.gz;curl -O http://example.com/file.tar.gz - tar – archive files. Create:
tar cvf archive.tar *.cpp. Extract:tar xvf archive.tar. List:tar tvf archive.tar - gcc – compile C/C++ code. Example:
gcc source.c -o myprogram
Software Packages
Packages bundle compiled applications. Two major package systems:
- Debian:
dpkg–dpkg -i package.deb(install),dpkg -l(list),dpkg -r package(remove) - Red Hat:
rpm–rpm -ivh package.rpm(install),rpm -qa(list all),rpm -e package(erase)
Software Repositories
Repositories store tested packages. Tools:
- Debian:
apt-cache search term,apt-get update(refresh index),apt-get upgrade(upgrade all),apt-get install wget - Red Hat:
yum install wget,yum remove wget,yum update wget
Lab Activities
Practice commands in a cloud Linux shell: host, dig, nslookup, ss, netstat, passwd, whoami, w, id, df, du, lsblk, wget, curl, tar, gcc.