Fading Coder

One Final Commit for the Last Sprint

Home > Notes > Content

Firewall Rule Management Across CentOS and Ubuntu Environments

Notes May 10 3

Network traffic filtering on RHEL-based distributions is handled by firewalld, which organizes rules into zones and requires explicit synchronization between permanent and runtime configurations.

Verify the daemon's current state:

systemctl is-active firewalld

Initialize the service and configure it to launch automatically during system boot:

sudo systemctl enable --now firewalld

To expose a web application, assign the required TCP ports to the default zone and commit the changes. The configuration must be reloaded to activate persistent rules:

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --reload

Confirm the active zone settings:

sudo firewall-cmd --list-all

Debian-based platforms typically rely on ufw as a frontend for netfilter. Unlike firewalld, rule modifications are applied immediately to the kernel packet filter.

Inspect the current filter status and logging level:

sudo ufw status verbose

Activate the firewall framework:

sudo ufw enable

Establish a secure baseline by rejecting unsolicited inbound connections while permitting all outbound requests:

sudo ufw default deny incoming
sudo ufw default allow outgoing

Permit remote administration by explicitly allowing TCP traffic on the standard SSH port:

sudo ufw allow proto tcp to any port 22

Validate the updated rule chain:

sudo ufw status numbered

Related Articles

Designing Alertmanager Templates for Prometheus Notifications

How to craft Alertmanager templates to format alert messages, improving clarity and presentation. Alertmanager uses Go’s text/template engine with additional helper functions. Alerting rules referenc...

Deploying a Maven Web Application to Tomcat 9 Using the Tomcat Manager

Tomcat 9 does not provide a dedicated Maven plugin. The Tomcat Manager interface, however, is backward-compatible, so the Tomcat 7 Maven Plugin can be used to deploy to Tomcat 9. This guide shows two...

Skipping Errors in MySQL Asynchronous Replication

When a replica halts because the SQL thread encounters an error, you can resume replication by skipping the problematic event(s). Two common approaches are available. Methods to Skip Errors 1) Skip a...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.