
Whereas this will allow UDP packets on 1725: sudo ufw allow 1725/udpĪlong with allowing or denying based solely on port, UFW also allows you to allow/block by IP addresses, subnets, and a IP address/subnet/port combinations. The following allows TCP packets on port 80: sudo ufw allow 80/tcp To further fine-tune your rules, you can also allow packets based on TCP or UDP. Similarly, to deny traffic on a certain port (in this example, 111) you would only have to run: sudo ufw deny 111 Rules can be added in two ways: By denoting the port number or by using the service name.įor example, to allow both incoming and outgoing connections on port 22 for SSH, you can run: sudo ufw allow ssh Ensure that you have configured allow rules for SSH and other critical services as per the section below before applying default deny or reject rules. CautionĬonfiguring a default reject or deny rule can lock you out of your Linode unless explicit allow rules are in place. The ufw default command also allows for the use of the reject parameter. To deny all incoming and allow all outgoing connections, run: sudo ufw default allow outgoing To start with an easy basis of rules, the ufw default command can be used to set the default response to incoming and outgoing connections. Most systems need a only a small number of ports open for incoming connections, and all remaining ports closed. Use UFW to Manage Firewall Rules Set Default Rules Start and enable UFW’s systemd unit: sudo systemctl start ufw Enforcing your firewall ruleset is covered Enabling UFW with systemd or upstart only tells the init system to switch on the UFW daemon.īy default, UFW’s rulesets are blank so it is not enforcing any firewall rules–even when the daemon is running. This is not the same as telling UFW to enable the firewall rules.
ADD MANUAL RULE FIREWALL BUILDER UPDATE
However, you can use the relevant commands for the outlined tasks on various Linux distributions.ĭebian / Ubuntu sudo apt-get update & sudo apt-get upgradeĭebian starts UFW’s systemd unit automatically and enables it to start on reboots, but Arch does not. This guide lists the commands for Arch Linux, Debian or Ubuntu distributions only. When you reach theĬonfigure a Firewall section return to this guide.

Setting Up and Securing a Compute Instance guide to create a standard user account, harden SSH access and remove unnecessary network services. Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
