<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.brandon-rodriguez.com/index.php?action=history&amp;feed=atom&amp;title=Linux%2FUncomplicated_Firewall</id>
	<title>Linux/Uncomplicated Firewall - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.brandon-rodriguez.com/index.php?action=history&amp;feed=atom&amp;title=Linux%2FUncomplicated_Firewall"/>
	<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;action=history"/>
	<updated>2026-05-07T12:57:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=259&amp;oldid=prev</id>
		<title>Brodriguez: Brodriguez moved page Linux Uncomplicated Firewall to Linux/Uncomplicated Firewall: Clean url with subpages</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=259&amp;oldid=prev"/>
		<updated>2020-05-15T08:53:53Z</updated>

		<summary type="html">&lt;p&gt;Brodriguez moved page &lt;a href=&quot;/Linux_Uncomplicated_Firewall&quot; class=&quot;mw-redirect&quot; title=&quot;Linux Uncomplicated Firewall&quot;&gt;Linux Uncomplicated Firewall&lt;/a&gt; to &lt;a href=&quot;/Linux/Uncomplicated_Firewall&quot; title=&quot;Linux/Uncomplicated Firewall&quot;&gt;Linux/Uncomplicated Firewall&lt;/a&gt;: Clean url with subpages&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 08:53, 15 May 2020&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key dev_wiki:diff::1.12:old-82:rev-259 --&gt;
&lt;/table&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=82&amp;oldid=prev</id>
		<title>Brodriguez: Add local network example</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=82&amp;oldid=prev"/>
		<updated>2019-11-06T05:01:48Z</updated>

		<summary type="html">&lt;p&gt;Add local network example&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 05:01, 6 November 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l89&quot;&gt;Line 89:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 89:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;sudo ufw allow from &amp;lt;ip_address&amp;gt; to any port &amp;lt;port&amp;gt; proto &amp;lt;protocol&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;sudo ufw allow from &amp;lt;ip_address&amp;gt; to any port &amp;lt;port&amp;gt; proto &amp;lt;protocol&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This will only allow the given protocol from the given ip to the given port.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This will only allow the given protocol from the given ip to the given port.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;For example, to allow ssh only on the local network, run:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;code&gt;sudo ufw allow from 192.168.1.0/24 to any port 22&amp;lt;/code&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key dev_wiki:diff::1.12:old-73:rev-82 --&gt;
&lt;/table&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=73&amp;oldid=prev</id>
		<title>Brodriguez: Add advanced rules</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=73&amp;oldid=prev"/>
		<updated>2019-10-13T01:31:28Z</updated>

		<summary type="html">&lt;p&gt;Add advanced rules&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:31, 13 October 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l81&quot;&gt;Line 81:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 81:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 3306/tcp&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 3306/tcp&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;PostgreSQL&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 5432/tcp&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;PostgreSQL&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 5432/tcp&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Advanced Rules ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;It&#039;s possible to only allow/deny from specific ip addresses. Some examples:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &amp;lt;code&gt;sudo ufw allow from &amp;lt;ip_address&gt; to any port &amp;lt;port&gt;&amp;lt;/code&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;** This will only allow the given ip to the given port.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &amp;lt;code&gt;sudo ufw allow from &amp;lt;ip_address&gt; to any port &amp;lt;port&gt; proto &amp;lt;protocol&gt;&amp;lt;/code&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;** This will only allow the given protocol from the given ip to the given port.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key dev_wiki:diff::1.12:old-68:rev-73 --&gt;
&lt;/table&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=68&amp;oldid=prev</id>
		<title>Brodriguez: Create page</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Linux/Uncomplicated_Firewall&amp;diff=68&amp;oldid=prev"/>
		<updated>2019-10-08T07:03:18Z</updated>

		<summary type="html">&lt;p&gt;Create page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Uncomplicated Firewall&amp;#039;&amp;#039;&amp;#039;, or UFW, is a simple firewall manager for Arch Linux, Debian, and Ubuntu based systems.&lt;br /&gt;
&lt;br /&gt;
== Install UFW ==&lt;br /&gt;
For Arch Linux, Debian, and Ubuntu systems, UFW is likely installed by default. If it&amp;#039;s not, then install with the following commands:&lt;br /&gt;
* Arch Linux: &amp;lt;code&amp;gt;sudo pacman -S ufw&amp;lt;/code&amp;gt;&lt;br /&gt;
* Ubuntu/Debian: &amp;lt;code&amp;gt;sudo apt install ufw&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on the system, you may also have to run:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo systemctl start ufw&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo systemctl enable ufw&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setting Firewall Rules ==&lt;br /&gt;
&lt;br /&gt;
=== General Command Syntax ===&lt;br /&gt;
Generally speaking, ufw rules will follow one of two formats:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw allow &amp;lt;port&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The &amp;#039;&amp;#039;&amp;#039;allow&amp;#039;&amp;#039;&amp;#039; rule sets the provided port to be open to the outside world, for both incoming and outgoing messages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw deny &amp;lt;port&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The &amp;#039;&amp;#039;&amp;#039;deny&amp;#039;&amp;#039;&amp;#039; rule sets the provided port to be closed to the outside world, for both incoming and outgoing messages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
In either case, the &amp;lt;port&amp;gt; argument can be define in one of the following ways:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;port_number&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** This allows all connection types at the provided port number.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;port_number&amp;gt;/tcp&amp;lt;/code&amp;gt;&lt;br /&gt;
** This allows only tcp connections at the provided port number.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;port_number&amp;gt;/udp&amp;lt;/code&amp;gt;&lt;br /&gt;
** This allows only udp connections at the provided port number.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Removing Rules ===&lt;br /&gt;
If you accidentally add a wrong rule, or simply want to remove an existing rule, use the command:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw delete &amp;lt;rule&amp;gt;&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;&amp;lt;rule&amp;gt;&amp;lt;/code&amp;gt; follows the same &amp;lt;code&amp;gt;&amp;lt;allow/deny&amp;gt; &amp;lt;port&amp;gt;&amp;lt;/code&amp;gt; syntax defined above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Specifying General Rules ===&lt;br /&gt;
UFW also allows specifying general rules. These are the rules applied for any ports not explicitly defined by the above commands.&amp;lt;br&amp;gt;&lt;br /&gt;
These general commands are as simple as:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw default &amp;lt;allow|deny&amp;gt; &amp;lt;incoming|outgoing&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** Ex: &amp;lt;code&amp;gt;sudo ufw default allow outgoing&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Recommended Rules ==&lt;br /&gt;
Before setting any rules, it&amp;#039;s strongly recommended to allow ssh.&amp;lt;br&amp;gt;&lt;br /&gt;
If using a default ssh setup, then you can use the command:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw allow ssh&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;sudo ufw allow 22/tcp&amp;lt;/code&amp;gt;&lt;br /&gt;
If using a non-standard setup, then allow whatever given port is associated with your ssh connection.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Next, it&amp;#039;s recommended to set defaults for both incoming and outgoing. These might be set by default, depending on your system, but it&amp;#039;s always a good idea to double check.&amp;lt;br&amp;gt;&lt;br /&gt;
For most setups, defaults of &amp;quot;allow all outgoing&amp;quot; and &amp;quot;deny all incoming&amp;quot; are good:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw default allow outgoing&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw default deny incoming&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
At this point, you&amp;#039;d want to set individual rules for whatever your given setup needs.&amp;lt;br&amp;gt;&lt;br /&gt;
For security reasons, it&amp;#039;s best to only open those ports that you need, and keep the rest closed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Enabling UFW and Viewing Status ==&lt;br /&gt;
View general UFW status with:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw status&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To get more detailed output, use:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw status verbose&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If status comes back &amp;quot;inactive&amp;quot;, enable UFW with:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw enable&amp;lt;/code&amp;gt;&lt;br /&gt;
{{warn | If connecting remotely, do not enable UFW until you allow ssh ports!}}&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
To disable it again, use:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo ufw disable&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Common Ports to Allow ==&lt;br /&gt;
Below are commands to allow commonly opened ports.&amp;lt;br&amp;gt;&lt;br /&gt;
For security reasons, it&amp;#039;s best to only open those ports that you need, and keep the rest closed.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;SSH&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 22/tcp&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;HTTP&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 80/tcp&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;HTTPS&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 443/tcp&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RDP&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 3389/tcp&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 3306/tcp&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;PostgreSQL&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;sudo ufw allow 5432/tcp&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
</feed>