LinuxGetting StartedNetworking

Networking

Learn about Linux networking concepts, configuration, and troubleshooting.

Linux Networking

This guide covers essential networking concepts and commands in Linux.

Basic Networking Commands

Network Status

ifconfig    # Display network interface configuration
ip addr     # Modern alternative to ifconfig
netstat     # Network statistics
ss          # Modern alternative to netstat

Network Testing

ping       # Test network connectivity
traceroute # Trace packet route
nslookup   # Query DNS records
dig        # Advanced DNS lookup

Network Configuration

Network Interfaces

ip link set eth0 up    # Enable interface
ip link set eth0 down  # Disable interface
ip addr add 192.168.1.10/24 dev eth0  # Set IP address

Network Services

systemctl status NetworkManager  # Check network service status
systemctl restart networking    # Restart networking service

Firewall Management

UFW (Uncomplicated Firewall)

ufw enable           # Enable firewall
ufw allow ssh       # Allow SSH traffic
ufw status          # Check firewall status

iptables

iptables -L         # List firewall rules
iptables -A INPUT -p tcp --dport 80 -j ACCEPT  # Allow HTTP traffic

Network Troubleshooting

Common Tools

mtr         # Combine ping and traceroute
tcpdump     # Capture network traffic
wireshark   # GUI network analyzer

DNS Configuration

cat /etc/resolv.conf  # DNS resolver configuration
cat /etc/hosts       # Static host mappings

Network Security

SSH Configuration

ssh-keygen          # Generate SSH key pair
ssh-copy-id        # Copy SSH key to server

Network Monitoring

iftop              # Monitor bandwidth usage
nethogs           # Monitor per-process bandwidth

Best Practices

  1. Always backup network configuration files before making changes
  2. Document network changes and configurations
  3. Use secure protocols (SSH, HTTPS) instead of insecure ones
  4. Regularly monitor network traffic and logs
  5. Keep network-related packages updated

Next Steps

  • Learn about advanced networking concepts
  • Study network protocols in detail
  • Practice network security hardening
  • Explore network automation tools