Problem using Java inetAddress.isReachable with AWS EC2

There is a simple code on Java 8 which just check if the host is reachable

InetAddress inetAddress = InetAddress.getByAddress(ipBytes);
return inetAddress.isReachable(timeOutMS) ? "UP" : "DOWN";

There are two different ip addresses (lets say 1.1.1.1 and 2.2.2.2) which both are reachable from the Internet (e.g. https://ping.eu/ping/)

When I run this code on virtual hosting - both addresses are reachable when I ping them or run the code as jar.

But with AWS EC2 there is a trouble: I run AWS EC2 instance and checked ping 1.1.1.1 and 2.2.2.2 - both pinged well. But when I run the jar the code above shows that address 1.1.1.1 is reachable but 2.2.2.2 is NOT reachable.

What could be the problem ?

Upvotes: 0

Views: 79

Answers (0)

Related Questions