Reputation: 487
I am using tomcat 8.x and my network is supporting both ipv4 and ipv6 addresses. However, I want tomcat to listen to only ipv6 address (not ipv4).
I was trying to find the solution on google and reached to tomcat's manual - http://library.bec.ac.in/docs/config/http.html. On this page, the address attribute description says ------->
For servers with more than one IP address, this attribute specifies which address will be used for listening on the specified port. By default, the connector will listen all local addresses. Unless the JVM is configured otherwise using system properties, the Java based connectors (NIO, NIO2) will listen on both IPv4 and IPv6 addresses when configured with either 0.0.0.0 or ::. The APR/native connector will only listen on IPv4 addresses if configured with 0.0.0.0 and will listen on IPv6 addresses (and optionally IPv4 addresses depending on the setting of ipv6onlyv6) if configured with ::.
According to above description, with the use of ipv6onlyv6, I can make tomcat to listen to only ipv6 address, but description is not giving proper example about how to use that property in server.xml.
I tried below combinations of property ipv6onlyv6 in server.xml but none of them are working ----
Combination [1] --
address="::"
ipv6onlyv6="true"
[2] combination ---
address="ipv6onlyv6"
Please help. Thanks in advance. Also it would be great if somebody knows the ways to do this in tomcat 6.x as few of our applications are using tomcat 6.x
...Rahul
Upvotes: 1
Views: 1622
Reputation: 487
to use ipv6v6 only, I had to perform following steps --
[1] ipv6v6only uses apr libraries, so include apr libraries in tomcat
[2] There is a listener tag in server.xml of tomcat which will load the apr libraries, include useAprConnector="true", in that
<!--APR library loader. Documentation at /docs/apr.html -->
[3] use below configuration in desired connector stanza
address="::" ipv6v6only="true"
complete connector tag example --
<Connector port="8080"
connectionTimeout="20000"
compression="on"
compressionMinSize="10240"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/x-javascript,application/javascript,application/json,application/xml,application/xhtml+xml,application/xslt+xml"
URIEncoding="UTF-8" address="::" ipv6v6only="true" protocol=“org.apache.coyote.http11.Http11AprProtocol” />
Please note that the correct name of the attribute is - ipv6v6only, not ipv6onlyv6 (both of these are mentioned in tomcat manual, by mistake)
Upvotes: 0