• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Saturday, May 24, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How to Start/Stop and Enable/Disable FirewallD and Iptables Firewall in Linux

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
40
VIEWS
Share on FacebookShare on Twitter

Contents

  1. What is FirewallD
  2. What is Iptables
  3. How to Start/Stop and Enable/Disable FirewallD Service
    1. Start FirewallD Service
    2. Stop FirewallD Service
    3. Check the Status of FirewallD
    4. Check the State of FirewallD
    5. Disable FirewallD Service
    6. Enable FirewallD Service
    7. Mask FirewallD Service
    8. Unmask FirewallD Service
  4. How to Start/Stop and Enable/Disable IPtables Service
    1. Start Iptables Service
    2. Stop Iptables Service
    3. Disable Iptables Service
    4. Enable Iptables Service
    5. Check Status of Iptables Service
    6. Enable Ufw Iptables Firewall
    7. Disable Ufw Iptables Firewall
    8. Check Status of Ufw Iptables Firewall
  5. Conclusion

Firewall is a software that acts as a shield between user’s system and external network allowing some packets to pass while discarding other’s. Firewall commonly operates on network layer i.e. on IP packets both Ipv4 and Ipv6.

Whether a packet will pass or will be bocked, depends on the rules against such type of packets in the firewall. These rules can be built-in or user-defined ones. Each packet which enters the network has to pass through this shield which verifies it against rules defined in it for such type of packets.

Each rule has a target action which is to be applied in case the packet fails to satisfy it. On Linux systems, firewall as a service is provided by many softwares, most common which are: firewalld and iptables.

In Linux there are many different types of firewalls used, but most standard ones are Iptables and Firewalld, which is going to discuss in this article.

What is FirewallD

FirewallD is the Dynamic Firewall Manager of Linux systems. This service is used to configure the network connections, thus deciding which external network or internal packets to allow traversing the network and which to block.

It allows two types of configurations, permanent and runtime. Runtime configurations will get lost ones the service is restarted while the permanent ones get retained across the system boot so that they are followed every time the service gets active.

Corresponding to these configurations, firewallD has two directories, default/fallback one (/usr/lib/firewall) which is lost ones system is updated and the system configuration (/etc/firewall) which remains permanent and overrides the default one if given. This is found as a default service in RHEL/CentOS 7 and Fedora 18.

What is Iptables

Iptables is another service which decides to allow, drop or return IP packets. Iptables service manages Ipv4 packets while Ip6tables manages Ipv6 packets. This service manages a list of tables where each table is maintained for different purpose like: ‘filter‘ table is for firewall rules, ‘nat‘ table is consulted in case of new connection, ‘mangle‘ in case of packet alterations and so on.

Each table further has chains which can be built-in or user-defined where a chain signifies a set of rules which are applies to a packet, thus deciding what the target action for that packet should be i.e. it must be ALLOWED, BLOCKED or RETURNED. This service is a default service on systems like: RHEL/CentOS 6/5 and Fedora, ArchLinux, Ubuntu etc.

To learn more about firewalls, follow the following links:

  1. Understanding IPtables Firewall Basics and Tips
  2. Configure Iptables Firewall in Linux
  3. Configure FirewallD in Linux
  4. Useful FirewallD Rules to Manage Firewall in Linux
  5. How to Control Network Traffic Using FirewallD and Iptables

In this article we will explain how to start, stop or restart Iptables and FirewallD services in Linux.

How to Start/Stop and Enable/Disable FirewallD Service

If you’re using CentOS/RHEL 7 or Fedora 18+ versions, you should follow below instructions to manage FirewallD service.

Start FirewallD Service
# systemctl start firewalld 
Stop FirewallD Service
# systemctl stop firewalld
Check the Status of FirewallD
# systemctl status firewalld
Check the State of FirewallD
# firewall-cmd --state

As an alternative, you can disable the firewalld service so that it doesn’t apply rules to packets and enable ones needed again.

Disable FirewallD Service
# systemctl disable firewalld
Enable FirewallD Service
# systemctl enable firewalld
Mask FirewallD Service
# systemctl mask firewalld

Also, you can mask the firewall service which creates a symbolic link of the firewall.service to /dev/null, thus disabling the service.

Unmask FirewallD Service
# systemctl unmask firewalld

This is reverse of masking the service. This removes the symlink of the service created during masking, thus re-enabling the service.

How to Start/Stop and Enable/Disable IPtables Service

On RHEL/CentOS 6/5/4 and Fedora 12-18 iptables firewall comes as pre and later, the iptables service can be installed via:

# yum install iptables-services

Then, the service can be started, stopped or restarted via following commands:

Start Iptables Service
# systemctl start iptables
OR
# service iptables start
Stop Iptables Service
# systemctl stop iptables
OR
# service iptables stop
Disable Iptables Service
# systemctl disable iptables
Or
# service iptables save
# service iptables stop
Enable Iptables Service
# systemctl enable iptables
Or
# service iptables start
Check Status of Iptables Service
# systemctl status iptables
OR
# service iptables status

On Ubuntu and some other Linux distributions however, ufw is the command which is used to manage the iptables firewall service. Ufw provides an easy interface for the user to handle the iptables firewall service.

Enable Ufw Iptables Firewall
$ sudo ufw enable
Disable Ufw Iptables Firewall
$ sudo ufw disable
Check Status of Ufw Iptables Firewall
# sudo ufw status 

However, if you want to list chains in iptables which contains all the rules following command can help you achieve the same:

# iptables -L -n -v

Conclusion

These are the techniques which can help you start, stop, disable and enable the packet management services in Linux Based Systems. Different Linux distros can have different services as default, like: Ubuntu can have iptables as the default and pre-installed service, while CentOS can have firewalld as the default configured service for managing incoming and outgoing of IP packets.

Presented in this article are the most common tricks to manage these services on almost all Linux Distros, however, if you find something and would like to add on to this article, your comments are always welcome.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

Pscp – Transfer/Copy Files to Multiple Linux Servers Using Single Shell

Next Post

SSL Certificates with Apache 2 on Ubuntu 10.04 (Lucid)

Next Post

SSL Certificates with Apache 2 on Ubuntu 10.04 (Lucid)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet