Linux Networking Fundamentals

Essential concepts and commands for Linux network administration

1. Network Configuration Files

Linux uses various files to configure network settings:

2. Network Interface Management

Common commands for managing network interfaces:

# Display network interfaces ip link show # Bring an interface up or down sudo ip link set eth0 up sudo ip link set eth0 down # Assign an IP address sudo ip addr add 192.168.1.10/24 dev eth0 # Remove an IP address sudo ip addr del 192.168.1.10/24 dev eth0

3. Network Troubleshooting Commands

# Examples ping google.com traceroute google.com ss -tuln dig google.com sudo tcpdump -i eth0

4. Firewall Configuration

Many Linux distributions use iptables or its frontend, ufw (Uncomplicated Firewall):

# Check firewall status sudo ufw status # Enable firewall sudo ufw enable # Allow incoming traffic on a specific port sudo ufw allow 22/tcp # Deny incoming traffic on a specific port sudo ufw deny 23/tcp

5. Network Services

Common network services in Linux:

# Start, stop, or restart a service (using systemd) sudo systemctl start ssh sudo systemctl stop apache2 sudo systemctl restart nginx

6. Network File Systems

Linux supports various network file systems:

# Mount an NFS share sudo mount -t nfs server:/share /mnt/nfs # Mount a CIFS share sudo mount -t cifs //server/share /mnt/cifs -o username=user,password=pass

7. Network Monitoring

Tools for monitoring network performance and usage:

Note:

Always be cautious when modifying network settings, especially on remote servers. Incorrect configuration can lead to loss of connectivity.

8. IPv6 Configuration

As IPv6 becomes more prevalent, it's important to understand its configuration:

# Enable IPv6 on an interface sudo sysctl -w net.ipv6.conf.eth0.disable_ipv6=0 # Assign an IPv6 address sudo ip -6 addr add 2001:db8::1/64 dev eth0 # Display IPv6 routing table ip -6 route show





Scroll to Top