firewalld:firewall-cmd

firewall-cmd

  • firewall-cmd –state: Return and print firewallld state
  • firewall-cmd –reload: Reload firewall and keep state information

General Options

  • –quiet: Do not print status messsages.
  • –permanent: 영구적으로 값 설정(재부팅). Set an option permanently. Usable for options marked with [P].

Zone Options

  • –get-default-zone: Print default zone for connections and interfaces
  • –set-default-zone=<zone> Set default zone
  • –get-active-zones: Print currently active zones
  • –get-zones: Print predefined zones [P]
  • –get-services: Print predefined services [P]
  • –get-icmptypes: Print predefined icmptypes [P]
  • –get-zone-of-interface=<interface>: Print name of the zone the interface is bound to [P]
  • –get-zone-of-source=<source>[/<mask>]|<MAC>|ipset:<ipset>: Print name of the zone the source is bound to [P]
  • –list-all-zones: List everything added for or enabled in all zones [P]
  • –new-zone=<zone>: Add a new zone [P only]
  • –new-zone-from-file=<filename> [–name=<zone>]: Add a new zone from file with optional name [P only]
  • –delete-zone=<zone>: Delete an existing zone [P only]
  • –load-zone-defaults=<zone>: Load zone default settings [P only]
  • –zone=<zone>: Use this zone to set or query options, else default zone. Usable for options marked with [Z]
  • –info-zone=<zone>: Print information about a zone
  • –path-zone=<zone>: Print file path of a zone [P only]
  • –add-masquerade: Masquerade 활성화
  • –add-forward-port=port=80:proto=tcp:toprot=8080:toaddr=192.168.1.100: IP 포트포워딩
  • –add-interface=INTERFACE 특정 인터페이스에 대해 ZONE 적용.
  • –info-service=SERVICE_NAME: 특정 서비스 정보 확인

help

sudo firewall-cmd --permanent --new-service=BOT
sudo firewall-cmd --permanent --service=BOT --set-description="bot"
sudo firewall-cmd --permanent --service=BOT --set-short="bot"
sudo firewall-cmd --permanent --service=BOT --add-port=1234/tcp
sudo firewall-cmd --permanent --service=BOT --add-port=1235/tcp
 
firewall-cmd --permanent --zone=public --add-interface=eth0
 
# 2. 특정 CIDR 범위에 대해서만 9090 포트 허용
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port protocol="tcp" port="9090" accept'
  • firewalld/firewall-cmd.txt
  • 마지막으로 수정됨: 2026/03/30 04:16
  • 저자 writer