
For security, the firewall is enabled when you first deploy a Vultr cloud server. Your server's firewall software varies depending on the operating system you deploy. This guide explains how to determine which firewall you have, allow and deny traffic, and learn more about your firewall.
Depending on your operating system, your cloud server may use one of these firewalls:
Firewalld is the default software firewall for Fedora, CentOS 7, and other modern distributions based on Red Hat or SUSE Linux. This quickstart guide outlines several useful commands and techniques to assist in debugging Firewalld.
Assuming your active zone is public, this quick check reveals what traffic is allowed.
Assuming your active zone is public, use either of these two methods to allow SSH.
or
As root, use the --panic-on switch.
All packets will be dropped. Active connections will be terminated after a period of inactivity.
As root, use the --panic-off switch.
Temporary changes cause a common issue; the server works as expected until the next reboot. Make sure you permanently save your configuration.
To make a command permanent, add the --permanent option to all commands except --direct commands (which are temporary by nature). Setting made with the --permanent option do not take effect until the next firewall reload, service restart, or system reboot. Settings made without the --permanent option take effect immediately but are only valid until the next firewall reload, system boot, or service restart.
As root, mask and disable the service.
IPFW is a FreeBSD stateful firewall and packet filter. This quickstart guide outlines several useful commands and techniques to assist in debugging IPFW.
To enable IPFW at boot, add firewall_enable="YES" to /etc/rc.conf:
Start the firewall.
Stop the firewall.
To disable the firewall, set the following option in /etc/rc.conf file:
This example uses 192.0.2.123 as the server's IP address.
Allow anything outbound from this address.
Deny anything outbound from other addresses.
Allow TCP through if setup succeeds.
Allow IP fragments
Allow inbound ssh
Everything else is denied and logged.
It's possible to make changes on-the-fly to the ipfw configuration without saving permanently. This causes a common issue; the server works as expected until the next reboot. Make sure you permanently save your configuration.
To make your rules permanent, put your rules into a file such as /etc/ipfw.conf, then add this to /etc/rc.conf:
An example /etc/ipfw.conf to allow SSH and deny all others looks like this:
See the IPFW documentation for more details.
OpenBSD Packet Filter (pf) is a stateful packet filter firewall. pf was developed for OpenBSD, but has been ported to many other operating systems. This quickstart guide outlines several useful commands and techniques to assist in debugging pf.
To enable pf at boot, add pf_enable=yes to /etc/rc.conf:
Start pf manually.
Show the current ruleset.
Show everything possible.
Stop pf.
Disable pf at boot.
This trivial example will allow SSH into the server while blocking everything else. Add the following to /etc/pf.conf.
See the pf documentation for more details.
IP Filter (commonly referred to as ipf) is an open-source firewall available on several operating systems, including FreeBSD, NetBSD, OpenBSD, and Solaris. IPFILTER is included in the basic FreeBSD install as a kernel loadable module. This quickstart guide provides a few helpful commands and techniques to assist in debugging IPFilter.
Add the following to /etc/ipf.conf for a trivial firewall that blocks everything except SSH (port 22) for example IP 192.0.2.123.
See the ipf documentation for more details.
UFW is the default firewall configuration tool for Ubuntu. This quickstart guide outlines several useful commands and techniques to assist in debugging UFW.
Enable UFW with the default set of rules:
Check the status of the server firewall with sudo ufw status. You may see one of these results:
The firewall rules in force are displayed.
An example that blocks all inbound traffic except SSH (port 22).
An example that blocks all inbound traffic except HTTP and HTTPS.
nftables provides firewall support and NAT. This quickstart guide outlines several useful commands and techniques to assist in debugging nftables.
Recent versions of Debian have nftables installed by default.
If you need to install nftables:
To enable nftables at boot:
To stop nftables from filtering traffic, delete all the rules.
To disable nftables from starting:
To uninstall nftables:
This trivial example allows SSH, HTTP, HTTPS, and ICMP. It denies all other inbound traffic.
Edit /etc/nftables.conf.
Replace /etc/nftables.conf with the following rules.
See https://wiki.debian.org/nftables for more details.
Windows Firewall with Advanced Security can be accessed from the GUI, a command prompt, or PowerShell. This quickstart guide outlines several useful commands and techniques to assist in debugging Windows Firewall. For more details, see our guide How to Configure the Firewall on Windows Server 2019.
If using the GUI, use one of the following methods to launch the Windows Firewall.
wf.msc.These commands must be run from an administrative command prompt or PowerShell.
For more help with Windows Firewall using PowerShell, see the Microsoft article Windows Defender Firewall with Advanced Security Administration with Windows PowerShell
For more details about using Group Policy or MMC snap-ins, refer to the Microsoft documentation.
iptables is a user-space utility program that allows you to configure the IP packet filter rules of the Linux kernel firewall.
To view the current firewall rules:
To disable the firewall temporarily, flush all rules.
To block everything, drop all packets on all chains.
Here is a typical example of allowing SSH, HTTP, and HTTPS but dropping everything else.
Append a rule to the INPUT chain:
For those packets, jump to ACCEPT.
Append a rule to the INPUT chain: Drop everything else.
To learn more about iptables, see the Ubuntu and CentOS guides.
0 Comments
Be the first to comment and share your perspective with the community.