Opening Ports on your Linux server via iptables

To open ports via local tables you will need to have command line access to your server. Please login to your server via SSH as the root user and run the following commands:

To open the firewall for port 80 (Web Server)

[email protected]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[email protected]# iptables -I OUTPUT -p tcp --dport 80 -j ACCEPT

[email protected]# service iptables save

Notice that I ran the command twice, once for INPUT and again for OUTPUT. You can change the port and/or the protocol if required. Some examples are below. *Make sure to run the "service iptables save" command to save the newly added rules.

[email protected]# iptables -I INPUT -p tcp --dport 65656 -j ACCEPT

[email protected]# iptables -I INPUT -p udp --dport 53 -j ACCPT

[email protected]# iptables -I OUTPUT -p udp --dport 4431 -j ACCEPT

Was this answer helpful?

 Print this Article

Also Read

Installing/updating packages on Fedora Core/CentOS

i ) To search for a package :- yum search [package] - i.e :- yum search MySQL ii) To install...

How to change your root MySQL password

1. Login to your server via SSH 2. Proceed with Scenerio 1 or Scenerio 2 below: Scenerio 1: If...

How to download files to your VPS

To download files to your VPS, you can use a utility called "wget", which is accessible via SSH....

Common Log File Locations

/var/log/messages : General message and system related stuff /var/log/exim_mainlog : Exim Mail...

Linux Commands

Below are some basic and useful commands that can be used on the linux command line (SSH)....