{"id":17803,"date":"2024-11-27T10:12:41","date_gmt":"2024-11-27T10:12:41","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=17803"},"modified":"2024-11-27T10:25:23","modified_gmt":"2024-11-27T10:25:23","password":"","slug":"how-to-configure-firewalld-for-enhanced-server-security","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/","title":{"rendered":"How to Configure Firewalld for Enhanced Server Security"},"content":{"rendered":"\n<p>Firewalld is a dynamic firewall management tool that provides a flexible way to manage and secure your Linux server. <\/p>\n\n\n\n<p>It uses zones to define the level of trust for incoming and outgoing traffic, allowing administrators to apply rules easily. Below is a comprehensive guide to configuring Firewalld for enhanced server security.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Basic Firewalld Commands<\/strong><\/h3>\n\n\n\n<p>Start by ensuring Firewalld is installed and running on your server. These commands help you control its state:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Start Firewalld for the current session:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl start firewalld<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Enable Firewalld to start on boot:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl enable firewalld<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Stop Firewalld for the current session:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl stop firewalld<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Disable Firewalld from starting on boot:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl disable firewalld<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Check if Firewalld is running:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl status firewalld<\/code><\/code><\/pre>\n\n\n\n<p>For a quick check of its state:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --state<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Runtime vs. Permanent Configuration<\/strong><\/h3>\n\n\n\n<p>Firewalld distinguishes between&nbsp;<strong>runtime<\/strong>&nbsp;changes, which are temporary, and&nbsp;<strong>permanent<\/strong>&nbsp;changes, which are saved to configuration files.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To save runtime changes to permanent configuration:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --runtime-to-permanent<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reload Firewalld to apply permanent rules:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --reload<\/code><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Firewalld Zones<\/strong><\/h3>\n\n\n\n<p>Firewalld uses zones to define the trust level for network connections. Each zone comes with predefined rules:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>View all available zones:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --get-zones<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check currently active zones:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --get-active-zones<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Change the current zone:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --change-zone=public<\/code><\/code><\/pre>\n\n\n\n<p>Zones like&nbsp;<code>public<\/code>,&nbsp;<code>trusted<\/code>, and&nbsp;<code>internal<\/code>&nbsp;allow you to apply security settings based on your network requirements.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Managing Services<\/strong><\/h3>\n\n\n\n<p>Firewalld simplifies port management by associating services with predefined rules.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>List all predefined services:bashCopy code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --get-services<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Whitelist a service for runtime:bashCopy code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --add-service=http<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Whitelist a service permanently:bashCopy code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --add-service=http --permanent<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Remove a service permanently:bashCopy code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --remove-service=dhcpv6-client --permanent<\/code><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Managing Ports<\/strong><\/h3>\n\n\n\n<p>For services that don\u2019t have predefined rules, you can manage individual ports:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open a port for runtime only:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --add-port=8065\/tcp<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open a port permanently:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --add-port=8065\/tcp --permanent<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Remove a port:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --remove-port=8065\/tcp --permanent<\/code><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Panic Mode<\/strong><\/h3>\n\n\n\n<p>Panic mode is a safeguard feature that blocks all traffic to and from the server:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Activate panic mode:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --panic-on<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check the status of panic mode:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --query-panic<\/code><\/code><\/pre>\n\n\n\n<p><em>Note: Enabling panic mode during a remote session (e.g., SSH) will disconnect you immediately.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Firewalld Files<\/strong><\/h3>\n\n\n\n<p>Firewalld stores its configurations in system files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>View system configuration files:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>ls \/etc\/firewalld<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>View default ICMP, service, and zone files:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>ls \/usr\/lib\/firewalld<\/code><\/code><\/pre>\n\n\n\n<p><em>Avoid editing default files directly, as updates may overwrite changes.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Firewall-Config GUI Application<\/strong><\/h3>\n\n\n\n<p>For desktop environments, Firewalld offers a GUI tool called&nbsp;<strong>firewall-config<\/strong>&nbsp;for easier zone and rule management. Install it with your package manager:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo yum install firewall-config  # On CentOS\/RHEL<\/code>\n<code>\nsudo apt install firewall-config  # On Debian\/Ubuntu\n<\/code><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p>Configuring Firewalld ensures your server is protected with tailored security rules. By leveraging zones, services, and port management, you can create a robust security framework for any network scenario. Regularly review and adjust your firewall rules to maintain optimal security.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Firewalld is a dynamic firewall management tool that provides a flexible way to manage and secure your Linux server. It uses zones to define the level of trust for incoming and outgoing traffic, allowing administrators to apply rules easily. Below is a comprehensive guide to configuring Firewalld for enhanced server security. Basic Firewalld Commands Start [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[1820,1824,1879,2128],"doc_tag":[],"class_list":["post-17803","docs","type-docs","status-publish","hentry","doc_category-cloud-servers-in-kenya","doc_category-dedicated-servers","doc_category-servers","doc_category-vps-servers"],"year_month":"2026-07","word_count":500,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Eugene","author_nicename":"eugene","author_url":"https:\/\/truehost.com\/support\/author\/eugene\/"},"doc_category_info":[{"term_name":"Cloud servers in Kenya","term_url":"https:\/\/truehost.com\/support\/docs-category\/cloud-servers-in-kenya\/"},{"term_name":"dedicated servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/dedicated-servers\/"},{"term_name":"Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/servers\/"},{"term_name":"VPS-Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/vps-servers\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Configure Firewalld for Enhanced Server Security -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Configure Firewalld for Enhanced Server Security -\" \/>\n<meta property=\"og:description\" content=\"Firewalld is a dynamic firewall management tool that provides a flexible way to manage and secure your Linux server. It uses zones to define the level of trust for incoming and outgoing traffic, allowing administrators to apply rules easily. Below is a comprehensive guide to configuring Firewalld for enhanced server security. Basic Firewalld Commands Start [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-27T10:25:23+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-firewalld-for-enhanced-server-security\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-firewalld-for-enhanced-server-security\\\/\",\"name\":\"How to Configure Firewalld for Enhanced Server Security -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"datePublished\":\"2024-11-27T10:12:41+00:00\",\"dateModified\":\"2024-11-27T10:25:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-firewalld-for-enhanced-server-security\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-firewalld-for-enhanced-server-security\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-firewalld-for-enhanced-server-security\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Configure Firewalld for Enhanced Server Security\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Configure Firewalld for Enhanced Server Security -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/","og_locale":"en_US","og_type":"article","og_title":"How to Configure Firewalld for Enhanced Server Security -","og_description":"Firewalld is a dynamic firewall management tool that provides a flexible way to manage and secure your Linux server. It uses zones to define the level of trust for incoming and outgoing traffic, allowing administrators to apply rules easily. Below is a comprehensive guide to configuring Firewalld for enhanced server security. Basic Firewalld Commands Start [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/","article_modified_time":"2024-11-27T10:25:23+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/","name":"How to Configure Firewalld for Enhanced Server Security -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"datePublished":"2024-11-27T10:12:41+00:00","dateModified":"2024-11-27T10:25:23+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-firewalld-for-enhanced-server-security\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Configure Firewalld for Enhanced Server Security"}]},{"@type":"WebSite","@id":"https:\/\/truehost.com\/support\/#website","url":"https:\/\/truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=17803"}],"version-history":[{"count":4,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17803\/revisions"}],"predecessor-version":[{"id":17813,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17803\/revisions\/17813"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=17803"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=17803"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=17803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}