Ubuntu/Apt
Network Commands
Configure networking and firewall rules on Ubuntu. Manage interfaces with Netplan, control access with UFW, troubleshoot connectivity, and configure DNS.
10 commands
Pro Tips
Use 'ufw allow 22/tcp' then 'ufw enable' — always allow SSH before enabling the firewall!
Use 'ss -tlnp' to see all listening ports and which processes own them — replaces 'netstat'.
Apply Netplan changes with 'sudo netplan try' — auto-reverts in 120 seconds if you lose connectivity.
Common Mistakes
Enabling UFW without allowing SSH first will lock you out of a remote server. Always 'ufw allow ssh' first.
Netplan config errors can break networking. Use 'netplan try' instead of 'netplan apply' on remote servers.