Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

复杂网络环境下IP地址获取不准确的问题 #1

Closed
amao12580 opened this issue Sep 25, 2015 · 2 comments
Closed

复杂网络环境下IP地址获取不准确的问题 #1

amao12580 opened this issue Sep 25, 2015 · 2 comments
Labels

Comments

@amao12580
Copy link

问题发生位置
工程:elastic-job-core,类:com.dangdang.ddframe.job.internal.env.RealLocalHostService,方法:getLocalHost().
Uploading 1.jpg…

说明:对于一般性网络环境,代码段:InetAddress.getLocalHost();,可以正确的获取到本机的ip。
对于复杂的企业环境,企业网络管理员可能会进行部门子网、小组子网的划分,并最终链入企业主路由;
这样一台员工主机可能会有多个内网ip,代码段:InetAddress.getLocalHost();默认会返回当前主机链接到最近网络拓扑路径的路由所分配的子网ip。

综上,代码段:InetAddress.getLocalHost();得到的ip可能与实际链接到zookeeper的ip出现不一致。
可以想象的到,错误的将子网路由ip作为链接到zookeeper的ip,会导致同子网下,不同机器链接zookkeeper出现判断错误。

建议修改代码:https://github.com/amao12580/RSSReader/blob/master/core.base/src/main/java/per/rss/core/base/util/IPUtils.java

@amao12580 amao12580 changed the title 【一般性问题】关于企业复杂中IP无法正确定位的问题. 【一般性问题】关于企业复杂网络环境下,本机IP无法正确定位的问题. Sep 25, 2015
terrymanu added a commit that referenced this issue Sep 25, 2015
terrymanu added a commit that referenced this issue Sep 25, 2015
@terrymanu
Copy link
Member

fixed

@amao12580
Copy link
Author

已经完成bug回归测试,确认该问题已解决。
1

@terrymanu terrymanu changed the title 【一般性问题】关于企业复杂网络环境下,本机IP无法正确定位的问题. [BUG] 关于企业复杂网络环境下,本机IP无法正确定位的问题. Oct 29, 2015
@terrymanu terrymanu changed the title [BUG] 关于企业复杂网络环境下,本机IP无法正确定位的问题. [BUG] 复杂网络环境下IP地址获取不准确的问题 Mar 8, 2016
@terrymanu terrymanu changed the title [BUG] 复杂网络环境下IP地址获取不准确的问题 [Bug] 复杂网络环境下IP地址获取不准确的问题 Mar 8, 2016
@terrymanu terrymanu changed the title [Bug] 复杂网络环境下IP地址获取不准确的问题 复杂网络环境下IP地址获取不准确的问题 Jul 12, 2016
@terrymanu terrymanu added the bug label Jul 12, 2016
haocao pushed a commit that referenced this issue Feb 17, 2017
terrymanu pushed a commit that referenced this issue Jun 30, 2017
Merge code from origin repository
yu199195 pushed a commit that referenced this issue Jul 8, 2020
pull last code from  origin branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants