How to open ports?

Issues related to configuring your network
Post Reply
Alexzz
Posts: 3
Joined: 2012/05/24 21:08:45

How to open ports?

Post by Alexzz » 2012/05/24 21:11:34

Hello, I just bought a VPS with CentOS. But im new to CentOS, I have been using Ubuntu for a couple of years.
But now im going to open a counter strike 1.6 server, and I need to open port 27015.
How do I open the port? I am connecting thru VNC so I dont need to do it thru command line.
Anyone that could help me would be appreciated.

Regards, Alex

milosb
Posts: 661
Joined: 2009/01/18 00:39:15
Location: 44 49′14″N 20 27′44″E

Re: How to open ports?

Post by milosb » 2012/05/24 21:18:14

You should most certainly start here: [url=http://wiki.centos.org/HowTos/Network/IPTables]iptables HowTo[/url]

Regards,

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

How to open ports?

Post by pschaff » 2012/05/24 22:45:19

Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature.

To do it via the GUI [url=http://wiki.centos.org/TipsAndTricks/BecomingRoot]become root[/url], start [b]system-config-securitylevel[/b], check the SELinux tab to be sure it is "Enforcing", on the "Firewall Options" tab select "Other ports" near the bottom of the window, "Add", enter the port number, selecting "tcp" or "udp" as required, "OK", and accept the change after reading the warning.

On an Internet-facing server be particularly careful about staying up to date with "yum update" (preferred) or the GUI update tool.

Alexzz
Posts: 3
Joined: 2012/05/24 21:08:45

Re: How to open ports?

Post by Alexzz » 2012/05/25 05:58:26

Thanks :)

Alexzz
Posts: 3
Joined: 2012/05/24 21:08:45

Re: How to open ports?

Post by Alexzz » 2012/05/25 10:34:25

I got a new problem, When I check to see if the port is open I go to canyouseeme.org.
And it says like this:

Error: I could not see your service on ***.***.**.*** on port (27015)
Reason: No route to host

This is my iptables file:


# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 27015 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

And this is my iptables_config file

# Load additional iptables modules (nat helpers)
# Default: -none-
# Space separated list of nat helpers (e.g. 'ip_nat_ftp ip_nat_irc'), which
# are loaded after the firewall rules are applied. Options for the helpers are
# stored in /etc/modprobe.conf.
IPTABLES_MODULES="ip_conntrack_netbios_ns"

# Unload modules on restart and stop
# Value: yes|no, default: yes
# This option has to be 'yes' to get to a sane state for a firewall
# restart or stop. Only set to 'no' if there are problems unloading netfilter
# modules.
IPTABLES_MODULES_UNLOAD="no"

# Save current firewall rules on stop.
# Value: yes|no, default: no
# Saves all firewall rules to /etc/sysconfig/iptables if firewall gets stopped
# (e.g. on system shutdown).
IPTABLES_SAVE_ON_STOP="no"

# Save current firewall rules on restart.
# Value: yes|no, default: no
# Saves all firewall rules to /etc/sysconfig/iptables if firewall gets
# restarted.
IPTABLES_SAVE_ON_RESTART="no"

# Save (and restore) rule and chain counter.
# Value: yes|no, default: no
# Save counters for rules and chains to /etc/sysconfig/iptables if
# 'service iptables save' is called or on stop or restart if SAVE_ON_STOP or
# SAVE_ON_RESTART is enabled.
IPTABLES_SAVE_COUNTER="no"

# Numeric status output
# Value: yes|no, default: yes
# Print IP addresses and port numbers in numeric format in the status output.
IPTABLES_STATUS_NUMERIC="yes"

# Verbose status output
# Value: yes|no, default: yes
# Print info about the number of packets and bytes plus the "input-" and
# "outputdevice" in the status output.
IPTABLES_STATUS_VERBOSE="no"

# Status output with numbered lines
# Value: yes|no, default: yes
# Print a counter/number for every rule in the status output.
IPTABLES_STATUS_LINENUMBERS="yes"

# Reload sysctl settings on start and restart
# Default: -none-
# Space separated list of sysctl items which are to be reloaded on start.
# List items will be matched by fgrep.
#IPTABLES_SYSCTL_LOAD_LIST=".ip_conntrack .bridge-nf"

What have I done wrong?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: How to open ports?

Post by pschaff » 2012/05/25 12:16:34

The only relevant difference between your /etc/sysconfig/iptables-config and a fresh one seems to be that you have [b]IPTABLES_MODULES_UNLOAD="no"[/b] versus [b]IPTABLES_MODULES_UNLOAD="yes"[/b].

The output of "iptables-save" generally provides a better indication of the active rule set. Please describe how your system is connected to the Internet (directly or behind a router) and [url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=28723&forum=54]provide more information about your system[/url] by running "./getinfo.sh network" and showing us the output file.

Post Reply