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

The Geek Diary

CONCEPTS | BASICS | HOWTO

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

How to Migrate CentOS/RHEL 6 iptables Rules to CentOS/RHEL 7 firewalld

By admin

Below we demonstrate three common methods for transforming the iptables rules into the firewalld controls. Our example shows the transformation of one iptables rule output by the iptables-save command:

LOG_TEST_NEW - [0:0]
-A LOG_TEST_NEW -m limit --limit 2/min -j LOG --log-prefix "New Connection"

The example rule logs up to two log entries per minute. The log entry is labeled with the string “New Connection.”

Using The firewalld GUI (Applications -> Sundry -> Firewall)

1. Create a Rule Chain

2. Put the Rule and bind it to the Rule Chain

Using The firewall-cmd Command Line

# firewall-cmd --direct --add-chain ipv4 filter LOG_TEST_NEW
# firewall-cmd --direct --add-rule ipv4 filter LOG_TEST_NEW 0 -m limit --limit 2/min -j LOG --log-prefix 'New Connection' --log-level 4
success

Editing The /etc/firewalld/direct.xml Ruleset

# cat /etc/firewalld/direct.xml
<?xml version="1.0" encoding="utf-8"?>
<direct>
  <chain table="filter" ipv="ipv4" chain="LOG_NEW" />
  <rule priority="0" table="filter" ipv="ipv4" chain="LOG_NEW"> -m limit --limit 2/min -j LOG --log-prefix 'New Connection' --log-level 4 </rule>
</direct>

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

Some more articles you might also be interested in …

  1. crontab error : “You (user) are not allowed to access to (crontab) because of pam configuration.”
  2. CentOS / RHEL : How to collect sosreport
  3. CentOS / RHEL 6,7 : How to increase system log message verbosity (rsyslogd)
  4. Understanding Basic File Permissions and ownership in Linux
  5. CentOS/RHEL – How to Remove stale ISCSI Target Node Information from ISCSI Initiator Server
  6. CentOS / RHEL 7 : Lock User Account After N Number of Incorrect Login Attempts
  7. Unable to login with GUI on CentOS/RHEL 7
  8. How to use rndc command (command-line administration tool for named)
  9. Beginners Guide to Udev in Linux
  10. Understanding chroot Jail

You May Also Like

Primary Sidebar

Recent Posts

  • What are Command Rules in oracle Database
  • Using Rule Sets in Oracle Database Vault
  • How Realms Work in Oracle Database Vault
  • How to use Privilege Analysis in Oracle Database
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary