이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Appendix A. Java IPv4 and IPv6 properties


You can use Java properties to configure IPv4 and IPv6 addresses. You can subsequently export these properties to Tomcat and use address values to specify Tomcat bindings.

A.1. Overview of Java IPv4 and IPv6 properties

Java provides two properties that you can use to configure IPv4 and IPv6 addresses:

java.net.preferIPv4Stack (default: false)
If IPv6 is available, the underlying native socket is an IPv6 socket by default. This socket enables applications to connect and accept connections from IPv4 and IPv6 hosts. If applications use IPv4 sockets only, set this property to true. However, applications that are using IPv4 sockets only cannot communicate with IPv6-only hosts.
java.net.preferIPv6Addresses (default: false)
If a host has both IPv4 and IPv6 addresses, and IPv6 is available, the default behavior is to use IPv4 addresses over IPv6. This allows backward compatibility. If applications depend on an IPv4 address representation, such as 192.168.1.1, set this property to true to change the preference, and use IPv6 addresses over IPv4 where possible.

A.2. Exporting Java IPv4 and IPv6 properties to Tomcat

You can export Java IPv4 and IPv6 properties to Tomcat by setting CATALINA_OPTS in the JWS_HOME/tomcat/bin/setenv.* file. On Red Hat Enterprise Linux, the setenv file has a .sh extension. On Microsoft Windows, the setenv file has a .bat extension.

Procedure

  1. If the JWS_HOME/tomcat/bin/setenv.* file does not exist, create the file.

    Note

    If you are using Red Hat Enterprise Linux, create a setenv.sh file. If you are using Microsoft Windows, create a setenv.bat file.

  2. To export Java IPv4 and IPv6 properties to Tomcat, perform either of the following steps:

    • If you are using Red Hat Enterprise Linux, enter the following command:

      export "CATALINA_OPTS=-Djava.net.preferIPv4Stack=YOUR_VALUE -Djava.net.preferIPv6Addresses=YOUR_VALUE"
      Copy to Clipboard Toggle word wrap
    • If you are using Microsoft Windows, enter the following command:

      set "CATALINA_OPTS=-Djava.net.preferIPv4Stack=YOUR_VALUE -Djava.net.preferIPv6Addresses=YOUR_VALUE"
      Copy to Clipboard Toggle word wrap

A.3. Configuring Tomcat bindings

You can configure Tomcat bindings in the JWS_HOME/tomcat/conf/server.xml file by specifying the IPv6 address.

Procedure

  1. Open the JWS_HOME/tomcat/conf/server.xml file.
  2. To specify the Tomcat binding address, enter the following details:

    <Server ... address="TOMCAT_BINDING_ADDRESS">
    Copy to Clipboard Toggle word wrap
  3. To specify the HTTP connector address, enter the following details:

    <Connector protocol="HTTP/1.1" ... address="HTTP_CONNECTOR_ADDRESS">
    Copy to Clipboard Toggle word wrap
  4. To specify the AJP connector address, enter the following details:

    <Connector protocol="AJP/1.3" ... address="AJP_CONNECTOR_ADDRESS">
    Copy to Clipboard Toggle word wrap
Note

Ensure that you replace TOMCAT_BINDING_ADDRESS, HTTP_CONNECTOR_ADDRESS, and AJP_CONNECTOR_ADDRESS with the correct IPv6 address.

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat