0

I have two webserver running. One on 8888 and another on 1234. I can't access them, but I can ssh. I noticed that the settings for the ssh (port 22) look different than for the webserver ports. For instance, they have :::, for the Local Address, rather than 0.0.0.0. Is that a problem?

netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:1234            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:58034           0.0.0.0:*               LISTEN
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN
tcp6       0      0 ::1:25                  :::*                    LISTEN
tcp6       0      0 :::55644                :::*                    LISTEN
tcp6       0      0 :::111                  :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:631                 :::*                    LISTEN

The above is all running on a VM, and the relevant adapter is bridged to my home network. I can ssh from my home network, but I can't curl the webservers.

e.g. curl 192.168.1.228:8888

2 Answers 2

1

I assume you mean "can't" curl the Websites ?

The netstat results are misleading - The results with the ::: are for IPV6 connections as indicated by the "tcp6" on the left hand side - you can ignore them. There are similar tcp connections which are correct.

I suspect you will find your distro has come preconfigured with a basic Firewall which allows ssh in but no other traffic (in the absense of an established outbound request). You have not advised your distro so I can't tell you how to fix it correctly, but you can check if you have a firewall easily enough

iptables -vnL | less will show you the firewall rules. If there are any, thats probably where you need to look.

Issuing a command like "/sbin/iptables -I INPUT -p tcp --dport 8888" will temporarily open up the web server on port 8888 [ ie until the reboot ]. You probably need to edit the appropriate file for your distro - if its Redhat based edit /etc/sysconfig/iptables - then restart it.

4
  • I only see rejects related to icmp. This is a newly installed centos 7 distro.
    – barrrista
    Dec 31, 2014 at 2:22
  • Can you provide the output of "iptables -vnL" ? I've not played with CentOS7, but almost certainly its a firewall issue - check out ask.xmodulo.com/open-port-firewall-centos-rhel.html
    – davidgo
    Dec 31, 2014 at 4:30
  • pastebin.com/5fKf9YfX
    – barrrista
    Dec 31, 2014 at 4:35
  • 1
    Yup, SSH is allowed by that firewall (line 107, which is called from 103 which is called from line 89 ) while port 888 and 1234 are not. From what I've read I imagine issuing the following commands will open the ports permanantly - sudo firewall --zone=public --add-port=8888/tcp --permanent; sudo firewall-cmd --zone=public --add-port=1234 --permanent; sudo firewall-cmd reload
    – davidgo
    Dec 31, 2014 at 4:49
0

Check to make sure you don't have some firewall rules installed. Try

iptables -L

If you had rules that were blocking things they were probably part of startup script which can be negated with

/etc/init.d/iptables stop

You didn't say what distribution you were using so I am not sure if that is what ails you.

4
  • What am I looking for with iptables -L? I see lots of ACCEPT but I also see REJECT. I followed this guide to turn off the firewall:shellhacks.com/en/…
    – barrrista
    Dec 31, 2014 at 2:12
  • the only rejects I see are related to icmp.
    – barrrista
    Dec 31, 2014 at 2:15
  • I'm using Centos 7
    – barrrista
    Dec 31, 2014 at 2:20
  • Without thinking about it just kill all the iptables rules and see if your access problems go away. If they do that's what your problem was. See serverfault.com/questions/200635/…
    – AlanObject
    Dec 31, 2014 at 4:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .