{"id":1859,"date":"2023-09-22T07:45:52","date_gmt":"2023-09-22T07:45:52","guid":{"rendered":"https:\/\/www.dedicatedcore.com\/blog\/?p=1859"},"modified":"2025-05-29T11:45:54","modified_gmt":"2025-05-29T11:45:54","slug":"enable-disable-ufw-firewall-ubuntu","status":"publish","type":"post","link":"https:\/\/www.dedicatedcore.com\/blog\/enable-disable-ufw-firewall-ubuntu\/","title":{"rendered":"How to Enable\/Disable UFW Firewall on Ubuntu 22.04"},"content":{"rendered":"<p data-block-id=\"9e2e07d6-02d9-4377-a1d2-76d9036af39b\" data-pm-slice=\"1 1 []\">For controlling firewall settings on Ubuntu, the Uncomplicated Firewall (UFW) is an easy-to-use program. It provides a simple method of turning on or off firewall security. Toggling UFW on or off is crucial. Whether your goal is to improve security or troubleshoot network connectivity problems. To boost your website&#8217;s performance with the best VPS in India, a <a href=\"https:\/\/www.dedicatedcore.com\/vps-hosting-india\/\" target=\"_blank\" rel=\"noopener\">secure hosting option<\/a> is ideal.<\/p>\n<p data-block-id=\"95eb0ccd-bf58-4f76-a53e-85bda4f539fb\">Here we will understand how to set or disable Ubuntu&#8217;s UFW firewall in this guide. Allow you to ensure that your system&#8217;s network security meets your needs and preferences. Ubuntu ships with a built-in firewall configuration utility known as UFW, short for Uncomplicated Firewall. UFW simplifies server firewall management. It provides an easy-to-use interface for users to manage firewall settings. To maximize your <a href=\"https:\/\/www.dedicatedcore.com\/london-forex-vps-uk\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">trading efficiency<\/a> in the UK, explore London&#8217;s Forex VPS server with lightning speed.<\/p>\n<p><strong>Requirements<\/strong><\/p>\n<ul>\n<li>An Ubuntu 18.04, 20.04, or 22.04 computer<\/li>\n<li>Terminal window or command line<\/li>\n<li>User with sudo or root access<\/li>\n<\/ul>\n<h3>Verify the Status of the Ubuntu Firewall<\/h3>\n<p>If you are in search of a <a href=\"https:\/\/www.dedicatedcore.com\/blog\/install-wireshark-ubuntu\/\" target=\"_blank\" rel=\"noopener\">packet sniffer and analysis tool<\/a>, Wireshark will help you with it.\u00a0 It is a good idea to check the UFW firewall&#8217;s status before disabling it. The firewall is turned off by default in Ubuntu. How is the status of your firewall determined?<\/p>\n<p>Use the following command to see the firewall&#8217;s current status in your command terminal:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw status<\/pre>\n<p>The result in the example below indicates that the firewall is in use.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1861\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-ufw-status-command.png\" alt=\"checking ubuntu firewall status\" width=\"800\" height=\"129\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-ufw-status-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-ufw-status-command-300x48.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-ufw-status-command-150x24.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-ufw-status-command-768x124.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-ufw-status-command-100x16.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-ufw-status-command-700x113.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>We can now disengage the UFW firewall as we have ascertained the existing situation.<\/p>\n<h4>Turn off the Ubuntu Firewall<\/h4>\n<p>An essential component of server and network security is a firewall. However, you may need to stop or shut down the firewall while testing or debugging.<\/p>\n<p>Enter to turn off Ubuntu&#8217;s firewall:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw disable<\/pre>\n<p>You are notified by the terminal that the service is no longer available.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1863\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-disable-command.png\" alt=\"disable ubuntu firewall\" width=\"800\" height=\"129\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-disable-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-disable-command-300x48.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-disable-command-150x24.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-disable-command-768x124.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-disable-command-100x16.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-disable-command-700x113.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Remember that your firewall rules remain in effect even if you disable the firewall. The same rules that were configured before the deactivation will take effect when you enable the firewall again.<\/p>\n<h4>Turn On the Firewall.<\/h4>\n<p>It&#8217;s essential to learn how to turn on Ubuntu&#8217;s firewall.<\/p>\n<p>Use the following command to enable the firewall on Ubuntu:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw enable<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1864\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-enable-command.png\" alt=\"enable firewall\" width=\"800\" height=\"129\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-enable-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-enable-command-300x48.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-enable-command-150x24.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-enable-command-768x124.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-enable-command-100x16.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-enable-command-700x113.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Similar to the result from the &#8220;disable&#8221; command, it verifies that the firewall is operational once more.<\/p>\n<h4>Establishing Firewall Rules with UFW<\/h4>\n<p>Through its command-line interface, UFW does not offer full firewall capability. It does, however, provide a straightforward method for adding or removing basic rules. Launching an SSH port is a prime illustration.<\/p>\n<p>As an illustration:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw allow 22<\/pre>\n<p>Use the &#8216;status&#8217; command to see the firewall&#8217;s current state after the terminal indicates that the rule is now operational:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw status<\/pre>\n<p>The fact that an SSH port is now open will be reflected in the output.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1865\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-status-command.png\" alt=\"check status of firewall with status command\" width=\"800\" height=\"230\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-status-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-status-command-300x86.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-status-command-150x43.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-status-command-768x221.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-status-command-100x29.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-status-command-700x201.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<h4>UFW Firewall Rule Reset<\/h4>\n<p>Use the reset command to return all rules to their initial configurations if necessary:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw reset<\/pre>\n<p>The firewall settings return to their initial defaults once you confirm the operation by typing y.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1866\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-reset.png\" alt=\"reseting ufw firewall rules\" width=\"800\" height=\"249\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-reset.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-reset-300x93.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-reset-150x47.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-reset-768x239.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-reset-100x31.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-ufw-reset-700x218.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<h4>Final Words on Enabling\/Disabling UFW Firewall on Ubuntu<\/h4>\n<p>Learning how to turn on and off Ubuntu&#8217;s UFW firewall gives you the ability to manage the network security of your machine. Whether you&#8217;re protecting your server from outside threats or resolving connectivity problems, being able to quickly switch between UFWs makes sure your Ubuntu system is safe and operational.<\/p>\n<p>You are now aware of the UFW tool&#8217;s possibilities. These commands offer a great starting point for investigating firewall settings and functions. You have given yourself a useful skill set for efficiently controlling firewall settings, which will improve the security and dependability of your Ubuntu system. These procedures are described in this guide.<\/p>\n<h3>Frequently Asked Questions (FAQ)<\/h3>\n<p><strong>1. Why does disabling UFW not restore network connectivity at that very moment?<\/strong><\/p>\n<p>If iptables rules remain outside UFW control upon disabling it, network connectivity will not return. Alternatively, if another firewall (for example, a provider&#8217;s security group) remains active, the network will be disconnected, by way of example. Residual configurations, either from culprit rule sets or cached cleanups, can get in the way and have to be purged with an iptables reset, together with a double-check on the external network policies for a quick victory in the restoration of connectivity.<\/p>\n<p><strong>2. How can I check the status of UFW on Ubuntu 22.04?<\/strong><\/p>\n<p>To check the status that UFW is active or not, you need to use the command given below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw status<\/pre>\n<p>Using the above command will help you get the status of UFW on Ubuntu.<\/p>\n<p><strong>3. How to Disable UFW Firewall on Ubuntu?<\/strong><\/p>\n<p>To disable UFW, run:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw disable  \r\n<\/pre>\n<p>This stops the firewall but retains existing rules for future reactivation.<\/p>\n<p><strong>4. How to Reset UFW to Default Settings?<\/strong><\/p>\n<p>If you need to reset all rules, run:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ufw reset  \r\n<\/pre>\n<p>This removes all custom rules and disables UFW, allowing a fresh configuration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For controlling firewall settings on Ubuntu, the Uncomplicated Firewall (UFW) is an easy-to-use program. It provides a simple method of turning on or off firewall&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1875,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/1859"}],"collection":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/comments?post=1859"}],"version-history":[{"count":15,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/1859\/revisions"}],"predecessor-version":[{"id":2807,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/1859\/revisions\/2807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media\/1875"}],"wp:attachment":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media?parent=1859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/categories?post=1859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/tags?post=1859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}