I run a Java application which provides on-line facilities. The application runs on an AWS EC2 instance under Ubuntu. There is an elastic IP and the external and private IPs reported by the AWS console are all stable. Front end access and certificates are working fine.
However, there is an issue relating to the IP address as detected by Java. The application licence process uses the IP address to generate a host id and I have found that the IP address obtained by the application licence process is unstable - it changes every 1 minute and this causes a licence mismatch as the licence is associated with an IP address.
Using the code below (provided by the application vendor) I have recorded the Java obtained IP addresses and they are nothing like the external or private IP addresses. I have discovered that they resolve to AWS servers (possibly DNS servers?) located in US West Coast and US East Coast. The instance is located in EU West.
import java.net.*;
class IPTest {
public static void main(String[] args) {
getIPAddresses();
}
public static void getIPAddresses() {
try {
InetAddress in = InetAddress.getLocalHost();
InetAddress[] all = InetAddress.getAllByName(in.getHostName());
for (int i = 0; i < all.length; i++) {
System.out.println(all[i].getHostAddress());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
I don't know if this is some kind of an AWS issue, DHCP issue, an application issue, or whether Tomcat has been incorrectly configured. I would really appreciate help with this one.
Aucun commentaire:
Enregistrer un commentaire