{"id":1578,"date":"2021-12-16T12:56:54","date_gmt":"2021-12-16T09:56:54","guid":{"rendered":"https:\/\/files2.tojikon.net\/files-cloud\/2021\/04\/26\/how-to-port-forward-through-the-firewall-on-ubuntu\/https:\/\/files2.tojikon.net\/files-cloud\/2021\/04\/26\/how-to-port-forward-through-the-firewall-on-ubuntu\/"},"modified":"2021-12-16T12:56:54","modified_gmt":"2021-12-16T09:56:54","slug":"how-to-port-forward-through-the-firewall-on-ubuntu","status":"publish","type":"post","link":"https:\/\/tojikon.net\/en\/1578-how-to-port-forward-through-the-firewall-on-ubuntu\/","title":{"rendered":"How to port forward through the firewall on Ubuntu"},"content":{"rendered":"<section id=\"related_posts\">\n<div class=\"block-head\">\n<h3>Related Articles<\/h3>\n<\/div>\n<\/section>\n<p>Do you use the Ubuntu firewall and need to open up ports to the internet on your system? We can help! Follow along with this guide as we go over ways you can port forward on Ubuntu!<\/p>\n<p>Note: although this guide focuses on Ubuntu, it will also work on any Linux OS based upon Ubuntu as they also have access to the same firewall.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-400661 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-port-forward-through-the-firewall-on-ubuntu.png\" alt=\"port forward on Ubuntu\" width=\"1200\" height=\"908\"\/><\/p>\n<p>Need to block ports? Try this guide.<\/p>\n<h2>Port forward on Ubuntu \u2013 GUI<\/h2>\n<p>The easiest way to port forward through the firewall on Ubuntu is by using the GUI. The GUI for the Ubuntu firewall acts as a go-between to the command line. Essentially, it gives a nice interface to the command-line app.<\/p>\n<p>To interact with the Ubuntu firewall with a GUI, you will need to have the GUFW app installed on your system if you don\u2019t already. To install GUFW on your Ubuntu PC, start by opening up a terminal window.\u00a0<\/p>\n<p>You can open up a terminal window by pressing\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>on the keyboard. Or, alternatively, you can search for \u201cTerminal\u201d in the Ubuntu app menu. Once the terminal window is open and ready to use, use the\u00a0<strong>apt install\u00a0<\/strong>command to get GUFW.<\/p>\n<pre>\nsudo apt install gufw\n<\/pre>\n<p>If you\u2019re not a fan of using the terminal to install apps, don\u2019t worry! You can install it using Ubuntu Software. To start, open up the \u201cUbuntu Software\u201d application. Once it is open, find the search icon, and click on it with the mouse.<\/p>\n<p>In the search box, type in \u201cGUFW\u201d and press the\u00a0<strong>Enter\u00a0<\/strong>key. By pressing\u00a0<strong>Enter<\/strong>, you\u2019ll be presented with search results. Look through the results for \u201cFirewall Configuration\u201d and click on it.<\/p>\n<p>Upon clicking on \u201cFirewall\u201d configuration, you will go to the app\u2019s Ubuntu Software page. Click on the \u201cINSTALL\u201d button to download and install the software on your computer.<\/p>\n<h3>Configuring port forwarding in GUFW<\/h3>\n<p>Now that the GUFW application is installed on your Ubuntu PC, you can use it to forward ports outside of the firewall. To do it, follow the step-by-step instructions below.<\/p>\n<p><strong>Step 1:<\/strong> Open up GUFW by searching for \u201cFirewall Configuration\u201d in the Ubuntu app menu. Once it is open, look for the \u201cStatus\u201d slider. Click it to enable protection if you do not have it on already.<\/p>\n<p><strong>Step 2:<\/strong> Find the \u201cRules\u201d button in GUFW, and click on it to access the rules area. From here, select the \u201c+\u201d icon. By clicking on this icon, you\u2019ll open up the \u201cAdd a Firewall Rule\u201d window.<\/p>\n<p><strong>Step 3:<\/strong> In the new rule window, find the \u201cSimple\u201d tab, and click on it. In the tab, find \u201cDirection\u201d and change it to \u201cOut.\u201d By setting it to out, you\u2019re allowing Ubuntu to \u201cport forward\u201d to the internet.\u00a0<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-400662 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-port-forward-through-the-firewall-on-ubuntu-2.png\" alt=\"\" width=\"1200\" height=\"894\"\/><\/p>\n<p><strong>Step 4:<\/strong> Find the \u201cPort\u201d box, and click on it with the mouse. From there, find the \u201cPort or service\u201d box and type in the port. When you\u2019ve finished writing out the port number, click on the \u201cAdd\u201d button to add the new rule.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-400661 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-port-forward-through-the-firewall-on-ubuntu.png\" alt=\"\" width=\"1200\" height=\"908\"\/><\/p>\n<p>Once you\u2019ve added in your port number, the firewall should instantly allow it through. However, if it is not instant, feel free to reboot your PC to fix the problem.<\/p>\n<h2>Port forward on Ubuntu \u2013 CLI<\/h2>\n<p>In addition to port forwarding with the GUI, it is also possible to port forward in the Ubuntu firewall using the CLI (AKA the terminal). To do this, start by confirming you have the UFW firewall enabled on your system.<\/p>\n<p>To confirm you have the UFW firewall enabled, open up a terminal window. You can open up a terminal window by pressing\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>on the keyboard or by searching for \u201cterminal\u201d in the app menu.<\/p>\n<p>With the terminal window open, use the\u00a0<strong>sudo ufw enable\u00a0<\/strong>command to enable the firewall if it is turned off for some reason. If your UFW is already enabled, do not worry. You can skip this step.<\/p>\n<p>After confirming that the UFW firewall is operational, use the\u00a0<strong>ufw allow\u00a0<\/strong>command to port forward. For example, if you are hosting an OpenSSH server on your Ubuntu PC, you will need to open up port 22 to the internet. To do that, you can enter the command below.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-400673\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-port-forward-through-the-firewall-on-ubuntu-4.png\" alt=\"\" width=\"1200\" height=\"807\"\/><\/p>\n<pre>\nsudo ufw allow 22\/tcp\n<\/pre>\n<p>Or, if you need to allow connections on port 32400 out to the internet over UDP, you can do the following command instead.\u00a0<\/p>\n<pre>\nsudo ufw allow 32400\/udp\n<\/pre>\n<p>Once you\u2019ve added your ports to the Ubuntu firewall, you can check its status to see if the <strong>allow\u00a0<\/strong>commands you\u2019ve entered are running using the\u00a0<strong>ufw status\u00a0<\/strong>command.<\/p>\n<pre>\nsudo ufw status\n<\/pre>\n<p>Suppose you\u2019re having issues getting port forwarding working on Ubuntu, and the <strong>ufw allow\u00a0<\/strong>commands aren\u2019t working. In that case, you can disable the firewall entirely, exposing all ports to the internet using the <strong>ufw disable\u00a0<\/strong>command.<\/p>\n<pre>\nsudo ufw disable\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Related Articles Do you use the Ubuntu firewall and need to open up ports to the internet on your system? We can help! Follow along with this guide as we go over ways you can port forward on Ubuntu! Note: although this guide focuses on Ubuntu, it will also work on any Linux OS based &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1579,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[33],"_links":{"self":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1578"}],"collection":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/comments?post=1578"}],"version-history":[{"count":0,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1578\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media\/1579"}],"wp:attachment":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media?parent=1578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/categories?post=1578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/tags?post=1578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}