DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

DEVOPS SSH & NETWORKING PRACTICAL LAB

🧩 MODULE 1 β€” NETWORK FOUNDATION (WHY SSH WORKS)


πŸ”Ή Lecture Topics Covered

  • TCP vs UDP
  • Port scanning (Nmap)
  • NAT & Port Forwarding
  • Home vs Cloud networking
  • Why SSH ports matter

πŸ§ͺ LAB 1 β€” Understanding Ports & Services (Nmap)

🎯 Goal

Understand what ports are, why SSH uses ports, and how attackers find servers.


🧠 Concept (Beginner Explanation)

A port is like a door on a server.
SSH uses port 22 by default.

Attackers scan the internet to find open doors.


πŸ§ͺ Exercise

  1. Install nmap:
sudo apt install nmap -y
Enter fullscreen mode Exit fullscreen mode
  1. Scan localhost:
nmap localhost
Enter fullscreen mode Exit fullscreen mode
  1. Scan SSH explicitly:
nmap -p 22 localhost
Enter fullscreen mode Exit fullscreen mode
  1. Run SYN scan (root required):
sudo nmap -sS localhost
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • What β€œopen”, β€œclosed”, β€œfiltered” mean
  • Why SSH port scanning is dangerous
  • Why changing SSH port reduces noise

πŸ§‘β€πŸ’Ό DevOps Real-World Use

Before exposing a server, DevOps engineers scan their own infrastructure to ensure only expected ports are open.


πŸ§ͺ LAB 2 β€” NAT & Port Forwarding (Mental Model)

🎯 Goal

Understand why SSH sometimes works locally but not from outside.


🧠 Concept

  • Home router = NAT
  • Internal IP β‰  Internet IP
  • SSH from outside requires port forwarding

πŸ§ͺ Exercise (Observation)

  1. Find local IP:
ip a
Enter fullscreen mode Exit fullscreen mode
  1. Find gateway:
ip route
Enter fullscreen mode Exit fullscreen mode
  1. Understand:
  • Why cloud servers don’t need port forwarding
  • Why home servers do

🧠 What You Learn

  • Why cloud networking feels β€œeasier”
  • Why DevOps prefers cloud infra
  • Why NAT breaks inbound SSH

🧩 MODULE 2 β€” SSH FUNDAMENTALS


πŸ”Ή Lecture Topics Covered

  • What SSH is
  • Client vs Server
  • Use cases
  • VM networking models

πŸ§ͺ LAB 3 β€” Install & Start SSH Server

🎯 Goal

Turn a machine into a real server.


🧠 Concept

SSH server = remote control service


πŸ§ͺ Exercise

Ubuntu:

sudo apt update
sudo apt install openssh-server -y
sudo systemctl status ssh
Enter fullscreen mode Exit fullscreen mode

CentOS:

sudo dnf install openssh-server -y
sudo systemctl enable sshd --now
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Difference between client & server
  • How servers accept connections
  • How system services work

πŸ§‘β€πŸ’Ό DevOps Reality

Every cloud VM you manage relies on SSH.


πŸ§ͺ LAB 4 β€” SSH Connection Basics

🎯 Goal

Log into a server remotely.


πŸ§ͺ Exercise

ssh user@server-ip
Enter fullscreen mode Exit fullscreen mode

Test:

whoami
hostname
pwd
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • You are controlling a remote machine
  • Commands run on the server, not locally

🧩 MODULE 3 β€” SSH SECURITY HARDENING (CORE DEVOPS SKILL)


πŸ”Ή Lecture Topics Covered

  • Change SSH port
  • Disable root login
  • Whitelist users
  • Logs & monitoring

πŸ§ͺ LAB 5 β€” Change SSH Port (22 β†’ 2222)

🎯 Goal

Reduce attack surface.


πŸ§ͺ Exercise

sudo nano /etc/ssh/sshd_config
Enter fullscreen mode Exit fullscreen mode

Change:

Port 2222
Enter fullscreen mode Exit fullscreen mode

Test:

sudo sshd -t
sudo systemctl restart sshd
Enter fullscreen mode Exit fullscreen mode

Connect:

ssh -p 2222 user@server
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • How SSH configuration works
  • Why services must be restarted
  • How easy it is to break access

πŸ§‘β€πŸ’Ό DevOps Reality

Every production SSH server does this.


πŸ§ͺ LAB 6 β€” Disable Root Login

🎯 Goal

Prevent instant full compromise.


πŸ§ͺ Exercise

PermitRootLogin no
Enter fullscreen mode Exit fullscreen mode

Restart SSH.

Test:

ssh root@server
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Principle of least privilege
  • Why attackers target root

πŸ§ͺ LAB 7 β€” AllowUsers Whitelisting

🎯 Goal

Explicitly control access.


πŸ§ͺ Exercise

AllowUsers devuser
Enter fullscreen mode Exit fullscreen mode

Test login failure for others.


🧠 What You Learn

  • SSH as access control layer
  • How DevOps enforces policy

🧩 MODULE 4 β€” DO NOT LOCK YOURSELF OUT


πŸ”Ή Lecture Topics Covered

  • Multiple SSH sessions
  • Safe changes
  • Recovery mindset

πŸ§ͺ LAB 8 β€” Two-Session Safety Practice

🎯 Goal

Never brick a production server.


πŸ§ͺ Exercise

  1. Open two SSH terminals
  2. Stop SSH:
sudo systemctl stop sshd
Enter fullscreen mode Exit fullscreen mode
  1. Observe:
  • Session A works
  • Session B fails
  1. Restore:
sudo systemctl start sshd
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Why existing connections survive
  • How DevOps recovers mistakes

🧩 MODULE 5 β€” SSH KEYS (ENTERPRISE AUTH)


πŸ”Ή Lecture Topics Covered

  • Public/private keys
  • ssh-keygen
  • ssh-copy-id
  • authorized_keys

πŸ§ͺ LAB 9 β€” SSH Key Authentication

🎯 Goal

Replace passwords with cryptography.


πŸ§ͺ Exercise

ssh-keygen -t rsa -b 4096
ssh-copy-id -p 2222 user@server
ssh -p 2222 user@server
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Cryptographic trust
  • Why keys are stronger than passwords
  • Foundation for automation

🧩 MODULE 6 β€” DISABLE PASSWORD LOGIN


πŸ”Ή Lecture Topics Covered

  • PasswordAuthentication no
  • sudo separation
  • Recovery planning

πŸ§ͺ LAB 10 β€” Enforce Key-Only SSH

🎯 Goal

Eliminate brute-force attacks.


πŸ§ͺ Exercise

PasswordAuthentication no
Enter fullscreen mode Exit fullscreen mode

Restart SSH.

Test:

ssh user@server
Enter fullscreen mode Exit fullscreen mode

From another user β†’ should fail.


🧠 What You Learn

  • Zero-trust login
  • Production hardening standard

🧩 MODULE 7 β€” KEEP SSH ALIVE


πŸ”Ή Lecture Topics Covered

  • SSH keepalive
  • Client config
  • Long-running sessions

πŸ§ͺ LAB 11 β€” Prevent Connection Drops

🎯 Goal

Survive long deployments.


πŸ§ͺ Exercise

nano ~/.ssh/config
Enter fullscreen mode Exit fullscreen mode
Host *
  ServerAliveInterval 60
  ServerAliveCountMax 3
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Client vs server responsibility
  • Why SSH drops connections

🧩 MODULE 8 β€” FINGERPRINTS & MITM PROTECTION


πŸ”Ή Lecture Topics Covered

  • Fingerprints
  • known_hosts
  • MITM attacks

πŸ§ͺ LAB 12 β€” Fingerprint Verification

🎯 Goal

Detect impostor servers.


πŸ§ͺ Exercise

Client:

cat ~/.ssh/known_hosts
Enter fullscreen mode Exit fullscreen mode

Server:

ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
Enter fullscreen mode Exit fullscreen mode

Compare hashes.


🧠 What You Learn

  • Why fingerprints exist
  • How SSH prevents MITM

🧩 MODULE 9 β€” FILE TRANSFER (SFTP / SCP)


πŸ”Ή Lecture Topics Covered

  • SCP
  • SFTP
  • GUI tools (Cyberduck)

πŸ§ͺ LAB 13 β€” SCP & SFTP

🎯 Goal

Move data securely.


scp -P 2222 file.txt user@server:/home/user/
scp -P 2222 user@server:/home/user/file.txt .
Enter fullscreen mode Exit fullscreen mode

GUI:

  • Connect via SFTP
  • Drag & drop files

🧠 What You Learn

  • Why FTP is insecure
  • Secure automation transfers

🧩 MODULE 10 β€” SCREEN (PRODUCTION SURVIVAL TOOL)


πŸ”Ή Lecture Topics Covered

  • screen
  • detach/attach
  • collaboration

πŸ§ͺ LAB 14 β€” Screen Mastery

🎯 Goal

Survive disconnects & collaborate.


screen
Ctrl+A Ctrl+D
screen -x
exit
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Persistent sessions
  • Remote teamwork

🏁 FINAL CAPSTONE PROJECT

🎯 Scenario

You are the only DevOps engineer managing a production server.

You must:

  1. Harden SSH
  2. Use key auth only
  3. Prevent lockout
  4. Enable file transfer
  5. Keep sessions alive
  6. Share terminal with teammate

πŸŽ“ OUTCOME

After completing this:

  • Student can manage real servers
  • Student understands SSH deeply
  • Student thinks like a DevOps engineer
  • Student can pass interviews

If you want, next I can:

  • Convert this into PDF course manual
  • Create graded homework
  • Add interview questions
  • Add cloud (AWS EC2) version
  • Add GitHub lab repo

Just tell me what you want next.

Audience: Absolute beginners
Outcome: Production-ready DevOps engineer mindset
Environment: Ubuntu / CentOS / Cloud / VM
Style: Real-world, mistakes included, recovery included


🧩 MODULE 1 β€” NETWORK FOUNDATION (WHY SSH WORKS)


πŸ”Ή Lecture Topics Covered

  • TCP vs UDP
  • Port scanning (Nmap)
  • NAT & Port Forwarding
  • Home vs Cloud networking
  • Why SSH ports matter

πŸ§ͺ LAB 1 β€” Understanding Ports & Services (Nmap)

🎯 Goal

Understand what ports are, why SSH uses ports, and how attackers find servers.


🧠 Concept (Beginner Explanation)

A port is like a door on a server.
SSH uses port 22 by default.

Attackers scan the internet to find open doors.


πŸ§ͺ Exercise

  1. Install nmap:
sudo apt install nmap -y
Enter fullscreen mode Exit fullscreen mode
  1. Scan localhost:
nmap localhost
Enter fullscreen mode Exit fullscreen mode
  1. Scan SSH explicitly:
nmap -p 22 localhost
Enter fullscreen mode Exit fullscreen mode
  1. Run SYN scan (root required):
sudo nmap -sS localhost
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • What β€œopen”, β€œclosed”, β€œfiltered” mean
  • Why SSH port scanning is dangerous
  • Why changing SSH port reduces noise

πŸ§‘β€πŸ’Ό DevOps Real-World Use

Before exposing a server, DevOps engineers scan their own infrastructure to ensure only expected ports are open.


πŸ§ͺ LAB 2 β€” NAT & Port Forwarding (Mental Model)

🎯 Goal

Understand why SSH sometimes works locally but not from outside.


🧠 Concept

  • Home router = NAT
  • Internal IP β‰  Internet IP
  • SSH from outside requires port forwarding

πŸ§ͺ Exercise (Observation)

  1. Find local IP:
ip a
Enter fullscreen mode Exit fullscreen mode
  1. Find gateway:
ip route
Enter fullscreen mode Exit fullscreen mode
  1. Understand:
  • Why cloud servers don’t need port forwarding
  • Why home servers do

🧠 What You Learn

  • Why cloud networking feels β€œeasier”
  • Why DevOps prefers cloud infra
  • Why NAT breaks inbound SSH

🧩 MODULE 2 β€” SSH FUNDAMENTALS


πŸ”Ή Lecture Topics Covered

  • What SSH is
  • Client vs Server
  • Use cases
  • VM networking models

πŸ§ͺ LAB 3 β€” Install & Start SSH Server

🎯 Goal

Turn a machine into a real server.


🧠 Concept

SSH server = remote control service


πŸ§ͺ Exercise

Ubuntu:

sudo apt update
sudo apt install openssh-server -y
sudo systemctl status ssh
Enter fullscreen mode Exit fullscreen mode

CentOS:

sudo dnf install openssh-server -y
sudo systemctl enable sshd --now
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Difference between client & server
  • How servers accept connections
  • How system services work

πŸ§‘β€πŸ’Ό DevOps Reality

Every cloud VM you manage relies on SSH.


πŸ§ͺ LAB 4 β€” SSH Connection Basics

🎯 Goal

Log into a server remotely.


πŸ§ͺ Exercise

ssh user@server-ip
Enter fullscreen mode Exit fullscreen mode

Test:

whoami
hostname
pwd
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • You are controlling a remote machine
  • Commands run on the server, not locally

🧩 MODULE 3 β€” SSH SECURITY HARDENING (CORE DEVOPS SKILL)


πŸ”Ή Lecture Topics Covered

  • Change SSH port
  • Disable root login
  • Whitelist users
  • Logs & monitoring

πŸ§ͺ LAB 5 β€” Change SSH Port (22 β†’ 2222)

🎯 Goal

Reduce attack surface.


πŸ§ͺ Exercise

sudo nano /etc/ssh/sshd_config
Enter fullscreen mode Exit fullscreen mode

Change:

Port 2222
Enter fullscreen mode Exit fullscreen mode

Test:

sudo sshd -t
sudo systemctl restart sshd
Enter fullscreen mode Exit fullscreen mode

Connect:

ssh -p 2222 user@server
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • How SSH configuration works
  • Why services must be restarted
  • How easy it is to break access

πŸ§‘β€πŸ’Ό DevOps Reality

Every production SSH server does this.


πŸ§ͺ LAB 6 β€” Disable Root Login

🎯 Goal

Prevent instant full compromise.


πŸ§ͺ Exercise

PermitRootLogin no
Enter fullscreen mode Exit fullscreen mode

Restart SSH.

Test:

ssh root@server
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Principle of least privilege
  • Why attackers target root

πŸ§ͺ LAB 7 β€” AllowUsers Whitelisting

🎯 Goal

Explicitly control access.


πŸ§ͺ Exercise

AllowUsers devuser
Enter fullscreen mode Exit fullscreen mode

Test login failure for others.


🧠 What You Learn

  • SSH as access control layer
  • How DevOps enforces policy

🧩 MODULE 4 β€” DO NOT LOCK YOURSELF OUT


πŸ”Ή Lecture Topics Covered

  • Multiple SSH sessions
  • Safe changes
  • Recovery mindset

πŸ§ͺ LAB 8 β€” Two-Session Safety Practice

🎯 Goal

Never brick a production server.


πŸ§ͺ Exercise

  1. Open two SSH terminals
  2. Stop SSH:
sudo systemctl stop sshd
Enter fullscreen mode Exit fullscreen mode
  1. Observe:
  • Session A works
  • Session B fails
  1. Restore:
sudo systemctl start sshd
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Why existing connections survive
  • How DevOps recovers mistakes

🧩 MODULE 5 β€” SSH KEYS (ENTERPRISE AUTH)


πŸ”Ή Lecture Topics Covered

  • Public/private keys
  • ssh-keygen
  • ssh-copy-id
  • authorized_keys

πŸ§ͺ LAB 9 β€” SSH Key Authentication

🎯 Goal

Replace passwords with cryptography.


πŸ§ͺ Exercise

ssh-keygen -t rsa -b 4096
ssh-copy-id -p 2222 user@server
ssh -p 2222 user@server
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Cryptographic trust
  • Why keys are stronger than passwords
  • Foundation for automation

🧩 MODULE 6 β€” DISABLE PASSWORD LOGIN


πŸ”Ή Lecture Topics Covered

  • PasswordAuthentication no
  • sudo separation
  • Recovery planning

πŸ§ͺ LAB 10 β€” Enforce Key-Only SSH

🎯 Goal

Eliminate brute-force attacks.


πŸ§ͺ Exercise

PasswordAuthentication no
Enter fullscreen mode Exit fullscreen mode

Restart SSH.

Test:

ssh user@server
Enter fullscreen mode Exit fullscreen mode

From another user β†’ should fail.


🧠 What You Learn

  • Zero-trust login
  • Production hardening standard

🧩 MODULE 7 β€” KEEP SSH ALIVE


πŸ”Ή Lecture Topics Covered

  • SSH keepalive
  • Client config
  • Long-running sessions

πŸ§ͺ LAB 11 β€” Prevent Connection Drops

🎯 Goal

Survive long deployments.


πŸ§ͺ Exercise

nano ~/.ssh/config
Enter fullscreen mode Exit fullscreen mode
Host *
  ServerAliveInterval 60
  ServerAliveCountMax 3
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Client vs server responsibility
  • Why SSH drops connections

🧩 MODULE 8 β€” FINGERPRINTS & MITM PROTECTION


πŸ”Ή Lecture Topics Covered

  • Fingerprints
  • known_hosts
  • MITM attacks

πŸ§ͺ LAB 12 β€” Fingerprint Verification

🎯 Goal

Detect impostor servers.


πŸ§ͺ Exercise

Client:

cat ~/.ssh/known_hosts
Enter fullscreen mode Exit fullscreen mode

Server:

ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
Enter fullscreen mode Exit fullscreen mode

Compare hashes.


🧠 What You Learn

  • Why fingerprints exist
  • How SSH prevents MITM

🧩 MODULE 9 β€” FILE TRANSFER (SFTP / SCP)


πŸ”Ή Lecture Topics Covered

  • SCP
  • SFTP
  • GUI tools (Cyberduck)

πŸ§ͺ LAB 13 β€” SCP & SFTP

🎯 Goal

Move data securely.


scp -P 2222 file.txt user@server:/home/user/
scp -P 2222 user@server:/home/user/file.txt .
Enter fullscreen mode Exit fullscreen mode

GUI:

  • Connect via SFTP
  • Drag & drop files

🧠 What You Learn

  • Why FTP is insecure
  • Secure automation transfers

🧩 MODULE 10 β€” SCREEN (PRODUCTION SURVIVAL TOOL)


πŸ”Ή Lecture Topics Covered

  • screen
  • detach/attach
  • collaboration

πŸ§ͺ LAB 14 β€” Screen Mastery

🎯 Goal

Survive disconnects & collaborate.


screen
Ctrl+A Ctrl+D
screen -x
exit
Enter fullscreen mode Exit fullscreen mode

🧠 What You Learn

  • Persistent sessions
  • Remote teamwork

🏁 FINAL CAPSTONE PROJECT

🎯 Scenario

You are the only DevOps engineer managing a production server.

You must:

  1. Harden SSH
  2. Use key auth only
  3. Prevent lockout
  4. Enable file transfer
  5. Keep sessions alive
  6. Share terminal with teammate

πŸŽ“ OUTCOME

After completing this:

  • Student can manage real servers
  • Student understands SSH deeply
  • Student thinks like a DevOps engineer
  • Student can pass interviews

Top comments (0)