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)

root@hostname# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
root@hostname# iptables -I OUTPUT -p tcp --dport 80 -j ACCEPT

root@hostname# 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.

root@hostname# iptables -I INPUT -p tcp --dport 65656 -j ACCEPT

root@hostname# iptables -I INPUT -p udp --dport 53 -j ACCPT

root@hostname# iptables -I OUTPUT -p udp --dport 4431 -j ACCEPT
  • 85 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

Previewing your website before transferring it to your VPS - hosts file

Below is a guide to using the hosts file to preview your site before transferring / before DNS...

Connecting to your Linux server via SSH (Shell Access)

An SSH (Secure Shell) session is a useful means of direct communication with your Virtual Server,...

Text Editor on Linux

In order to edit files on the command line you will have to use a text editor.There are many text...

Start/stop web services - Apache, Postfix, MySQL, etc

You can restart application services via SSH. Below are some examples: [Redhat based...

Installing/updating packages on Debian/Ubuntu

Before you search/install a package please refresh the package list using this command - apt-get...