How to Secure Your Port using Port Forwarding

In this article I am going to perform how to use port forwarding in a system which is a process that redirects a communication request from a specific port to another port or host. It is basically allows an outside computer to connect to a computer in a private local area network. Some commonly done port forwarding includes forwarding port 22 for SSH access, forwarding port 80 for web servers and port 21 for FTP. The major advantage is that it provides security to your private network and secure communication
Let’s start !!!!

HTTP and HTTPS forwarding
Open ports.conf file from inside /etc/apache2 and type following command to read the configuration.
Cat ports.conf

From screenshot you can view the present listening port 80 and 443 for web server.

If an attacker wants to send malicious file through web server he will try to connect with target using port 80 send the phishing page to the target.

In order to protect you from being targeted through phishing page change the port number from 80 and 443 into other number. 

If you notice the following screenshot here you will that I have modified port 80 into 8088 and port 443 into 44343.

FTP port forwarding
Now open the vsftpd.conf file from inside /etc.
From screenshot you can view listen port is 21 by default, to protect yourself from FTP attacks shift the FTP service on other port.

From given below screenshot you will find that I have change port21 into 2121

SSH port forwarding

Open file sshd_config from / etc/ssh/ssd_config
From screenshot you will find that by default port 22 is use as listen port which is badly affected by DDOS attack. Here to protect yourself apply port forwarding techniques on port 22.

From below image, again you will notice that I have change port 22 into port 2222.

Now if you will scan your network with help of NMAP you will find that the services FTP, HTTP and SSH is successfully running on the modified ports.
Nmap –p- -sV


Post a Comment