• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Allow HTTP and HTTPS Services in FirewallD

Written by Rahul, Updated on March 23, 2020

FirewallD is a firewall management solution for most of the Linux distributions. You can directly allow/deny ports using the service name with Firewalld. When used services name to allow/deny, it uses /etc/services file to find corresponding port of the service. This tutorial help you to open port for HTTP (80) and HTTPS (443) services via the firewall-cmd command line.

Allow HTTP/s in Firewalld

You can allow and deny incoming traffic based on predefined services in firewalld. You can find the complete list of services in /etc/services file.

Let’s allow HTTP and HTTPS service via the firewalld.

firewall-cmd --zone=public --add-service=http
firewall-cmd --zone=public --add-service=https

The above rules will be removed after system reboot. Use the --permanent option to add rules permanent in firewalld.

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https

Next, run the following command to apply the changes:

firewall-cmd --reload

Check Allowed Services

You can find the list of added services with the following command:

firewall-cmd --permanent --zone=public --list-services

You should see the results like:

cockpit dhcpv6-client http https ssh

Disable Services from Firewalld

If you want to remove/deny the above services from the firewalld, use the --remove-service option:

firewall-cmd --permanent --zone=public --remove-service=http
firewall-cmd --permanent --zone=public --remove-service=ftp

Next, run the following command to apply the changes:

firewall-cmd --reload

Conclusion

In this tutorial, you have learned to allow/deny services in firewalld via command line.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How To Install Python 3.9 on Ubuntu 18.04 0
  • How to Use AppImage on Linux (Beginner Guide) 2
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy