UFW vs. iptables
UFW provides a simpler interface for common host firewall tasks, while iptables exposes lower-level packet filtering controls. Use the format that matches the firewall already managed on your system.
Select common services and generate UFW, nftables, or iptables rules.
Choose a firewall type, select the services or custom ports you need, then generate rules you can review before applying. If you administer the server remotely, allow SSH before enabling a restrictive default policy.
UFW provides a simpler interface for common host firewall tasks, while iptables exposes lower-level packet filtering controls. Use the format that matches the firewall already managed on your system.
Confirm the management port, source network and protocol. Keep an existing administrative session open while testing a new ruleset so you can recover from an accidental lockout.
After applying changes, inspect active rules and test the intended service from an appropriate client rather than assuming a generated command was accepted.