Get 50% Discount Offer 7 Days

NeuronVM

Contact Info

Chicago 12, Melborne City, USA

+88 01682648101

[email protected]

How to Setup a Firewall on a Dedicated Server
0
(0)

In this article, How to Setup a Firewall on a Dedicated Server will be taught. Firewall is one of the most important security aspects of any system. In fact, the firewall prevents malicious traffic and hackers and unauthorized access to your system. The function of the firewall is to switch and route packets between networks. Thus, it can control the incoming and outgoing traffic and allow the user to enter and access based on the defined rules. Choose and buy a cheap dedicated server from NeuronVM and run your firewall on it.

Getting to know the firewall

Firewall is software or hardware that prevents access to computers and controls the traffic exchanged in the network. A firewall is actually a security tool that can be a software program or a dedicated network device.

The main purpose of a firewall is to separate a secure data from an insecure area and control the communication between the two. A firewall can do other things as well, but it is mainly responsible for controlling incoming and outgoing communications from a device to the network.

Firewalls prevent unauthorized access to your private network and are a comprehensive security framework for your network. In the next section, you will be taught How to Setup a Firewall on a Dedicated Server. Stay with us until the end of this post.

How to Configure the Firewall on a Dedicated Server

In this section, we are going to configure a firewall using IP tables. Doing this using IP tables is because IP tables enable you to have full control over Transmission Control Protocol (TCP) and Secure Shell (SSH) connections, etc.

The first requirement to configure the firewall with this method is that you must have access to the iptables program. In the first step, you should check that no rules are set by default by running the following command:

iptables -L

Now you can add a new rule to a specific chain by running the following command. It should be noted that in the following command, incoming TCP is activated through port 7822. It is interesting to know that port 7822 is used by SSH:

iptables -A INPUT -p tcp -m tcp --dport 7822 -j ACCEPT

Now you can enable incoming TCP connections through port 80 (HTTP) using the following command:

iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT

If you have set an SSL certificate for your site and want to enable access through port 443, you can use the following command.

TIP: Port 443 is the default for HTTPS.

iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT

You can block a specific IP address from accessing your server by running the following command:

iptables -I INPUT rulenum -s 'IP address goes here' -j DROP

How to Install an Advanced Policy Firewall on a Dedicated Server

The second method is to replace the previous method with Advanced Policy Firewall (APF). In this way, you can configure the firewall using a simple text editor. Go to the following path to access the configuration file:

/etc/apf/conf.apf

Now you can open the configuration file using the text editor of your choice like the following command:

vi /etc/apf/conf.apf

After you open the configuration file, you should look for the following commands and change their value:

SET_MONOKERN="0"
HELPER_SSH_PORT="22"
IG_TCP_CPORTS="22"

You can change the values in the above commands as follows. Then save the configuration file and exit:

SET_MONOKERN="1" 
HELPER_SSH_PORT="7822"
IG_TCP_CPORTS="80, 7822, 443"

Finally, you can start the APF program by running the following command:

apf --start

Conclusion

In small networks, the security of each network device can be established by installing software, disabling unnecessary devices, and installing security software inside it. This is why installing a firewall is a necessity. In this article, you were taught How to Setup a Firewall on a Dedicated Server.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *