Connecting from host to virtual server fails with network unreachable from Java
-
25-09-2019 - |
Question
I have a server that has several virtual machines running on it. I'm trying to connect to one of these servers using Java, but it fails with "Network unreachable". The usecase is Hudson connecting to run a slave on a windows-machine. It works using python sockets, so it's quite odd.
This is the network configuration on the host machine http://dpaste.com/168704/ . The problem is reproduced using this snippet http://dpaste.com/168708/ .
Any ideas? I've only managed to reproduce this problem with java. ssh, ping, python and nc was tested as well and they work.
Edit: Seems that all outbound connections from java suffers the same fate from the host machine.
Solution
I was hit by this bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056 .
So works now with the quick fix :-)
OTHER TIPS
It's likely that the wrong address is being resolved for the host name. Add this debugging to your test:
InetSocketAddress saddr =
new InetSocketAddress("waltraction.dhcp.samfundet.no", 135);
InetAddress addr = saddr.getAddress();
if (addr == null) {
System.out.println("Unresolved address.");
else
System.out.println(addr.getHostAddress());
Simply seeing the address being used may point out a problem, but if not, update the question and get more help.