ssh: connect to host X.X.X.X port 22: Connection timed out - linux

I'm running a linux based (centos 6.5) VPS. I had no problem since yesterday that everything was fine . I was editing Iptables rules , trying to reject and allow some services and ports but suddenly I got disconnected from VPS and could not connect anymore. I Googled a lot and read many topics regarding this problem but none of them helped me.
I tried:
Reinstalling sshserver and client
Flushing Iptables, saving it and then restarting it
Changing the port for ssh using from /etc/ssh/sshd_config file to sth
else and then allowing this new port from iptables
but I still have the problem.
any help would be appreciated.

As we commented :
Put this rule : iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

Related

P4V not connecting to my DigitalOcean Droplet when setting up a Perforce Server

I'm trying to set up a Perforce Server using a Droplet from DigitalOcean and connect to it via P4V.
I was following this tutorial https://allarsblog.com/2014/09/25/setup-perforce-digital/ which I was originally led to by an Unreal Engine official YouTube tutorial. When I got to the part where I was supposed to connect via P4V I got the following error:
Connect to server failed; check $P4PORT.
TCP connect to [Droplet IP Address]:1666 failed.
connect: [Droplet IP Address]:1666: WSAECONNREFUSED
I posted on the DigitalOcean forum and they suggested I try to set the P4PORT then verify it with p4 info, but the p4 info command only yields the following:
Perforce client error:
Connect to server failed; check $P4PORT.
TCP connect to devel:1666 failed.
No such host is known.
Since it said no such host is known, I tried using the direct IP Address in the place of devel, and that only returned the same result but it also said connect: [IP Address]:1666: WSAECONNREFUSED.
I can ping the IP Address just fine. Connecting via puTTY (port 22) does not seem to be an issue. I'm using Windows 10, I heard Firewalls could produce this problem but even if I disable my Firewall I get the same errors.
This is my first time doing this, so I may have made a beginners mistake. Any help would be appreciated.
Found my answer in another Forum: Fire up PuTTY and log in as “root” Type “p4d” from the command line (If you don’t see it, it should be located in “/usr/local/bin”)
I had a similar issue.
To clear the " WSAECONREFUSED " error we put Server:[DigitalOcean ServerIP]:1666 and clicked the "New" button for user.
We were prompted with a new error -> WSAETIMEDOUT
to solve this we had to open the 1666 port on the server so we opened the up and down 1666 using these commands.
iptables -I INPUT -p tcp --dport 1666 --syn -j ACCEPT
&
iptables -I INPUT -p udp --dport 1666 -j ACCEPT

curl: (7) Failed connect to 127.0.0.1:5984; Connection refused [Sometimes]

I have a couchdb database installed in a centos machine in azure. what's strange is that when i try to run 'curl http://127.0.0.1:5984' in terminal it give me expected result sometimes.
{"couchdb":"Welcome","version":"2.3.0","git_sha":"07ea0c7","uuid":"d36b551cb35122db8d088982c4216c9b","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
but sometimes i am getting this:
curl: (7) Failed connect to 127.0.0.1:5984; Connection refused
this is having frequently i means sometimes i get result and sometimes i don't.
what am i doing wrong??
Perhaps your virtual machine has iptables rule that deny the traffic go in to port 5984. Try to open with following command:
iptables -I INPUT -p tcp -m tcp --dport 5984 -j ACCEPT
If it still not working, try to turn off firewalld service:
service firewalld stop

Linux, CentOS 6.2: Unable to fetch data from SSL sites (cURL, wget, etc)

Machine: CentOS 6.2
I've had a Perl script which I've been using for ages, which has previously had no problem (and still doesn't) fetching data using LWP from port 80 locations. However, attempting to fetch from https locations, on port 443, always fails.
To simplify the diagnostics, I figured I'd try the same idea from the command line using cURL and wget, but these also fail with https, while they also both work fetching regular http data.
Figuring that the same problem affects all three methods, I'm trying to ascertain exactly what it is that might be wrong, and how to fix it. It's a dedicated server, and I have root access so I can pretty much do what I want to.
I've tried forcing cURL to use ipv4, and a bunch of other flags that looked interesting, but I always end up with the requests failing with "curl: (7) couldn't connect to host".
$ cat debugdump.txt
== Info: About to connect() to www.xyz.com port 443 (#0)
== Info: Trying 194.xxx.xxx.xx... == Info: Connection timed out
== Info: couldn't connect to host
== Info: Closing connection #0
... and similar connection time-outs with wget as well.
If I try fetching the same data with http, and with the -L flag (to follow redirects) then it will similarly fail on the secure portion of it.
So, basically I want to be able to retrieve remote data served via https, but am currently unable to do so. I know I definitely should be able to. I've spent ages trying to resolve this, but so far to no avail. Any useful information to help solve the problem would be much appreciated. Thanks!
Edit
Additional info: I'm not really too familiar with firewalls, but FYI, the entries in /etc/sysconfig/iptables relating to port 443 are:
-A INPUT -p tcp -m tcp -m multiport --dports 80,443 -m state --state NEW -j Cid2676X....
-A OUTPUT -p tcp -m tcp -m multiport --dports 80,443 -m state --state NEW -j Cid2676X...
However, I'm not sure why/if I'd need to open port 443 (if it's not already open) anyway; I mean, I'm fetching from port 443 on another server, not listening for traffic on my 443; surely I'm using some other random port on my own machine to fetch with?
Edit 2
Figured out that if I temporarily disable the iptables then the problem goes away. Of course, I need to have the iptables active, so I need to know what it is about the iptables that is preventing me fetching from secure sites. Suggestions welcome.

cannot open up port using iptables to use rstudio server

I am currently trying to open port 8787 for rstudio server. I have set this up on an ubuntu host, and want to point my browser at the ip address of the ubuntu host, using port 8787 to direct it to rstudio. I can do this from the host machine, but no such luck using a different computer.
When I do
netstat - peantl | grep ":8787"
I get nothing returned, unlike when checking port 22 which is confirmed as listening. I can there ssh from external machines into the ubuntu host.
So I tried to open up port 8787 with iptables:
sudo iptables -A INPUT -p tcp --dport 8787 -j ACCEPT
command runs fine, but then re-checking with netstat I still do not get any output (I was expecting similar output to port 22 as mentioned previously)
I also allowed port 8787 on ufw:
sudo ufw allow 8787
using gufw it confirms port 8787 is open.
What could be the issue? If my network has restricted port 8787 how can I tell? Am I allowing port 8787 correctly with iptables?
Thanks.
All your iptables and ufw commands are doing is opening ports in the firewall itself. The fact that there is no output from the netstat|grep line means that the rstudio software does not actually have the port open for anyone to connect to. This is the issue you need to fix first.

Cannot access app engine application from LAN

I added the --address=0.0.0.0 to GAE arguments in eclipse.
From the same machine I can access the server with:
http://192.168.1.7:8888/createUser.html
http://localhost:8888/createUser.html
http://0.0.0.0:8888/createUser.html
http://127.0.0.1:8888/createUser.html
However if I try to access it from an Android device on the same LAN through http://192.168.1.7:8888/createUser.html I get an "Oops!".
The Android device can ping 192.168.1.7 and vice versa.
I'm using Linux and I don't have any firewall. What's the solution?
Thank you.
EDIT: I also tried to access the page from another PC in the same LAN but didn't work. I also tested the port using telnet: it works from the machine but doesn't work from other devices in the same LAN.
The solution is to open the port 8888 using this command:
sudo /sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8888 -j ACCEPT

Resources