How to tell on Linux (Lucid) if a connection is coming into the server? - linux

So I have an issue where I am remotely connecting to a Mongodb on my linode box, and I am not longer able to access this DB. I can from my local machine, but when I am on this remote server (where the website runs) it is not working. I am not seeing the connection come into the Mongo logs, so this leads me to believe that maybe it is being intercepted by a firewall?
How can I watch traffic and see if this connection is at least making it to my linode box? I am connecting with Mongoid, so if there is a way to prove no connection there too.
Right now the only error I get is a erb view timeout execution error - not much to go on.
Thanks,
Daniel

Related

Cannot connect to SQL Server database on Nodejs EC2 server

I have an EC2 instance running a node server. The pages and routes render fine on the frontend, but when I do anything that requires a call to the api it says failed to connect to XX.XX.X.XXX:1433 (which is my SQL Server database). When I run the app locally (not inside the EC2 instance) it works just fine and connects to the DB. Btw, my local computer is NOT where the SQL Server database is being hosted.
What could the issue be on the instance?
EDIT: TCP is enabled and the Browser part is running in the SQL manager.
EDIT2:This is the error I get every time my EC2 app makes an api call to te database:
ConnectionError: Failed to connect to XX.XX.X.XXX:1433 in 15000ms
But when I do the dame thing on the app from its development computer on localhost it works just fine.
Ok, so, it looks like this is a network connectivity problem. Can you ping the DB server?
ping xx.xx.xx.xx
Second, can you telnet to the port?
telnet xx.xx.xx.xx 1433
My guess is that both of these will fail. So, the question is, why?
Some things to consider:
Is the database server on the public internet? (I hope not, for security reasons.)
Is your client computer on the public internet?
What is the network access path to get from your client machine to the DB server? VPN tunnel? SSLVPN connection? Something else?
I don't have a specific solution for you, but hopefully I gave you some ideas as to where to look. The problem is (almost certainly) not a database problem, but a network connectivity issue.

Socket IO - WSS Throwing error -- remote client, local server

Hi I've been trying to figure this out for some time now. It's kind of hard to explain... Ill try and give some background : I'm trying to create a pwa that can work on WAN and LAN for when offline. ---- So I have a client and server, if I host the client and server both locally I'm having no issues I can connect to one another directly and everything, the socket.io and web socket work great. If I host the client and server both on Heroku they work great as well. The problem comes when I host the client on Heroku and the server locally -- which in the application I'm working on I need this. Im able to still connect to the other user if im using the WAN connection portion but if I try to make the connection using LAN it throws errors. I'm not sure what is going on, I'm still fairly new socketio, websockets, etc... ---- Here is the error I am getting Error Image. Here are my imports on the server - imports-server, how I'm setting up the server - server setup, how I set up the connection on the client -- client setup. Sorry if I wasn't clear on my explanation, thank you for help.

nginx Ubuntu nodeJs - Server only handles requests from local network

I followed all kinds of instructions all day to get my first server up and running. I tested it on 3 devices and thought I had it... until my friend tried it and discovered "site can't be reached."
In double-checking on my end, I found that if I disconnected my phone from wi-fi, sure enough, I couldn't reach my server.
I realize there could be a million things wrong, but I don't know where to start. I am not even sure what additional information I should include to help find the issue. If I had to guess, I'd say I failed to open the firewall on my server port 80. But I really have no clue. Ubuntu is new to me.
Can you include details about your setup? How is the Ubuntu server configured? If it's your own hardware, have you forwarded the ports on your router? Do you have a Dynamic DNS server in place? Is there an internal firewall (ufw?). Is the Node.js server bound to the loopback? Is Nginx in proxy_pass mode?
As mentioned by the OP, the ports weren't forwarded.

Does node.js server need internet connection to run?

I disable the internet connection and run the node server npm start, then it throws the error:
And now enabling internet connection and running the server works fine:
So, I want to confirm if this really needs to be connected to the internet while starting the server?
If it really needs internet connection, then is there any idea to run the server offline?
If I connect to the internet and run the server and there after plug out the internet connection then there's nothing goes wrong. Everything works fine. I don't know why just running the server requires the internet connection.
OMG! It's really cool! I got it working offline after hard research in my code using 127.0.0.1 instead of localhost for mongo uri.
Using localhost needed for me to connect to the internet.
And using 127.0.0.1 worked in both condition i.e. with internet connection and without internet connection.
But, really I'm totally amazed of this.
I found the really cool topic on this which made me clear about this.
If you use 127.0.0.1, then (intelligent) software will just turn that directly into an IP address and use it.
And there's no guarantee that your hosts file will actually be used for that resolution (first, or at all) so localhost may become a totally different IP address.

SSH - Connection reset by peer - Linux Host

I have a hosting account with Linux shared hosting account with GoDaddy, recently my ssh access stopped working, this is the error:
Toms-MacBook-Pro:production tom$ ssh tomheather50#192.186.452.73
ssh_exchange_identification: read: Connection reset by peer
This happens on my wifi connection however if I create a mobile phone hotspot and connect through my phone's 3g network I can successfully connect with no errors....
I have contacted GoDaddy support various times over the past 2 days and they have not been much help at all, simply put they have said I should just connect through the mobile network!!
After sending a traceroute to them I got this response.
We are tracking instances of connections dropping and being
intermittent through Level 3 and their IP 4.34.191.254. I noticed
that your connection that is having difficulty is being routed through
this path while the connection that did work is not routing through.
We are reaching out to Level 3 Communications to see if they can
identify and fix this situation. We are seeing more cases like yours
pop up from both Europe and the US. In the meantime I would recommend
using a connection that does not trace through Level 3 if at all
possible.
I'm not sure what means and it staggers me that GoDaddy can not ensure i can connect through my wifi connection !
Any advice, explanation and of course help would be great please guys.
The message indicates an internet connection issue in the Level3 network (i.e. somewhere in between your wifi network/internet provider and the godaddy site). Nothing that either you or godaddy can do to fix it, only Level3 can.
The suggestion is to use an alternate path, which happens when you use the 3G's network provider (instead of your internet provider). By chance I might add - the path between some 3G providers and godadday can still go through Level3's affected network.
Eventually Level3 will fix the issue (large providers usually do that pretty fast) and things will come back to normal.
It's always a good idea to have an alternate provider, your 3G one helped.
BTW: traceroute is the tool to check which path packets go through between your machine and the server you want to reach: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/traceroute.8.html
ssh_exchange_identification: read: Connection reset by peer
After lot of struggle, I fixed the ssh connection refused by simply running the following command.
sudo dhclient

Resources