• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Use iptables instead of firewalld on CentOS/RHEL 7 and 8

by admin

Starting CentOS/RHEL 7, iptables is replaced with firewalld. In some cases, you may want to use old good iptables instead of firewalld on your CentOS/RHEL 7 or 8 system. This post outlines the steps required to carry out the conversion.

1. Install iptables services package:

# /usr/bin/yum install iptables-services

2. Stop firewalld service:

# /usr/bin/systemctl stop firewalld

3. Mask firewalld service (Masking will make it impossible to start firewalld service):

# /usr/bin/systemctl mask firewalld

4. Start iptables service:

# /usr/bin/systemctl start iptables

5. Check the status of iptable service:

# /usr/bin/systemctl status iptables
● iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: active (exited) since Fri 2019-12-13 14:39:38 IST; 1min 49s ago
...

6. Enable the iptables to start on boot:

# /usr/bin/systemctl enable iptables

7. List your iptables rules:

# /usr/sbin/iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
...

Filed Under: CentOS/RHEL, CentOS/RHEL 7, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. “error: Bind to port 2222 on 0.0.0.0 failed: Permission denied” – error while starting sshd service on CentOS/RHEL
  2. nordvpn Command Examples in Linux
  3. How to Stop “sudo” from Sending Emails on Failures in CentOS/RHEL
  4. pvcreate Fails With Error: “Device /dev/mapper/mpatha Not Found (or Ignored By Filtering).”
  5. Working with Vim editor (Text Editor)
  6. fdisk: command not found
  7. Configuring sudo to Enable Commands for Non-Root Users in Linux
  8. dirb: command not found
  9. How to take mailbox backup of Zimbra Account from CLI
  10. Understanding Linux SCSI Reservation

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright