Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(I'm new to this!) I'm running a virtual server running CentOS. I'm trying to run a server that listens on port 37760. The code I'm running executes successfully, so I run

netstat -lptu

To show a list of ports listening, and

tcp        0      0 localhost.localdomain:37760 *:*      LISTEN      15006/node

is one of the entries. However, when I go to ip:37760 in my browser, the connection times out!

I'm sure it's very obvious, but some help would be very helpful!!


share|improve this question
up vote 4 down vote accepted

The netstat output shows that node is only listening on localhost, so you need to either use a browser on that virtual console and navigate to localhost:37760 or update the config of the whatever node is to listen on all addresses.

share|improve this answer
I'm fairly sure this is the problem, I'm just not sure how to fix it. Node refers to the node.js library – Max Woolf Mar 19 '12 at 14:11
You'd need to edit the config file of your node.js server to not bind itself to localhost. Either bind it to the box name or the box's network IP address and not localhost or – FloppyDisk Mar 19 '12 at 15:09
Or bind to (*). – XTL Mar 20 '12 at 10:14

There's an excellent chance that your local firewall is blocking the connection.

Check your local iptables firewall. You can see the current state by running something along the lines of:

iptables -vnL

This will produce output that looks like:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
9192K 3593M ACCEPT     all  --  *      *              state RELATED,ESTABLISHED
   18   740 ACCEPT     icmp --  *      *             
1763K  180M ACCEPT     all  --  lo     *             
 6124  367K ACCEPT     tcp  --  *      *              state NEW tcp dpt:22

These four rules read like this:

  • Allow traffic that is associated with an existing connection
  • Allow ICMP traffic.
  • Allow all traffic over the loopback interface
  • Allow new connections on TCP port 22 (ssh)

You can see the persistent state in /etc/sysconfig/iptables. You can use the system-config-firewall tool if you want a GUI configuration mechanism, or you can use this opportunity to learn more about how firewall configuration works from the command line.

share|improve this answer
I should say I've answered my own question. It was a global block by my provider. – Max Woolf Mar 19 '12 at 19:13

CentOS, by default, turns IPTables on and enforces a pretty strict security policy with SELinux. If you're trying to get at the port from another computer, the default IPTables setup drops all incoming connections except SSH. If you aren't worried about security, you can simply run

sudo service iptables stop 

to turn off IPTables completely.

The other thing that could be holding you up, on CentOs, is SELinux. This acts as a second layer of security on processes and the file system and prevents some servers from having permission to serve files by default, since they don't have access to the directory to serve files from. You have a couple options here.

1) Turn off SELinux by changing the setting in /etc/selinux/config as seen below:

SELINUX=disabled in /etc/selinux/config

2) More preferable, use audit2allow to check if SELinux blocks your server, and if so, generate a new security policy to allow the server. See this CentOS Wiki entry as well as this blog entry.

Finally, if you're running on a VM, make sure your VM has network access and permissions to use the underlying hardware's NIC setup.

share|improve this answer
Turned off iptables, and SElinux isn't installed :( – Max Woolf Mar 19 '12 at 14:12
Have you checked the Virtual Machine software to make sure your VM can accesses the underlying hardware's network interfaces? – FloppyDisk Mar 19 '12 at 14:50
how do I go about doing that? – Max Woolf Mar 19 '12 at 15:11
Depends on the software you're using to run the virtual machine. Is it VMWare, Virtual Box, or some other flavor? And what is the "host" os on the box? – FloppyDisk Mar 19 '12 at 15:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.