Adjust Firewall

Firewall Settings

RHEL 6

RHEL 6 uses iptables by default to configure its firewall settings. These can be updated using the /etc/sysconfig/iptables file, or, if you have X Server running, there is also a GUI for editing the firewall that can be run using the command:

system-config-firewall

RHEL 7

RHEL 7 continues to use iptables under the hood, but the preferred way to interact with iptables was updated to using the firewall-cmd command or firewall-config GUI. For example, the following commands will open up port 8082 publicly:

firewall-cmd --zone=public --add-port=8082/tcp --permanent
firewall-cmd --reload

Debian 9.x

Debian Stretch uses iptables by default to configure its firewall settings. These can be updated using the /etc/sysconfig/iptables file, or you can use the iptables command:

sudo iptables -A INPUT -p tcp --dport 8181 -j ACCEPT
sudo iptables-save

Ubuntu 16

Ubuntu 16 comes with a ufw (Uncomplicated FireWall) command, which controls the firewall, for example:

sudo ufw allow 8181