users@glassfish.java.net

Binding Glassfish v2 to multiple network devices in linux.

From: <glassfish_at_javadesktop.org>
Date: Sat, 28 Feb 2009 14:11:21 PST

I'm trying to bind my (linux) Glassfish install to multiple network devices and I'm having a bit of trouble. I've done a fresh setup of a domain with all the default settings.

I have the following networking set up on my linux install:

[code]eth0 192.168.80.60
eth0:1 192.168.80.61
eth0:2 192.168.80.62
eth0:3 192.168.80.63[/code]

I have the following in my /etc/hosts file:

[code]127.0.0.1 localhost
192.168.80.60 glassfish.mydomain.com glassfish
192.168.80.61 one.glassfish.mydomain.com one
192.168.80.62 two.glassfish.mydomain.com two
192.168.80.63 three.glassfish.mydomain.com three[/code]

I have the following in /etc/hostname

[code]glassfish[/code]

I'm mainly interested in using this setup internally to simulate different network conditions. All of the host names resolve to the correct internal IPs on my network. I usually don't have a problem with the setup.

Using this setup I can navigate to the Glassfish admin interface via any of the listed IPs. Everything works as I'd expect when using one of the HTTP listeners. I'm struggling to get it working with an IIOP listener though. I've been watching the network traffic and I can see where the problem is occurring, but have no idea how to fix it.

As an example, if I connect to the server on:

[code]192.168.80.61:3700[/code]
with an application client the initial connection seems to be successful. However, part way through the communication everything will jump back to using:

[code]192.168.80.60:3700[/code]

I've tried several alternative configurations with no success. When I add an IIOP listener for each interface...

[code]Name Enabled Network Address Listener Port
SSL true 0.0.0.0 3820
orb-listener-0 true glassfish.mydomain.com 3700
orb-listener-1 true one.glassfish.mydomain.com 3700
orb-listener-2 true two.glassfish.mydomain.com 3700
orb-listener-3 true three.glassfish.mydomain.com 3700
SSL_MUTUALAUTH true 0.0.0.0 3920[/code]
I get a:

[code]java.net.BindException: Address already in use[/code]
exception when trying to start the server. Glassfish must be trying to bind to eth0 for both listeners even though:

[code]glassfish.mydomain.com == 192.168.80.60 == eth0[/code][code]one.glassfish.mydomain.com == 192.168.80.61 == eth0:1[/code]

The other thing I attempted was to bind each address to a different port:

[code]Name Enabled Network Address Listener Port
SSL true 0.0.0.0 3820
orb-listener-0 true glassfish.mydomain.com 3700
orb-listener-1 true one.glassfish.mydomain.com 3701
orb-listener-2 true two.glassfish.mydomain.com 3702
orb-listener-3 true three.glassfish.mydomain.com 3703
SSL_MUTUALAUTH true 0.0.0.0 3920[/code]

For some reason, when I do this, only one of the addresses will work. It seems to be the connection using the [b]last[/b] network interface alias (eth0:3), but I haven't tested it thouroughly. It could be the last IIOP listener added since I did them in order.

With this setup attempting to connect on any of the other interfaces results in the server sending back a bunch of:

[code]RST, ACK[/code]
packets.

All of the traffic is limited to a single subnet, so, as far as I understand things, there shouldn't be any kind of a routing issue. There's no gateway involved, so the traffic flow is very simple.

Does anyone have any suggestions? I've tried everything I can think of.
[Message sent by forum member 'ryan6608' (ryan6608)]

http://forums.java.net/jive/thread.jspa?messageID=334428