How does one get tomcat to bind to ipv4 address?

Solution 1:

Many suggested updating startup script. Yes, that solution would work, but script is not meant to be customized/updated. All changes should go into the customization script instead, i.e.

NOTE: TOMCAT_HOME/bin/ doesn't exist by default, you need to create it. Check the script and you will see the startup script checks if exists, and executes if it does.

So, I suggest you create new TOMCAT_HOME/bin/ script with a single line:


Solution 2:

Ok I finally solved it. I was directed to try this and Henk's solution. Neither of which seemed to work with the remote virtual server. I'm guessing the fact that because I'm on a shared kernel space so the provider prevents this. In any case I added: JAVA_OPTS= $JAVA_OPTS to the startup script and that seemed to have fixed the issue of binding tomcat to ipv6.

Solution 3:

The correct syntax for modifying would be:


Solution 4:

If you used this installer: "Apache Solr for TYPO3", you can change the address in the file server.xml. The default points to localhost, so look for and change it into the IPv4-address you want. Don't forget to restart Tomcat6 for the changes to take effect.

UPDATE, 20120521

See my comment below on how to disable IPv6 on Ubuntu 11.10.

I have successfully tested this on a Virtualbox-VM on my Mac. The address for the connector port 8080 has been changed from to in server.xml.

Then disabling IPv6 makes the "tcp6" to go away, so it's binded to an IPv4-only address.

Before / with IPv6 enabled:

# netstat -anp | grep 8080   
tcp6       0      0 :::8080                 :::*                    LISTEN      1972/java

After / IPv6 disabled:

# netstat -anp | grep 8080   
tcp        0      0  *               LISTEN      2045/java