[
https://issues.apache.org/jira/browse/WHIRR-730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13690331#comment-13690331
]
Steve Loughran commented on WHIRR-730:
--------------------------------------
I don't know about " illegal for an application to get the client ip address"
through an external web site -that's what AWS provide it for. More relevant is
is "of limited value in an Intranet, proxy-or-not, because you'll get the
external firewall IPAddr, not anything internal.
However, before rushing to swap over to {{getLocalHost()}},
# On a multihome device you may get one of the hostnames seemingly at random.
That may be precisely what you don't want on public cloud infrastructures.
# You need to add handlers for the situation where the machine doesn't know its
own hostname or IP address.
For issue #2, Hadoop's NetUtil package provides the (robust) methods needed
> Use the InetAddress.getLocalHost() instead of
> URL("http://checkip.amazonaws.com/") to get the local address
> -----------------------------------------------------------------------------------------------------------
>
> Key: WHIRR-730
> URL: https://issues.apache.org/jira/browse/WHIRR-730
> Project: Whirr
> Issue Type: Improvement
> Components: core
> Affects Versions: 0.8.2
> Environment: Unbuntu, Openstack
> Reporter: Jeremy Lv
> Fix For: 0.9.0
>
> Attachments: FirewallManager.java.patch
>
>
> Hi,all
> I have found the FirewallManager.getOriginatingIp() use the following method
> to get the ip address
> {code:title=FirewallManager.java|borderStyle=solid}
> /**
> * @return the IP address of the client on which this code is running.
> * @throws IOException
> */
> private String getOriginatingIp() throws IOException {
> if ("stub".equals(clusterSpec.getProvider())) {
> return "62.217.232.123";
> }
> URL url = new URL("http://checkip.amazonaws.com/");
> HttpURLConnection connection = (HttpURLConnection) url.openConnection();
> connection.connect();
> return IOUtils.toString(connection.getInputStream()).trim() + "/32";
> }
> {code}
> I think we should use the InetAddress.getLocalHost() to get the ipaddress,
> here's some of my reason:
> 1). I think it is illegal for an application to get the client ip address
> throght the erternal website, what else if the amazon is broken and we can
> access the http://checkip.amazonaws.com/ or if the situation of the internet
> can't worked well, it will be failed to launch the cluster because we can't
> connect to the http://checkip.amazonaws.com/.
> 2). If any of the private company want to reuse the whirr project to create
> the cluster, Some of the company need to use the proxy to access the external
> website, Although the whirr project support to config the proxy, but it is
> still complicated for us to apply for the IT Department to authorize the
> proxy for the VM we have created by the whirr.
> 3). I think it is simple to use the InetAddress.getLocalHost() to get the
> local ip address
> Thanks
> -Jeremy Lv
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira