Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tomcat is only listening with ip6 and not ip4

1,467 views
Skip to first unread message

Alan Chandler

unread,
Dec 20, 2009, 2:10:02 PM12/20/09
to
I have just upgraded my server from lenny to unstable and I now find a
tomcat application server backed has stopped working (front end on
another machine has the jk_mod installed and links through using ajp on
port 8009).

Using netstat --listening on the tomcat machine I find that tomcat is
only listening with the ip6 protocol and not ip4. Net result it has
stopped working.

I haven't changed anything during the upgrade, and I can't see anywhere
where it is defined what protocols tomcat is listening (at least there
doesn't appear to be anything in server.xml).

How can I fix this so that tomcat listens using ip4 and not ip6?

--
Alan Chandler
http://www.chandlerfamily.org.uk


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Alan Chandler

unread,
Dec 20, 2009, 3:10:01 PM12/20/09
to
Alan Chandler wrote:
> I have just upgraded my server from lenny to unstable and I now find a
> tomcat application server backed has stopped working (front end on
> another machine has the jk_mod installed and links through using ajp on
> port 8009).
>
> Using netstat --listening on the tomcat machine I find that tomcat is
> only listening with the ip6 protocol and not ip4. Net result it has
> stopped working.
>
> I haven't changed anything during the upgrade, and I can't see anywhere
> where it is defined what protocols tomcat is listening (at least there
> doesn't appear to be anything in server.xml).
>
> How can I fix this so that tomcat listens using ip4 and not ip6?
>


Netstat output

owl:/var/log/tomcat5.5# netstat --listening
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State
tcp 0 0 *:rsync *:* LISTEN
tcp 0 0 localhost:mysql *:* LISTEN
tcp 0 0 *:6543 *:* LISTEN
tcp 0 0 *:6544 *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 localhost:ipp *:* LISTEN
tcp 0 0 localhost:postgresql *:* LISTEN
tcp6 0 0 [::]:8009 [::]:* LISTEN
tcp6 0 0 [::]:rsync [::]:* LISTEN
tcp6 0 0 [::]:www [::]:* LISTEN
tcp6 0 0 [::]:auth [::]:* LISTEN
tcp6 0 0 [::]:8180 [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:ipp [::]:* LISTEN
tcp6 0 0 localhost:postgresql [::]:* LISTEN
tcp6 0 0 [::]:https [::]:* LISTEN
udp 0 0 *:mdns *:*
udp 0 0 255.255.255.255:1900 *:*

udp 0 0 239.255.255.250:1900 *:*

udp 0 0 *:ipp *:*

udp 0 0 *:ntp *:*

udp 0 0 *:33154 *:*

udp 0 0 *:6549 *:*

udp 0 0 *:323 *:*

udp 0 0 *:bootpc *:*

udp6 0 0 [::]:40262 [::]:*

udp6 0 0 [::]:mdns [::]:*

The strange thing here is that apache is listening only on the ip6 port
80, but it is seeing requests from my browser

Alexey Salmin

unread,
Dec 21, 2009, 3:00:02 AM12/21/09
to
I think it's related to discussion in debian-devel:

On Sun, Oct 25, 2009 at 12:24 AM, Marco d'Itri <m...@linux.it> wrote:
> I am proposing to set net.ipv6.bindv6only=1 by default for new
> installations, to simplify configuration and administration of systems
> using IPv6 and to make the system behaviour match the one of all other
> operating systems, which default to this or just do not provide a
> choice.
>
> When net.ipv6.bindv6only is set to 0, an application binding an
> AF_INET6 listening socket to "any" will receive on the same socket IPv4
> connections as well, with the endpoint addresses converted in the form
> ::ffff:1.2.3.4[1].
>
> When net.ipv6.bindv6only is set to 1, an application binding an
> AF_INET6 listening socket to "any" will only receive IPv6 connection and
> will need to create an AF_INET listening socket to receive IPv4
> connections.
>
> Applications can change the behaviour for their sockets using setsockopt
> and the IPV6_V6ONLY option[2], and many already do this to prevent the
> need of adjusting their configuration depending on how the system is
> configured.
>
> More information is also available in[3].
>
> While net.ipv6.bindv6only=0 is useful for daemons which are not designed
> to listen on multiple sockets, it is annoying because it requires
> dealing with IPv4-mapped addresses in logs and configuration files
> unless the program takes care to convert them to IPv4 addresses.
>
> I propose that netbase will create on new installations a file in
> /etc/sysctl.d/ containing net.ipv6.bindv6only=1.
>
>
>
> [1] http://en.wikipedia.org/wiki/IPv6#IPv4_mapped_addresses
>
> [2] http://tools.ietf.org/html/rfc3493#section-5.3
>
> [3] http://books.google.com/books?id=UuIqKlWVaKcC&lpg=PA118&ots=2XZWUqI0au&pg=PA118#v=onepage
>
> --
> ciao,
> Marco
>

Thus you should report a bug against Tomcat. Also you can replace
"net.ipv6.bindv6only=1" with "net.ipv6.bindv6only=0" in your
/etc/sysctl.d/ as a temporary solution.

Alan Chandler

unread,
Dec 21, 2009, 5:30:02 AM12/21/09
to
Alexey Salmin wrote:
> I think it's related to discussion in debian-devel:
...

>
> Thus you should report a bug against Tomcat. Also you can replace
> "net.ipv6.bindv6only=1" with "net.ipv6.bindv6only=0" in your
> /etc/sysctl.d/ as a temporary solution.

Thank you for this. I had actually heard from the Tomcat mailing list
that a work around was to specify address="0.0.0.0" in the connector
piece of server.xml, and I had done that

HOWEVER, I was having problems then with the application connecting to
the backend database. I could see that postgresql was listening on the
ipv4 ports so didn't think this was the issue. But when I changed the
net.ipv6.bindv6only to 0 my application magically worked again. My
thoughts are that there is some interaction with libcommons-dbcp-java,
so I think there might be a problem there.

0 new messages