This post is older than a year. Consider some information might not be accurate anymore.
Having multiple Network Interfaces (NICs) is especially at enterprise level servers very common. Having four network interfaces (bond0,..,bond0-2) the JBoss instance could bind to any interface. JBoss can be configured to bind to the subnet mask.
Some information if you list the network interfaces:
jboss@preprod:~/bin> ifconfig
bond0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.100.124 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2820418014 errors:0 dropped:0 overruns:0 frame:0
TX packets:2069442589 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:668733119792 (622.8 GiB) TX bytes:1456413441469 (1.3 TiB)
bond0:0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.100.29 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
bond0:1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.100.48 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
bond0:2 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.100.64 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:2212607915 errors:0 dropped:0 overruns:0 frame:0
TX packets:2069442567 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:632014707017 (588.6 GiB) TX bytes:1456413439315 (1.3 TiB)
Memory:92d20000-92d40000
eth1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:607810099 errors:0 dropped:0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:36718412775 (34.1 GiB) TX bytes:2154 (2.1 KiB)
Memory:92d60000-92d80000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:266325455 errors:0 dropped:0 overruns:0 frame:0
TX packets:266325455 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:59682164938 (55.5 GiB) TX bytes:59682164938 (55.5 GiB)
We have two physical network devices and four logical network devices. Login into the running JBoss instance with the CLI. I have written the command in a script.
jboss@preprod:~/bin> ./jboss-cli.sh
The basic part is to create a new interface, with a subnet-mask.
[standalone@preprod:12399 /] /interface=external:add(subnet-match="192.168.100.0/16")
{"outcome" => "success"}
Next step is to assign the new interface to your existing socket binding.
[standalone@preprod:12399 /] /socket-binding-group=standard-sockets:write-attribute(name=default-interface, value=external) {
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
A restart is not necessary, but a reload is required to apply the changes.
[standalone@preprod:12399 /] reload
[standalone@preprod:12399 /] exit
This will result in following log output message.
JBAS014621: Multiple addresses or network interfaces matched the selection criteria for interface 'external'.
Matching addresses: [/192.168.100.124, /192.168.100.29, /192.168.100.48, /192.168.100.64].
Matching network interfaces: [bond0, bond0:0, bond0:1, bond0:2].
The interface will use address /192.168.100.124 and network interface bond0.