{"id":16022,"date":"2024-10-29T10:32:33","date_gmt":"2024-10-29T10:32:33","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=16022"},"modified":"2024-10-29T12:23:24","modified_gmt":"2024-10-29T12:23:24","password":"","slug":"how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/","title":{"rendered":"How to Set Up a Basic Firewall with Uncomplicated Firewall (UFW)"},"content":{"rendered":"\n<p>A firewall is a fundamental tool for securing your server, as it controls incoming and outgoing network traffic based on predetermined rules. For Linux servers, UFW (Uncomplicated Firewall) is a popular choice due to its simplicity and ease of use, even for those new to Linux system administration<\/p>\n\n\n\n<p>Originally developed for Ubuntu, UFW has since been adopted by other Debian-based systems and even some non-Debian-based distributions, thanks to its efficiency and straightforward command structure.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Supported Operating Systems<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Ubuntu<\/strong> (all LTS and newer versions)<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Debian<\/strong> (and many of its derivatives)<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Linux Mint<\/strong><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Kali Linux<\/strong><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Raspberry Pi OS<\/strong> (Raspbian)<\/li>\n<\/ul>\n\n\n\n<p>On <strong>Red Hat-based<\/strong> systems like <strong>CentOS<\/strong>, <strong>RHEL<\/strong>, and <strong>Fedora<\/strong>, UFW can be installed but is less common, as these distributions typically use <strong>firewalld<\/strong> as their primary firewall tool.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to Set Up UFW on Your Linux Server<\/h3>\n\n\n\n<p>In this article, we will use a server that has Ubuntu  22.04 installed<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Step 1: Update your server<\/strong><\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, start by updating apckages on your server. Use the command below to do that.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"140\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592.png\" alt=\"\" class=\"wp-image-16032\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592.png 1000w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592-300x42.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592-768x108.png 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Step 2: Install UFW<\/strong><\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run the command below to install<\/li>\n\n\n\n<li>This command will install UFW and any required dependencies.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install ufw<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"458\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-594-1024x458.png\" alt=\"\" class=\"wp-image-16039\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-594-1024x458.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-594-300x134.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-594-768x343.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-594.png 1168w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Step 2: Set Up Default Rules<\/strong><\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>These rules help determine the overall security level of your firewall. <\/li>\n\n\n\n<li>It\u2019s generally best practice to <strong>deny all incoming connections<\/strong> and <strong>allow all outgoing connections<\/strong> by default. This ensures that only the traffic you explicitly allow can access your server.<\/li>\n<\/ul>\n\n\n\n<p><strong>Deny Incoming Connections:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw default deny incoming<\/code><\/pre>\n\n\n\n<p><strong>Allow Outgoing Connections:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw default allow outgoing<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"202\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-595-1024x202.png\" alt=\"\" class=\"wp-image-16040\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-595-1024x202.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-595-300x59.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-595-768x151.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-595.png 1187w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>These default policies establish a secure baseline by only allowing connections to services you specify.<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Step 3: Allow Specific Ports and Services<\/strong><\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After setting up default rules, you\u2019ll need to allow connections to essential services.<\/li>\n<\/ul>\n\n\n\n<p><strong>Allow SSH (Port 22)<\/strong> \u2013 SSH allows remote access to your server, so allowing this port is critical if you want to maintain access.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow ssh<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"101\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-596.png\" alt=\"\" class=\"wp-image-16042\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-596.png 758w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-596-300x40.png 300w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/figure>\n\n\n\n<p>Alternatively, if SSH is running on a different port, replace <code>ssh<\/code> with the port number, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 2222<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"860\" height=\"96\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-597.png\" alt=\"\" class=\"wp-image-16043\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-597.png 860w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-597-300x33.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-597-768x86.png 768w\" sizes=\"auto, (max-width: 860px) 100vw, 860px\" \/><\/figure>\n\n\n\n<p>Allow HTTP and HTTPS \u2013 If your server hosts a website, you\u2019ll need to allow HTTP (port 80) and HTTPS (port 443) traffic.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow http\nsudo ufw allow https<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"151\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-598.png\" alt=\"\" class=\"wp-image-16044\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-598.png 942w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-598-300x48.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-598-768x123.png 768w\" sizes=\"auto, (max-width: 942px) 100vw, 942px\" \/><\/figure>\n\n\n\n<p><strong>Allow Other Services<\/strong> \u2013 You can specify any additional services by their port number or name. For example, to allow MySQL (port 3306) or other specific ports:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 3306<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Step 4: Enable UFW<\/strong><\/h5>\n\n\n\n<p>Once you\u2019ve defined your rules, enable UFW to activate the firewall. UFW will immediately apply the rules.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw enable<\/code><\/pre>\n\n\n\n<p>You\u2019ll be prompted to confirm your choice. Enabling UFW will enforce the rules you\u2019ve configured to secure your server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"102\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-599-1024x102.png\" alt=\"\" class=\"wp-image-16046\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-599-1024x102.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-599-300x30.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-599-768x76.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-599.png 1175w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Step 5: Verify UFW Status and Rules<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After enabling UFW, check its status to ensure your rules are correctly applied:<\/li>\n\n\n\n<li>This command provides a list of active rules, showing which ports and services are allowed or denied.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw status verbose<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1005\" height=\"320\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-600.png\" alt=\"\" class=\"wp-image-16048\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-600.png 1005w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-600-300x96.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-600-768x245.png 768w\" sizes=\"auto, (max-width: 1005px) 100vw, 1005px\" \/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Step 6: Configure IP-Based Restrictions (Optional)<\/strong><\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>UFW can allow or deny traffic based on specific IP addresses. This is useful for restricting access to certain services or adding extra security.<\/li>\n<\/ul>\n\n\n\n<p><strong>Allow Connections from a Specific IP<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow from 192.168.1.100<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"566\" height=\"108\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-601.png\" alt=\"\" class=\"wp-image-16050\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-601.png 566w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-601-300x57.png 300w\" sizes=\"auto, (max-width: 566px) 100vw, 566px\" \/><\/figure>\n\n\n\n<p><strong>Deny Connections from a Specific IP:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw deny from 192.168.1.100<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"815\" height=\"102\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-602.png\" alt=\"\" class=\"wp-image-16051\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-602.png 815w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-602-300x38.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-602-768x96.png 768w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/figure>\n\n\n\n<p><strong>Allow an IP Address on a Specific Port<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow from 192.168.1.100 to any port 22<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"885\" height=\"98\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-603.png\" alt=\"\" class=\"wp-image-16052\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-603.png 885w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-603-300x33.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-603-768x85.png 768w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/figure>\n\n\n\n<p>These rules provide more granular control, which can help limit access to critical services.<\/p>\n\n\n\n<p><strong>Step 7: Disable UFW (if necessary)<\/strong><\/p>\n\n\n\n<p>To turn off UFW, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw disable<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"743\" height=\"103\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-604.png\" alt=\"\" class=\"wp-image-16053\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-604.png 743w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-604-300x42.png 300w\" sizes=\"auto, (max-width: 743px) 100vw, 743px\" \/><\/figure>\n\n\n\n<p>This command disables the firewall, though you can re-enable it at any time using<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw enabl<span style=\"background-color: initial; color: inherit; font-family: inherit; font-size: inherit;\">e<\/span><\/code><\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Step 8: Remove or Modify Existing Rules<\/strong><\/h5>\n\n\n\n<p>To delete or modify an existing rule, first list rules by numbering them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw status numbered<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"309\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-605-1024x309.png\" alt=\"\" class=\"wp-image-16054\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-605-1024x309.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-605-300x90.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-605-768x232.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-605.png 1045w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To delete a specific rule, use its rule number:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw delete &lt;rule-number><\/code><\/pre>\n\n\n\n<p>In the image below, we delete rule number 6 using <strong><em>sudo ufw delete 6<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"874\" height=\"123\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-606.png\" alt=\"\" class=\"wp-image-16055\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-606.png 874w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-606-300x42.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-606-768x108.png 768w\" sizes=\"auto, (max-width: 874px) 100vw, 874px\" \/><\/figure>\n\n\n\n<p>This is useful when you need to make adjustments to your firewall configuration.<\/p>\n\n\n\n<p>Setting up a firewall is essential for securing a server, and UFW makes it easy to implement a basic firewall configuration on Linux. By following the steps outlined here, you can limit access to essential services, control connections from specific IPs, and maintain a secure server environment with minimal configuration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A firewall is a fundamental tool for securing your server, as it controls incoming and outgoing network traffic based on predetermined rules. For Linux servers, UFW (Uncomplicated Firewall) is a popular choice due to its simplicity and ease of use, even for those new to Linux system administration Originally developed for Ubuntu, UFW has since [&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-16022","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":698,"total_views":"0","reactions":{"happy":"24","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 Set Up a Basic Firewall with Uncomplicated Firewall (UFW) -<\/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-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up a Basic Firewall with Uncomplicated Firewall (UFW) -\" \/>\n<meta property=\"og:description\" content=\"A firewall is a fundamental tool for securing your server, as it controls incoming and outgoing network traffic based on predetermined rules. For Linux servers, UFW (Uncomplicated Firewall) is a popular choice due to its simplicity and ease of use, even for those new to Linux system administration Originally developed for Ubuntu, UFW has since [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-29T12:23:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592.png\" \/>\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=\"6 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-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/\",\"name\":\"How to Set Up a Basic Firewall with Uncomplicated Firewall (UFW) -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/image-592.png\",\"datePublished\":\"2024-10-29T10:32:33+00:00\",\"dateModified\":\"2024-10-29T12:23:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/#primaryimage\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/image-592.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/image-592.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Up a Basic Firewall with Uncomplicated Firewall (UFW)\"}]},{\"@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 Set Up a Basic Firewall with Uncomplicated Firewall (UFW) -","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-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up a Basic Firewall with Uncomplicated Firewall (UFW) -","og_description":"A firewall is a fundamental tool for securing your server, as it controls incoming and outgoing network traffic based on predetermined rules. For Linux servers, UFW (Uncomplicated Firewall) is a popular choice due to its simplicity and ease of use, even for those new to Linux system administration Originally developed for Ubuntu, UFW has since [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/","article_modified_time":"2024-10-29T12:23:24+00:00","og_image":[{"url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/","name":"How to Set Up a Basic Firewall with Uncomplicated Firewall (UFW) -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/#primaryimage"},"image":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/#primaryimage"},"thumbnailUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592.png","datePublished":"2024-10-29T10:32:33+00:00","dateModified":"2024-10-29T12:23:24+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/#primaryimage","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-592.png"},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Set Up a Basic Firewall with Uncomplicated Firewall (UFW)"}]},{"@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\/16022","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=16022"}],"version-history":[{"count":11,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16022\/revisions"}],"predecessor-version":[{"id":16056,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16022\/revisions\/16056"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=16022"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=16022"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=16022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}