Microsoft azure ssh connection to VM keeps dropping - azure

I am connecting to virtual machine (ubuntu 14.04) hosted on Microsoft Azure using ssh. My problem is that my connection drops every couple minutes (same period) and I need to reconnect. This is not related to internet connection because it doesn't drop. I tried logging from different pc's, it's all the same.

Sometimes this is caused by inactivity: see http://www.cyberciti.biz/tips/open-ssh-server-connection-drops-out-after-few-or-n-minutes-of-inactivity.html
To summarize, an ssh connection is sometimes dropped after a few minutes.
From the OpenSSH man page:
This is usually the result of a packet filter or NAT device timing out your TCP connection due to inactivity. For security, reason most enterprises only use SSH protocol version 2. This problem only occurred with version 2.
You can try following the instructions in that article.

Related

How to connect to an integrated VM without using SSH tunelling

I want to connect to a locked (cannot be modified and I do not have permissions to log into) windows vm which is hosted in a linux machine. Until now these two machines were communicating via port 2277. However for security reasons, the port 2277 is only accessible via localhost (127.0.0.1).
The original proposed solution was to use ssh-tunneling. However since the hosted windows vm will always stay with the linux machine, so I was thinking something simpler.
This Windows virtual machine has ip 192.168.0.1 and the default gateway is 192.168.0.2. The later is the ip address that my linux machine can see.
After searching the internet I tried
socat TCP4:192.168.0.1:2277,reuseaddr,fork TCP4:127.0.0.1:2277
as well as some other random combinations without success.
My understanding is that this failed because for socat to work both sockets must be open.
However the first one is not open by default (checked with ss -ltn) as I need to run the windows service first (which it cannot run as it cannot communicate with iphost:2277)
Any ideas on how to proceed?
Socat provides the retry=N and forever options to handle situations like this. Thus, try something like this:
socat -d -d TCP4:192.168.0.1:2277,reuseaddr,fork,forever TCP4:127.0.0.1:2277
With the interval=<seconds> option you can specify how long Socat waits after each failed attempt.
It turns out that the command that I wanted was the following
socat tcp-listen:2277,bind=192.168.0.1,fork,reuseaddr tcp:127.0.0.1:2277
The retry=N and forever options could be also useful.

Debian 7: connection problems and timeouts

On my root server, debian 7 is the operation system. Running kernel is 2.6.32.
I have the problem, that TCP/IP-connections seems to be "unstable".
ssh connections often hang or timeout. Webserver sometimes runs fast, sometimes the client (browser) is waiting and waiting for a response.
I dont know where to start right now for this problems. I made a hardware check requests at my ISP ticket system.
Is there a hint you can give me?
I would guess it is DNS related. I would isolate one destination to communicate to, and one location to communicate from. Using ping, I would determine if there was latency in the link itself (ping from the server to one destination and from your client workstation to the troubled server). Once you determine that times are predictable (no **'s)I would learn both IP addresses and put them in /etc/hosts.
When you run ssh I would consider using -vv to see what it is doing and maybe that will help.
The problem was a broken network adapter in the mainframe of the cluster. The provided fixed the issue.

Connections Timeout to VM Linux

We have 6 VM ubuntu linux in AZURE yesterday and the day 6 server lost connection , and generate Timeout error when connecting via SSH , the strange thing is that only happened with linux servers with windows servers did not happen , know that this occurred .
My Linux servers seem to be down more than up../ and I can't reach them to get it up lol I think their cpu throttling and firewall / loadblallancer sucks

oracle thin jdbc connection receiving "connection reset" after inactivity

I have a new tomcat application server running on tomcat 6, java 6 (openjdk), centos 6.2. The server is a virtual machine running under qemu-kvm on a centos 6.2 host. Both host and guest are 64-bit.
I have a case where a connection is opened, (from a connection pool) then a "long computation" occurs for about 4 hours, during which the connection is not used. Finally, a "commit" is issued, and the server gives a "connection reset" exception, specifically:
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:185)
at oracle.net.ns.Packet.receive(Packet.java:282)
at oracle.net.ns.DataPacket.receive(DataPacket.java:103)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:230)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:122)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:78)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1179)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1155)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:279)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
at oracle.jdbc.driver.T4C7Ocommoncall.doOCOMMIT(T4C7Ocommoncall.java:75)
at oracle.jdbc.driver.T4CConnection.doCommit(T4CConnection.java:558)
The database server and the client are on the same subnet, except the server is a real physical host, and obviously the app-server is a guest running inside a physical machine on the same subnet.
The host used "bridged" networking.
This may not be a software problem at all but rather a linux os configuration (iptables?) issue, but I really don't know.
I have run into this a couple of times. Almost always caused by a network timeout (load balancer or firewall). But you have clearly mentioned that your servers are on the same subnet, so not really sure what is going on. Since you suspect iptables, can you turn it off, run the test and see if it works (too easy huh :)
Regardless, assuming you are connecting to an Oracle db, the following tweak helps
http://raibledesigns.com/rd/entry/tomcat_oracle_connectivity_problems
If you use a different db (say mysql) the setting might be different but the logic is the same. Setup a keepalive value to prevent the connection from being idle for too long. This way the firewal/load balancer/iptables software will not terminate it.
As you can see in this post in Oracle Forums, this can have more than one problem / solution.
Check if your JDBC driver version is correct
Check your ORACLE_HOME environment variable
try add the argument -Djava.security.egd=file:///dev/urandom
Your logic use a singleton to get the connection? In the post this are mentioned too
Hope this helps you.
#user is referring to a good workaround, by configuring "SQLNET.EXPIRE_TIME=10" in sqlnet.ora.
However, this workaround is only applicable if your application is using thick OCI (jdbc:oci), not thin (jdbc:thin) driver.
Linux has software firewall, i.e. iptables, which can drop idle network connection, so even you are in the same subnet, you have iptables software firewall. This is activated by default in all modern Linux, and up to Linux administrator to disable it.
By default, Linux iptables does not drop idle TCP/IP connections (jdbc belongs to TCP/IP protocol), so the Linux administrator must configured iptables to do so. Following is the detail explanation for any reader who are interested to know more:
http://www.digitage.co.uk/digitage/software/linux-security/cutter
Business users, security team, or architect often suggest network/OS admin to abort idle connection using firewall, as well as router. This is always a "recommendation" in the anti-hacking community, but it is not properly discussed, and causing application instability. Eventually, you should discuss with the team to find a balance

andlinux slirp network failed

I have installed andlinux Beta 2 on my WinXP. Everything works fine until last night, I don't recall that I ever changed anything on network configuration or andlinux setup, the network stop working inside andlinux. With that said, I mean open a KDE console, I do "ping yahoo.com", I see DNS is resolved correctly, however, no response at all.
My andlinux is startup as a WinXP service. Open windows task manager I can see following services are up and running:colinux-daemon.exe colinux-net-daemon.exe colinux-slirp-net-daemon.exe
On andlinux side, there are two network interface eth0 and eth1. eth1 is configured to communicate with local WinXP. I configured it to use samba to access windows directories, no problem. From WinXP side, I can use ssh to login into andlinux box via eth1 IP address.
eth0 is configured as slirp, no port forwarding. eth0 has IP=10.0.2.15, default gateway is 10.0.2.2, netmask=255.255.255.0; These are configured in /etc/network/interfaces. DNS is 10.0.2.3, which as I just mentioned resolve yahoo.com correctly.
On the windows side, internet works fine. I disabled firewall on all network interface. I rebooted my laptop, no luck. I searched over inet, seem no one has this problem. People say network is done if they kill the colinux-slirp-net-daemon. What frustrated me is that this whole thing worked well, but for no reason it's broken all the sudden. Anyone has experience on this issue, please help, appreciate!
I thought I had the same problem, but then found my andLinux system's network connectivity was actually working fine, and that several things made it difficult to tell what was going on.
Test I did to validate connectivity: wget www.yahoo.com
Behavior I observed that made troubleshooting difficult:
Pings from andLinux - not all hosts will respond to pings from the andLinux OS (ie Ubuntu, not the Host Windows OS). According to my packet captures the pings appear as UDP pings instead of ICMP pings once they leave the host OS's adapter. The major IPs/hosts (like yahoo, google, 4.2.2.2 etc.) on the internet I usually ping to test connectivity currently don't respond to these type of pings.
Traceroutes from andLinux - even when successful, these never show more than 2 hops when done from the andLinux OS. If successful, both hops show 10.0.2.2. If unsuccessful, the second hop just times out. Not sure why, I'm sure there is an explanation.
Packet captures - at the host OS level, the capture (eg wireshark) must be done on the physical interface the traffic is going over. I was initially capturing on the TAP-Win32 Adapter but this only showed X Window traffic.
Installed apt sources URLs no longer valid - Ubuntu 9.04 is long out of support by now, so the URLs in the apt sources.list file didn't exist anymore. This is what got me thrown off in the first place, because I didn't troubleshoot this specifically and just tried to test my internet connectivity first, then got confused by the ping and traceroute behavior seen above. Changed http://us.archive.ubuntu.com/ubuntu to http://old-releases.ubuntu.com/ubuntu/ in sources.list and was good to go.

Resources