I have netgear router. Initially I had forwarded all tcp ports to internal server centos

I was able to ssh into that using my ssh user@publicip.

now I have installed Ubuntu trusty with IP and forwarded all ports on router to that IP.

But I am not able to ssh from outside. I get error ssh: connect to host port 22: Connection timed out.

I am able to ssh within internal network.

I have no firewall and no selinux enable in Ubuntu.

What else can I check?

Its not only ssh but port 80 is also not accessible

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *               LISTEN      31944/rpc.statd
tcp        0      0*               LISTEN      7343/mysqld
tcp        0      0   *               LISTEN      692/rpcbind
tcp        0      0    *               LISTEN      21368/sshd
tcp        0      0*               LISTEN      7911/postgres
tcp        0      0    *               LISTEN      7605/master
tcp6       0      0 :::47082                :::*                    LISTEN      31944/rpc.statd
tcp6       0      0 :::111                  :::*                    LISTEN      692/rpcbind
tcp6       0      0 :::80                   :::*                    LISTEN      20447/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      21368/sshd
tcp6       0      0 :::25                   :::*                    LISTEN      7605/master
  • Have you verified it is listening with netstat?
    – MaQleod
    Mar 14, 2014 at 2:15
  • @MaQleod i have added netstat ouput Mar 14, 2014 at 2:19
  • If it works internally on the network, then a netstat is not needed. An online port checker tool shows port 22 is closed on your external IP: yougetsignal.com/tools/open-ports - Double check your port forwarding
    – Tillman32
    Mar 14, 2014 at 2:20
  • @Tillman32 yes my port 80 is also coming as closed. how can i open it Mar 14, 2014 at 2:23
  • 1
    Not sure about apache2, i'm not that familiar with the config for it. The next step for ssh would be to run tcpdump -i <iface_name> port 22 on the box and then attempt a connection. The traffic (or lack thereof) should help narrow down the problem.
    – MaQleod
    Mar 14, 2014 at 2:57

1 Answer 1

  • first use tcpdump to make sure that ubuntu doesnt get the traffic, then if not..
  • ..change IP of the centos from to another free IP,,
  • add an alias to ubuntu, so that is has AND in the same time and
  • try sshing from outside. if it works then the problem with the netgear is that it still forwards connections to the old IP

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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