{"id":1222,"date":"2021-12-16T11:48:57","date_gmt":"2021-12-16T08:48:57","guid":{"rendered":"https:\/\/files2.tojikon.net\/files-cloud\/2021\/10\/29\/how-to-set-up-firewalld-the-easy-way-on-ubuntu-server\/https:\/\/files2.tojikon.net\/files-cloud\/2021\/10\/29\/how-to-set-up-firewalld-the-easy-way-on-ubuntu-server\/"},"modified":"2021-12-16T11:48:57","modified_gmt":"2021-12-16T08:48:57","slug":"how-to-set-up-firewalld-the-easy-way-on-ubuntu-server","status":"publish","type":"post","link":"https:\/\/tojikon.net\/en\/1222-how-to-set-up-firewalld-the-easy-way-on-ubuntu-server\/","title":{"rendered":"How to set up FirewallD the easy way on Ubuntu Server"},"content":{"rendered":"<section id=\"related_posts\">\n<div class=\"block-head\">\n<h3>Related Articles<\/h3>\n<\/div>\n<\/section>\n<p>FirewallD is a complex firewall system for Linux operating systems. It ships by default on Fedora and many other Linux OSes, and for a good reason. It is powerful, highly configurable, and secure. But it isn\u2019t great to set up by hand.<\/p>\n<p>If you don\u2019t want to fuss around and want to get FirewallD up and running on your Ubuntu Server system so you can get on with your work, this guide is for you. Follow along as we show you how to set up FirewallD on Ubuntu Server the easy way!<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-410639 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-set-up-firewalld-the-easy-way-on-ubuntu-server.jpg\" alt=\"\" width=\"1200\" height=\"615\"\/><\/p>\n<h2>Getting Webmin installed on Ubuntu Server<\/h2>\n<p>If you want to use the built-in FirewallD module inside of Webmin on your Ubuntu Server, you\u2019ll have to install the Webmin app. Thankfully, Webmin supports the Ubuntu platform well.<\/p>\n<p>To start Webmin installation on Ubuntu Server, launch a terminal window and log into the machine over SSH. Or sit at the server physically. Then, when you\u2019ve got access to the Ubuntu Server terminal, enter the commands below to get Webmin working.<\/p>\n<pre>\nwget http:\/\/prdownloads.sourceforge.net\/webadmin\/webmin_1.981_all.deb\n<\/pre>\n<pre>\nsudo apt install .\/webmin_1.981_all.deb\n<\/pre>\n<p>Setting up Webmin on Ubuntu Server is pretty straightforward. However, if you need more guidance on how to get this program working on your system, we\u2019ve got you covered. Follow our guide on how to set up Webmin on Ubuntu Server.<\/p>\n<h2>Setting your root password<\/h2>\n<p>Using the Webmin web UI on Ubuntu Server requires access to the root password. However, Ubuntu shuts off the root account by default. Therefore, you must set up the password on the root account to gain access to it.<\/p>\n<p>To set up the password on the root account, use the <strong>sudo -s<\/strong> command to access root. This command grants you root indirectly.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-408932 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-set-up-firewalld-the-easy-way-on-ubuntu-server-1.jpg\" alt=\"\" width=\"1200\" height=\"539\"\/><\/p>\n<pre>\nsudo -s\n<\/pre>\n<p>With root level access gained, it is time to change the password. Using the <strong>passwd<\/strong> command, inform Ubuntu that the root password is to be changed. For best results,\u00a0 ensure the root password is memorable and secure.<\/p>\n<p>Note: if you need help generating a password, check out StrongPasswordGenerator.<\/p>\n<pre>\npasswd\n<\/pre>\n<p>Now that your Ubuntu Server\u2019s root account is set up correctly, you\u2019ll be able to log into the Webmin web UI. To access the web UI, open up a new tab in your favorite web browser and visit the link below.<\/p>\n<pre>\nhttp:\/\/YOUR_UBUNTU_SERVER_IP_ADDRESS_OR_HOSTNAME:10000\n<\/pre>\n<h2>Installing the \u201cfirewalld\u201d package on Ubuntu Server<\/h2>\n<p>Webmin cannot interact with FirewallD on your Ubuntu Server system unless the \u201cfirewalld\u201d package is installed. Sadly, unlike a lot of other Webmin modules, Webmin can\u2019t install the package automatically. You must do it yourself.<\/p>\n<p>To install the \u201cfirewalld\u201d package in Webmin, follow the step-by-step instructions below.<\/p>\n<p><strong>Step 1:<\/strong> Log into the Webmin user interface using \u201croot\u201d as the username and the password you set as the password.<\/p>\n<p><strong>Step 2:<\/strong> Find the menu in the left-hand sidebar and click on it with the mouse.<\/p>\n<p><strong>Step 3:<\/strong> Click on the terminal icon in the sidebar at the bottom. This button will launch a terminal window right inside of your browser with root access.<\/p>\n<p><strong>Step 4:<\/strong> Install the \u201cfirewalld\u201d package on your Ubuntu Server using the apt install command.<\/p>\n<pre>\napt install firewalld -y\n<\/pre>\n<p><strong>Step 5:<\/strong> After installing the \u201cfirewalld\u201d package on your Ubuntu Server, you will need to unblock port 10000 over TCP, as your new firewall will lock you out of the Webmin UI.<\/p>\n<p>To unblock, return to the SSH terminal you used to install Webmin and enter the two commands below.<\/p>\n<pre>\nsudo firewall-cmd --permanent --add-port=10000\/tcp\nsudo firewall-cmd --reload\n<\/pre>\n<p>When the firewall is updated, press <strong>F5<\/strong> in the browser to refresh Webmin. Then, click on the \u201cRefresh Modules\u201d button at the bottom of the sidebar.<\/p>\n<h2>Configuring FirewallD in Webmin<\/h2>\n<p>Access the \u201cNetworking\u201d section of Webmin in the sidebar. Then, click on the \u201cLinux Firewall\u201d button and follow the step-by-step instructions below.<\/p>\n<h3>Adding ports<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-410627 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-set-up-firewalld-the-easy-way-on-ubuntu-server-2.jpg\" alt=\"\" width=\"1200\" height=\"470\"\/><\/p>\n<p><strong>Step 1:<\/strong> In the FirewallD section, find the \u201cAdd allowed port..\u201d\u00a0 button and click on it with the mouse to add a new port to the firewall.<\/p>\n<p><strong>Step 2:\u00a0<\/strong> After clicking on the \u201cAdd allowed port\u201d button, FirewallD will open up the \u201cAllowed port options\u201d window. From here, find \u201cSingle port\u201d and enter the single port into the box. Or, if it is a range of ports, enter the range in the \u201cPort range\u201d section.<\/p>\n<p><strong>Step 3:<\/strong> Once you\u2019ve entered the port details, find the \u201cNetwork protocol\u201d section and set it to either TCP or UDP.<\/p>\n<p><strong>Step 4:<\/strong> Find the green \u201cCreate\u201d button and select it to add it to your list of rules.<\/p>\n<h3>Adding service<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-410630 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-set-up-firewalld-the-easy-way-on-ubuntu-server-3.jpg\" alt=\"\" width=\"1200\" height=\"560\"\/><\/p>\n<p><strong>Step 1:<\/strong> Select the \u201cAdd allowed service\u201d button to open up the allowed service menu.<\/p>\n<p><strong>Step 2:<\/strong> Find the \u201cService to allow\u201d area, and click on it with the mouse. Then, type in the search box the name of the service you wish to allow through the Firewall.<\/p>\n<p><strong>Step 3:<\/strong> Select the green \u201cCreate\u201d button to add your new service to the FirewallD rules.<\/p>\n<h3>Adding port forward<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-410636 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-set-up-firewalld-the-easy-way-on-ubuntu-server-4.jpg\" alt=\"\" width=\"1200\" height=\"544\"\/><\/p>\n<p><strong>Step 1:<\/strong> Select the \u201cAdd port forward\u201d button inside of the FirewallD rules area.<\/p>\n<p><strong>Step 2:<\/strong> Find the \u201cSingle port\u201d box and enter the port you wish to forward. Or, select the \u201cPort range\u201d box to add a range of ports.<\/p>\n<p><strong>Step 3:<\/strong> Find the \u201cDestination port\u201d and enter either a single port or a port range.<\/p>\n<p><strong>Step 4:<\/strong> Select the \u201cCreate\u201d button to add the rules to the firewall.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Related Articles FirewallD is a complex firewall system for Linux operating systems. It ships by default on Fedora and many other Linux OSes, and for a good reason. It is powerful, highly configurable, and secure. But it isn\u2019t great to set up by hand. If you don\u2019t want to fuss around and want to get &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1223,"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\/1222"}],"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=1222"}],"version-history":[{"count":0,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1222\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media\/1223"}],"wp:attachment":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media?parent=1222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/categories?post=1222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/tags?post=1222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}