JBoss7 configuration-Support for IPv4 and IPv6 Dual-stack Environments

Source: Internet
Author: User
Tags hostname to ip

JBoss7 configuration-Support for IPv4 and IPv6 Dual-stack Environments

Due to the needs of the lab project, the EJB 3.0 program is deployed in JBoss AS 7.1.1.Final, and IPv4 and IPv6 are required. However, the default configuration does not support IPv6. therefore, you can refer to the official JBoss Community Documentation document. In the 5.4.1 Interfaces and ports section, find the relevant introduction and modify the configuration of JBoss, enable the EJB 3.0 program in JBoss to run normally in IPv4 and IPv6 Dual-stack environments, including obtaining Remote interface objects from clients in IPv4 environments, call the remote object method to send and receive IPv6 udp packets. This article does not elaborate on the EJB program. It only describes how to configure JBoss to support IPv4 and IPv6 Dual-stack environments.

Article structure:

Part 1-instructions on IPv6 in official JBoss7.1 documents

Part 2-detailed description of JBoss configuration file modification in the project

--------------------------------------------------------------------------------

Linux Server JBoss running environment setup steps and Automatic startup script compilation and running

RHEL6.5 install OpenJDK1.7.0 + JBoss7.1.1 + Maven3.0.4

Integration of JBoss7.1 and Apache on Enterprise Java Application Server

Run JBoss later in Linux

--------------------------------------------------------------------------------

Part 1-instructions on IPv6 in official JBoss7.1 documents

5.4.1 Interfaces and ports

Interface declarations

Domain. xml, host. xml, and standalone. xml both contain part of the declared interface. When we look at these interface declarations in the XML file, we will find that there are two types of interface selection conditions (selection criteria): one is a separate XML element, the interface is bound to a wildcard address. The interface or address must have one or more feature values.

For example, the first step is to select an interface condition. Each interface has a specific IP Address:

<Interfaces>
<Interface name = "management">
<Inet-address value = "127.0.0.1"/>
</Interface>
<Interface name = "public">
<Inet-address value = "127.0.0.1"/>
</Interface>
</Interfaces>

The following is an example of using a wildcard:

<Interface name = "global">
<! -- Use the wildcard address -->
<Any-address/>
</Interface>

<Interface name = "ipv4-global">
<! -- Use the IPv4 wildcard address -->
<Any-ipv4-address/>
</Interface>

<Interface name = "ipv6-global">
<! -- Use the IPv6 wildcard address -->
<Any-ipv6-address/>
</Interface>

<Interface name = "external">
<Nic name = "eth0"/>
</Interface>

Socket Binding Groups

The socket configuration in JBoss AS 7 is similar to the interface declaration. Sockets uses a logical name for declaration and can be referenced throughout the configuration. Multiple Sockets declarations can be declared as a group with a specific name. In this way, you can easily reference a specific socket binding group When configuring a server group in the management domain. The Socket binding group uses the interface logical name to reference the interface:

<Socket-binding-group name = "standard-sockets" default-interface = "public">
<Socket-binding name = "jndi" port = "1099"/>
<Socket-binding name = "jmx-connector-registry" port = "1090"/>
<Socket-binding name = "jmx-connector-server" port = "1091"/>
<Socket-binding name = "http" port = "8080"/>
<Socket-binding name = "https" port = "8443"/>
<Socket-binding name = "jacorb" port = "3528" type = "codeph" text = "codeph"/>
<Socket-binding name = "jacorb-ssl" port = "3529"/>
<Socket-binding name = "osgi-http" port = "8090" type = "codeph" text = "codeph"/>
<Socket-binding name = "remoting" port = "4447"/>
<Socket-binding name = "txn-recovery-environment" port = "4712"/>
<Socket-binding name = "txn-status-manager" port = "4713"/>
<Socket-binding name = "messaging" port = "5445"/>
<Socket-binding name = "messaging-throughput" port = "5455"/>
</Socket-binding-group>

A socket binding contains the following information:
• Name-logical name of the socket configuration, which can be referenced anywhere else in the configuration.
• Port-the basic port to which the socket is bound in this configuration. (Note that the server can overwrite this configuration by adding or removing all port values .)
• Interface (optional)-logical name of the interface to be bound to the socket in the configuration (refer to the interface declaration above ). If this parameter is not specified, the default-interface attribute value in the socket binding group configuration element will be used.
• Multicast-address (optional) -- This multicast address is used if the socket is used for multicast.
• Multicast-port (optional)-This multicast port is used if the socket is used for multicast.
• Fixed-port (optional, default value: false)-if it is true, the port value will always use this value, which will not be overwritten by increasing or decreasing the port value.

IPv4 versus IPv6

JBoss AS7 supports the use of both IPv4 and IPv6 addresses. by default, AS7 is configured for use in an IPv4 network and so if you are running AS7 in an IPv4 network, no changes are required. if you need to run AS7 in an IPv6 network, the changes required are minimal and involve changing the JVM stack and address preferences, and adjusting any interface IP address values specified in the configuration (standalone. xml or domain. xml ).

Stack and address preference

The system properties java.net. preferstm4stack and java.net. preferIPv6Addresses are used to configure the JVM for use with IPv4 or IPv6 addresses. with AS7, in order to run using IPv4 addresses, we need to specify java.net. preferIPv4Stack = true; in order to run the AS7 with IPv6 addresses, we need to specify java.net. prefer12004stack = false (the JVM default) and java.net. preferIPv6Addresses = true. the latter ensures that any hostname to IP address conversions always return IPv6 address variants.

These system properties are conveniently set by the JAVA_OPTS environment variable, defined in the standalone. conf (or domain. conf) file. for example, to change the IP stack preference from its default of IPv4 to IPv6, edit the standalone. conf (or domain. conf) file and change its default IPv4 setting:

If ["x $ JAVA_OPTS" = "x"]; then
JAVA_OPTS = "... -Djava.net. preferIPv4Stack = true ..."
...

To an IPv6 suitable setting:

If ["x $ JAVA_OPTS" = "x"]; then
JAVA_OPTS = "... -Djava.net. prefer%4stack = false -Djava.net. prefer%6addresses = true ..."
...

IP address literals

To change the IP address literals referenced in standalone. xml (or domain. xml), first visit the interface declarations and ensure that valid IPv6 addresses are being used as interface values. for example, to change the default configuration in which the loopback interface is used as the primary interface, change from the IPv4 loopback address:

<Interfaces>
<Interface name = "management">
<Inet-address value = "$ {jboss. bind. address. management: 127.0.0.1}"/>
</Interface>
<Interface name = "public">
<Inet-address value = "$ {jboss. bind. address: 127.0.0.1}"/>
</Interface>
</Interfaces>

To the IPv6 loopback address:

<Interfaces>
<Interface name = "management">
<Inet-address value = "$ {jboss. bind. address. management: [: 1]}"/>
</Interface>
<Interface name = "public">
<Inet-address value = "$ {jboss. bind. address: [: 1]}"/>
</Interface>
</Interfaces>

Note that when embedding IPv6 address literals in the substitution expression, square brackets surrounding the IP address literal are used to avoid ambiguity. This follows the convention for the use of IPv6 literals in URLs.
Over and above making such changes for the interface definitions, you shoshould also check the rest of your configuration file and adjust IP address literals from IPv4 to IPv6 as required.

--------------------------------------------------------------------------------

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.