Get the latest tutorials on SysAdmin and open source topics. Hub for Good Supporting each other to make an impact. Write for DigitalOcean You get paid, we donate to tech non-profits.
Step 2: Allow SSH Connections
By default Ubuntu has a built-in firewall known as UFW uncomplicated firewall. For inexperienced users, It it difficult to use iptables in order to properly configure a firewall. UFW makes the configuration of a firewall very easy since it is a simple interface for the standard iptables in Ubuntu.
Changes, errors and bugs
Uncomplicated Firewall or UFW is an interface to iptables that is designed to simplify the process of configuring a firewall. While iptables is a firm and flexible tool, it can be sometimes tricky for beginners to learn how to use it to properly configure a firewall. If a user is looking to get started securing his or her network, UFW may be the appropriate solution. UFW is installed on Ubuntu by default.
Iptables rules are complicated and UFW is designed to make things less complicated for administrators, that is why it also called Uncomplicated Firewall. UFW Firewall is disabled by default on Ubuntu The correct way is, first we must add firewall rule to open ssh port 22, then we activate the firewall. If you start the firewall without opening SSH port, we won't able to access the command line remotely. At this point our Ubuntu server blocks all incoming traffic except for the SSH. Next, we will see how to open additional network ports on UFW. The ufw allow command adds allow rules to the firewall. To allow incoming traffic from a specific port we can use either service name or the port number.