From f859c5d8e55356f3c1cb3f99b4a431045dd3927a Mon Sep 17 00:00:00 2001 From: Fascinated Date: Tue, 27 Jun 2023 09:05:58 +0100 Subject: [PATCH] add networking and ufw to linux basics --- guides/linux-basics.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/guides/linux-basics.md b/guides/linux-basics.md index 4f72943..75d1190 100644 --- a/guides/linux-basics.md +++ b/guides/linux-basics.md @@ -57,3 +57,24 @@ This guide provides a brief introduction to Linux, including basic commands and - Extract a tar archive: `tar -xvf ` - Create a zip archive: `zip ` - Extract a zip archive: `unzip ` + +## Networking + +- Get all interface ips: `ip a` +- Ping a host: `ping ` +- Get the public IP: `curl ifconfig.me` +- Get the public IP (alternative): `curl ipinfo.io/ip` + +## Firewall (UFW) + +Make sure to allow SSH before enabling the firewall, otherwise you will be locked out of your server. `sudo ufw allow ssh` + +- Enable the firewall: `sudo ufw enable` +- Disable the firewall: `sudo ufw disable` +- List all rules: `sudo ufw status` +- List all rules (showing numbers): `sudo ufw status numbered` +- Delete a rule: `sudo ufw delete ` +- Allow a port: `sudo ufw allow ` +- Deny a port: `sudo ufw deny ` +- Allow a service: `sudo ufw allow ` +- Deny a service: `sudo ufw deny `