Ssh.net Conncetion timeout after 30000 milliseconds in Docker - docker

I am using Ssh.net nuget package in a .net core app to connect to remote Ubuntu servers on AWS.
I have dockerized my app and it works perfectly on local Windows envionment and a local ubuntu server.
Same docker image does not work if deployed on Aws Lightsail or other server providers like upcloud.com and vultr.com.
Below are the error details:
Connection failed to establish within 30000 milliseconds.
at Renci.SshNet.Abstractions.SocketAbstraction.Connect(IPEndPoint remoteEndpoint, TimeSpan connectTimeout) at Renci.SshNet.Session.SocketConnect(String host, Int32 port) at Renci.SshNet.Session.Connect() at Renci.SshNet.BaseClient.Connect()
I have tried turning off firewalls on all of the tested platforms but it doesn't make a difference.
Any ideas what I should do to resolve the issue?

Related

Cannot connect to local MQTT server (running on Windows 10) from docker instance

RabbitMQ server is running locally on Windows 10 and docker is running on it also.
I'm running a device simulator on docker and it has to talk to local RabbitMQ server through MQTT.
It had been working but one day it stopped.
Here is device logging -
mqtt-client.cpp:322 | Failed to connect to broker at 'xxx#xxx.xxxxxx.com/:1883': code=15, message='Lookup error.'
Keep in mind that from docker(latest version) calls have been made to local web server which has exact domain name -
https-commissioning-channel.cpp:81 | [HttpsCommissioningChannel] using token to contact bootstrap service at 'https://xxx.xxxxxx.com/apibst/alo/v1/bootstrap/device-info'
So you can see domain name has been resolved. For firewall configuration port is open on 1883 (consider it had been working). RabbitMQ is running.
What might be the issue and what should I do to make the call go through?
As per the comments xxx#xxx.xxxxxx.com/:1883 should not contain a slash (xxx#xxx.xxxxxx.com:1883) - see the URI Scheme.

Running infinispan in docker on windows 10

I am trying to run the infinispan docker image on a Windows 10 machine with docker desktop for windows.
I wrote a small test Java program that connects to localhost:11222 using hotrod and accesses a cache.
The problem is that after the initial connect the client receives from the server a new address 172.17.0.3:11222 and it fails connecting to this address because this is a docker internal one and
docker desktop for windows cannot route messages directly to an internal container address.
Is there any workaround available in infinispan or on the windows machine ?
The simplest solution is to disable the handling of topology updates in your Hot Rod client:
infinispan.client.hotrod.client_intelligence=BASIC
More information about client intelligence here.
Note that this is not recommended in production: the client will ignore new servers coming up and it will keep trying to contact the servers in the initial server list long after they stop.

Unable to connect to AWS RDS instance from docker container

On my Windows 10 host machine I am able to connect to a private SQL Server RDS instance running in AWS. However, a Docker container running locally on the same machine is unable to connect with the same connection string.
From the Docker container I am able to telnet to the server on 1433 successfully. However, when I connect from code, it seems to be unable to create a connection. No exception is thrown, but this code hangs:
using (var conn = new SqlConnection(connectionString)){
// Do something
}
I am able to successfully connect to SQL Server when it is running on a EC2 instance. It appears to be specific to RDS.
Fails with both the name and IP address.
This was caused by a bug in SQLClient as described on GitHub. There were two fixes that worked:
Downgrade the project from Net Core 3.1 to 2.2
Update Docker file to use aspnet:3.1-bionic instead of aspnet:3.1-buster-slim and sdk:3.1-bionic instead of sdk:3.1-buster

Unable to do DNS lookup in azure container instance - windows container

I am trying to connect to an sql server from my windows container. It all works fine when I spin up the container locally on my machine, or on an azure vm, and I can connect to the azure sql server but the connection fails when I deploy the container to azure container instance. The sql server firewall is open 0.0.0.0 to 255.255.255.255.
I believe that I have narrowed it down to a DNS issue because when I try to lookup the sql server or any host for that matter I get a "No such host is known".
There is a known 30 second startup delay but it still does not resolve after multiple retries.
IPHostEntry ipHostInfo = Dns.GetHostEntry("mysqlserver.database.windows.net");
IPAddress ipAddress = ipHostInfo.AddressList[0];
Console.WriteLine($"Ipaddress {ipAddress.MapToIPv4()}");
Further to my original question I have come up with two options to resolve this issue.
If you are working with a .netcore project then set build target to linux and deploy to a linux container/environment. The DNS lookup then works as it should.
If you are stuck with a non .netcore project then run a powershell script on the container bootstrap to force the container to use a public DNS such as Google (8.8.8.8).
$nic = Get-NetAdapter
Set-DnsClientServerAddress -InterfaceIndex $nic.IfIndex -ServerAddresses ('8.8.8.8')

Rails application can't reach remote PostgreSQL server (proxy, VirtualBox)

I have a Windows 7 PC with Forefront TMG proxy. There is a VirtualBox virtual machine installed with Ubuntu 16.04 (64-bit) guest OS. I'm not a seasoned Unix-user, so I tried to configure Ubuntu's network through GUI window.
After several tries I wound up with these settings:
https://i.stack.imgur.com/in4yR.jpg
All works fine now. I can use browser and git and do various network stuff. But!
I have a Rails application, which uses a remote PostgreSQL database. When I start my Rails server, it throws this exception:
Puma caught this error: could not connect to server: Network is unreachable
Is the server running on host "this_is_the_host_url" and accepting
TCP/IP connections on port 5432?
(PG:ConnectionBad)
This applications works fine on the other PC with similar Windows 7 and VB Ubuntu, but without a proxy. Also I tried to reach the remote DB-server from my host Win7 with PGAdmin - all works fine, even with proxy. The issue is somewhere between my Ubuntu guest OS and my Windows host OS.
Should I configure proxy settings in Ubuntu in a different way?
Any other way to resolve this issue?
Traceroute shows this:
1 10.0.2.2 (10.0.2.2) 0.638 ms 0.577 ms 0.549 ms
2 10.0.2.2 (10.0.2.2) 29.369 ms !N 53.000 ms !N 75.644 !N
As I can get it, 10.0.2.2 is my host OS ip.
I searched through the web, but all I could get belongs to the opposite side: to reach to the proxied VB Ubuntu, not from it.

Resources