Casbay Knowledge Base

Search our articles or browse by category below

Installing Iptables Firewall On Linux Based VPS In 3 Simple Steps

Last modified: September 30, 2022
Estimated reading time: 1 min

Iptables is a firewall program commonly used on Linux based VPS. Similar to other firewalls, based on a predefined set of rules, it will filter incoming and outgoing data packets by monitoring the server. Iptables is usually installed in most Linux distributions, however in the case that it isn’t, here is how you can install iptables on your VPS

Step 1: Log In To The Linux Server Via SSH

Firstly, you will need to connect to the VPS server via SSH root or sudo access.

Step 2: installation

Before the installation, we would want to get all the repositories to the latest update. Use the following command to update them.

sudo apt-get update

After the updating process is over, you may then proceed to install iptables using the following command.

sudo apt-get install iptables

Step 3: Verification

After the installation is done, verify if the installation is successful as well as check the current iptables configuration at the same time. The command used will be “-L”, which is used to list all the rules, and  “-v” is the detailed format of the information. To run it, use the following command for the status check.

sudo iptables -L -v

If an output shows out where the chain’s policy accepts packets, it means that your iptables are successfully installed in your Linux VPS server. The chain of iptables is the set of rules and you are likely to be able to see all chains are set to accept by default.

Was this article helpful?
Dislike 0
Previous: PostgreSQL Installation on Linux VPS Server in 5 Simple Steps (CentOS 7)
Next: Redis Installation Guide on Linux Based VPS in 3 Simple Steps