Network Developer Guide
Section titled “Network Developer Guide”Networking commands help you connect to remote systems, move files, inspect interfaces, troubleshoot DNS, monitor traffic, and manage firewall rules from the command line.
Remote Access
Section titled “Remote Access”SSH Connections
Section titled “SSH Connections”Use SSH to log in to remote servers, run commands, and create encrypted tunnels:
ssh username@remote_host # Log in to a remote serverssh -p port_number username@remote_host # Connect on a specific portssh username@remote_host command_to_run # Run a command remotelyssh -i /path/to/private_key username@remote_host # Authenticate with a private keyssh-copy-id username@remote_host # Copy public key for passwordless SSHSSH Port Forwarding
Section titled “SSH Port Forwarding”Forward ports when you need to reach services through an SSH connection:
ssh -L local_port:destination_host:destination_port username@remote_host # Local port forwardingssh -R remote_port:destination_host:destination_port username@remote_host # Reverse port forwardingFile Transfer
Section titled “File Transfer”Copying Files with SCP
Section titled “Copying Files with SCP”Use scp for simple encrypted file copies over SSH:
scp /path/to/local_file username@remote_host:/path/to/remote_dir # Local file to remotescp username@remote_host:/path/to/remote_file /path/to/local_dir # Remote file to localscp -r /path/to/local_dir username@remote_host:/path/to/remote_dir # Copy directory recursivelySyncing Files with Rsync
Section titled “Syncing Files with Rsync”Use rsync when you need efficient incremental transfers:
rsync -avz /path/to/local_dir username@remote_host:/path/to/remote_dir # Sync local to remotersync -avz username@remote_host:/path/to/remote_dir /path/to/local_dir # Sync remote to localrsync -avz --delete /path/to/source_dir username@remote_host:/path/to/destination_dir # Delete destination files missing from sourceConnectivity Checks
Section titled “Connectivity Checks”Basic Reachability
Section titled “Basic Reachability”Start with simple reachability checks before moving into deeper diagnostics:
ping remote_host # Check whether a host respondstraceroute remote_host # Trace the route packets take to a hostnc -zv remote_host port_number # Test whether a specific TCP port is reachablePort and Service Discovery
Section titled “Port and Service Discovery”Inspect listening services and open ports on local or remote systems:
nmap remote_host # Scan open ports on a remote hostnetstat -an # Show active connections and listening portsss -tuln # Show TCP/UDP listening socketsInterface and Routing
Section titled “Interface and Routing”Network Interfaces
Section titled “Network Interfaces”Display interface names, addresses, and link information:
ip addr # Show interfaces and IP addressesifconfig # Legacy interface display commandRouting and Hostnames
Section titled “Routing and Hostnames”Review routing decisions and update host identity:
ip route # View routing tableip route add destination_network via gateway_ip dev interface # Add a static routesudo hostnamectl set-hostname new_hostname # Change system hostnameDNS Troubleshooting
Section titled “DNS Troubleshooting”DNS Queries
Section titled “DNS Queries”Use DNS tools to verify records and troubleshoot name resolution:
nslookup domain_name # Query DNS for a domaindig domain_name # Perform a detailed DNS querydig domain_name A # Query A recordsdig domain_name MX # Query mail exchange recordsdig @dns_server domain_name # Query a specific DNS serverMonitoring and Diagnostics
Section titled “Monitoring and Diagnostics”Traffic Monitoring
Section titled “Traffic Monitoring”Capture packets or watch bandwidth usage on an interface:
tcpdump -i interface # Monitor traffic on an interfacetcpdump -i interface port 443 # Capture traffic for a specific portiftop -i interface # Show bandwidth usage by connectionFile and Process Diagnostics
Section titled “File and Process Diagnostics”Inspect files opened by a process or stop processes that are causing trouble:
lsof -p process_id # View open files used by a processpkill process_name # Kill a process by namekill -9 process_id # Force kill a process by PIDFirewall Management
Section titled “Firewall Management”UFW Commands
Section titled “UFW Commands”Use UFW to manage common Linux firewall rules:
sudo ufw enable # Enable UFWsudo ufw status # Check firewall statussudo ufw allow port_number # Allow traffic on a specific portsudo ufw allow 22/tcp # Allow SSH over TCPsudo ufw deny port_number # Deny traffic on a specific portWeb and Speed Tests
Section titled “Web and Speed Tests”Downloads and Internet Checks
Section titled “Downloads and Internet Checks”Use these commands to fetch files and check external connectivity:
speedtest-cli # Check internet speedwget file_url # Download a filecurl -O file_url # Download a file and keep the remote filenamecurl -I https://example.com # Fetch HTTP response headers