Skip to content

Network & System

Networking configuration, SSH setup, and system administration references.

Quick Access

Most Popular:

SSH & Security

SSH Configuration

Complete SSH setup and management guide:

Key Generation:

  • Generate RSA and Ed25519 keys
  • Choose key type and size
  • Set up passphrases

SSH Agent:

  • Start SSH agent
  • Add keys to agent
  • Configure auto-loading

Multiple Accounts:

  • GitHub personal and work
  • Multiple Git services
  • SSH config file examples

Services:

  • Add keys to GitHub
  • Add keys to GitLab
  • Test SSH connections

Networking

Subnet Reference

CIDR notation and subnet mask reference:

CIDR Basics:

  • /32 - Single host (255.255.255.255)
  • /24 - Standard subnet (255.255.255.0) - 254 hosts
  • /16 - Large network (255.255.0.0) - 65,534 hosts
  • /8 - Very large (255.0.0.0) - 16,777,214 hosts

Private Ranges:

  • 10.0.0.0/8 (Class A)
  • 172.16.0.0/12 (Class B)
  • 192.168.0.0/16 (Class C)

Calculations:

  • Subnet formulas
  • Network/broadcast addresses
  • Usable host ranges
  • Subnetting examples

Common Tasks

SSH Setup for GitHub

bash
# 1. Generate SSH key
ssh-keygen -t ed25519 -C "your_email@example.com"

# 2. Start SSH agent and add key
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

# 3. Copy public key
cat ~/.ssh/id_ed25519.pub

# 4. Add to GitHub (Settings → SSH Keys)

# 5. Test connection
ssh -T git@github.com

Multiple SSH Keys

Create ~/.ssh/config:

# Personal GitHub
Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_personal

# Work GitHub
Host github-work
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_work

Usage:

bash
# Personal repo
git clone git@github.com:username/repo.git

# Work repo
git clone git@github-work:company/repo.git

Subnet Calculation

Divide /24 into 4 subnets:

Original: 192.168.1.0/24 (254 hosts)

Subnets (/26 each, 62 hosts):
1. 192.168.1.0/26   - IPs: .1 to .62
2. 192.168.1.64/26  - IPs: .65 to .126
3. 192.168.1.128/26 - IPs: .129 to .190
4. 192.168.1.192/26 - IPs: .193 to .254

Network Commands

Test Connectivity

Cross-platform:

bash
# Ping
ping google.com

# Trace route
traceroute google.com  # Linux/Mac
tracert google.com     # Windows

# DNS lookup
nslookup google.com
dig google.com         # Linux/Mac

View Network Configuration

Linux/macOS:

bash
# Network interfaces
ip addr show
ifconfig

# Routing table
ip route
netstat -rn

# Active connections
ss -tulpn
netstat -tulpn

Windows:

powershell
# Network configuration
ipconfig /all

# Routing table
route print

# Active connections
netstat -ano

Flush DNS Cache

Linux:

bash
sudo systemd-resolve --flush-caches
sudo /etc/init.d/networking restart

macOS:

bash
sudo killall -HUP mDNSResponder

Windows:

powershell
ipconfig /flushdns

SSH Troubleshooting

Permission Denied

bash
# Check key permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub

# Test with verbose output
ssh -vT git@github.com

# Verify key is loaded
ssh-add -l

Connection Timeout

bash
# Test connectivity
ping github.com

# Try alternative port
ssh -p 443 git@ssh.github.com

# Check SSH config
cat ~/.ssh/config

Host Key Verification Failed

bash
# Remove old host key
ssh-keygen -R github.com

# Or disable strict checking (not recommended)
ssh -o StrictHostKeyChecking=no user@host

Network Troubleshooting

Can't Reach Server

bash
# 1. Ping server
ping 192.168.1.100

# 2. Check route
traceroute 192.168.1.100

# 3. Check DNS
nslookup server.com

# 4. Test specific port
telnet server.com 80
nc -vz server.com 80

Slow Connection

bash
# Check latency
ping -c 10 server.com

# Trace route with timing
mtr server.com  # Linux

# Check bandwidth
speedtest-cli   # Install via pip

Port Already in Use

Linux/macOS:

bash
# Find process using port 8080
lsof -i :8080
sudo netstat -tulpn | grep :8080

# Kill process
kill -9 <PID>

Windows:

powershell
# Find process
netstat -ano | findstr :8080

# Kill process
taskkill /PID <PID> /F

Security Best Practices

SSH Security

  1. Use Ed25519 keys (or RSA 4096)
  2. Always use passphrases
  3. Different keys for different services
  4. Rotate keys annually
  5. Never share private keys
  6. Use SSH agent for convenience

Network Security

  1. Use private IP ranges for internal networks
  2. Implement proper subnetting
  3. Enable firewall rules
  4. Monitor network traffic
  5. Use VPN for remote access
  6. Regular security audits

Quick Reference

SSH Commands

bash
# Generate key
ssh-keygen -t ed25519 -C "email@example.com"

# Add to agent
ssh-add ~/.ssh/id_ed25519

# Copy public key (Linux)
cat ~/.ssh/id_ed25519.pub | xclip -sel clip

# Copy public key (macOS)
pbcopy < ~/.ssh/id_ed25519.pub

# Copy public key (Windows)
Get-Content ~/.ssh/id_ed25519.pub | clip

# Test connection
ssh -T git@github.com

Network Commands

bash
# Show IP address
ip addr show           # Linux
ifconfig              # macOS
ipconfig              # Windows

# Show routing table
ip route              # Linux
netstat -rn           # macOS
route print           # Windows

# Active connections
ss -tulpn             # Linux
netstat -ano          # Windows

See Also

External Resources

Released under the MIT License.