This article will provide you with an information on how to open port in Redhat Linux, and more specifically we will be talking about the HTTP port 80. firewalld is the default firewall program that comes pre-installed on Red Hat Enterprise Linux 7 and 8. By default, the firewall is turned on, meaning that a very limited number of services are able to receive incoming traffic.
In order to allow incoming connections to RHEL version 7 and 8 after installing httpd web server, you will need to open up port 80 in the firewall. In this tutorial, you will see how to open port 80 with firewall-cmd.
In this tutorial you will learn:
- How to open http port 80 on RHEL 7 and 8
|Requirements, Conventions or Software Version Used
|Red Hat Enterprise Linux
|Privileged access to your Linux system as root or via the
|# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Open port 80 on RHEL
By default, the port 80 for http connection is filtered on Redhat 7 and 8 as you can only access this port from the actual localhost and not from any other public host. To open a port 80 on RHEL 7 and 8 Linux we need to add an iptables rule. For this RHEL uses firewall-cmd.
- First add your port 80 rule with the following linux command:
# firewall-cmd --zone=public --add-port=80/tcp --permanent
- Once you add the above firewall rule, reload the firewall service with this command:
# firewall-cmd --reload
- And check whether the port was added to iptables rule:
# iptables-save | grep 80 -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
- If you decide to block/remove http port 80 firewall rule you can again use the
# iptables-save | grep 80 -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT # firewall-cmd --zone=public --remove-port=80/tcp --permanent success # firewall-cmd --reload success # iptables-save | grep 80
And that’s all there is to it. As long as there are no other devices filtering traffic to your RHEL server, your website should be accessible on port 80 to any IP address on the internet.