• 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 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. How to interpret Linux martian source messages
  2. fprintd-delete Command Examples in Linux
  3. What are SELinux Modes and how to set them
  4. How to Schedule Jobs with ‘at’ command under Linux
  5. pvcreate Command Examples in Linux
  6. Understanding Device Persistence and Oracle ASMLib
  7. RHEL 7 – RHCSA Notes : Change passwords and adjust password aging for local user accounts
  8. deborphan Command Examples in Linux
  9. CentOS / RHEL 6 : How to limit memory resources for a specific user using cgroups
  10. chage Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright