Skip to main content

Linux Networking

Essential networking skills for DevOps and system administration.

Network Configuration

# View IP addresses
ip addr
ifconfig  # Older command

# View routing table
ip route
route -n

# Test connectivity
ping google.com
ping -c 4 8.8.8.8  # 4 packets

# DNS lookup
nslookup google.com
dig google.com

SSH - Secure Shell

# Connect to remote server
ssh user@hostname
ssh [email protected]

# SSH with key
ssh -i ~/.ssh/mykey.pem user@server

# Copy files
scp file.txt user@server:/path/
scp -r directory/ user@server:/path/

# Generate SSH key
ssh-keygen -t ed25519 -C "[email protected]"

# Copy public key to server
ssh-copy-id user@server

Firewall Basics

# UFW (Ubuntu)
sudo ufw status
sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw deny 3306/tcp

# iptables
sudo iptables -L
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

Next: Linux Shell Scripting →