将JVM绑定到非默认IP [英] Binding JVM to An IP Other than Default

查看:119
本文介绍了将JVM绑定到非默认IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有多个NIC和IP的多宿主系统.

I have a multihomed system with multiple NICs and IPs.

我不确定100%我的Sun JVM如何选择代表此"系统的IP(即使用Socket或URLConnection连接到另一个系统时的"源IP ").它选择系统默认的NIC,还是对系统名称进行反向查找?等

I am not %100 sure how my Sun JVM chooses the IP representing 'this' system (that's the "source IP" when connecting to another system using Socket or URLConnection). Does it pick the system default NIC, or perhaps it does a reverse lookup on the system's name? etc.

无论如何,是否有办法将JVM明确绑定到特定IP?

In any case, is there a way to explicitly bind the JVM to a specific IP?

或者,如果有人从Axis Webservices框架中知道如何做到这一点,那将是非常有用的.

Alternatively, if anyone knows how to do that from Axis Webservices framework, that would be immensely helpful.

非常感谢.

推荐答案

这是由操作系统完成的,而不是由JVM完成的.它使用路由表来确定可以使用哪个接口路由到您尝试到达的目的地,并使用它.

It's done by the Operating System, not by JVM. It uses the routing table to determine which interface can route to the destination that you are trying to reach, and use it.

如果您有多个可以路由到给定目标的接口,理论上您应该可以选择要使用的源地址,但是我不知道您是否真的可以---也许在连接之前绑定做?但是,既然您将无法访问路由表,那么如何确定可以到达目的地的接口呢?

If you have multiple interfaces that can route to the given destination, in theory you should be able to choose which source address you'd use, but I don't know if you actually can --- perhaps bind before connect would do? But then, since you won't have access to the routing table, how do you decide what interfaces can reach to the destination?

这篇关于将JVM绑定到非默认IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆