• 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

Changing the IPset rules from IPtables to Firewalld in CentOS/RHEL 7

by admin

The Ask

ipset IPtables rule is needed on firewalld for the below rule:

-A INPUT -p tcp -m set --match-set SQL_1811 src -m set --match-set DB-IPs dst -m tcp --dport 1811 -j ACCEPT

The Answer

Below example using SQL_1811 and DB-IPs as IPsets for the two IP addresses (10.1.1.2 and 10.1.1.3)

# firewall-cmd --permanent --new-ipset=SQL_1811 --type=hash:ip
# firewall-cmd --permanent --new-ipset=DB-IPs --type=hash:ip
# firewall-cmd --reload
# firewall-cmd --ipset=SQL_1811 --add-entry=10.1.1.2
# firewall-cmd --ipset=DB-IPs --add-entry=10.1.1.3
# firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p tcp -m set --match-set SQL_1811 src -m set --match-set DB-IPs dst -m tcp --dport 1811 -j ACCEPT

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Adding static entry into system ARP cache (CentOS/RHEL)
  2. CentOS / RHEL 7 : How to set date, time / NTP and timezone using timedatectl
  3. SSH Login Stuck At : “debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP” CentOS/RHEL 7
  4. What is Anacron and usage of Anacron in Linux
  5. How to uninstall scons package from Ubuntu
  6. mpg123 Command Examples in Linux
  7. lvsd Command Examples in Linux
  8. How to add Swap Space on Linux Servers (CentOS/RHEL) On the Fly
  9. finch Command Examples in Linux
  10. How to Determine Which Process is Writing to Disk in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright