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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

firewall-offline-cmd Command Examples in Linux

by admin

firewall-offline-cmd is an offline command-line client of the firewalld daemon. It should be used only if the firewalld service is not running. A port can be added or removed via firewall-offline-cmd in case firewalld is not active.

firewall-offline-cmd Command Examples

1. For adding a port:

# firewall-offline-cmd --port=XXXX:tcp

2. For removing a port:

# firewall-offline-cmd --remove-port=XXXX/tcp

3. If a zone is not defined, the port will be added to the default zone. To add a port into a specific zone:

# firewall-offline-cmd --zone=[zone-name] --add-port=XXXX/tcp

4. To remove a port from a specific zone:

# firewall-offline-cmd --zone=[zone-name] --remove-port=XXXX/tcp

Since the port gets added in [zone-name].xml file, the port will remain added even after we enable or reload firewalld service.

5. To list all the ports under a particular zone:

# firewall-offline-cmd --zone=[zone-name] --list-all

6. To list all the ports under all the zones:

# firewall-offline-cmd --list-all
NOTE: Replace XXXX with the actual port numbers.

Refer to the man page for more information on firewall-offline-cmd.

$ man firewall-offline-cmd

Before running any of the above commands, make sure the firewalld service is offline. Changes in firewalld config using firewall-offline-cmd command should only be done when the firewalld service is offline.

# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. a2dissite Command Examples in Linux
  2. How to Create a Custom Log File Rotation by logrotate in Linux
  3. RedHat / CentOS : How to change currently active slave interface of bonding online
  4. rtcwake: command not found
  5. sbatch Command Examples in Linux
  6. gcalcli: Command-line tool to interact with Google Calendar
  7. netstat: command not found
  8. How to use command redirection under Linux
  9. chacl Command Examples in Linux
  10. How to get Fibre Channel HBA information from Linux SOSreport

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright