[CentOS] httpd listening only on IPv6 interface on CentOS 7

Thu Dec 11 03:48:18 UTC 2014
Warren Young <wyml at etr-usa.com>

I’ve held off reporting this since I thought it might just be some kind of fluke, but I’ve seen it now on three different boxes.

The symptom is that the stock configuration of Apache only listens for IPv6 connections:

  $ netstat -na | grep :80.*LISTEN
  tcp6       0      0 :::80                   :::*                    LISTEN    

You should see a second line there for IPv4, but you don't:

  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN    

The stock httpd.conf file just says “Listen 80” which is documented as listening on both IPv4 and IPv6. [1]  You’re supposed to need to go out of your way to get it to listen on just one or the other, but somehow CentOS 7’s Apache manages it.

Since I only need IPv4, I’ve managed to hack it into working by changing that line in /etc/httpd/conf/httpd.conf to:

  Listen 0.0.0.0:80

Why do I need to do this?



[1] https://httpd.apache.org/docs/2.4/mod/mpm_common.html#listen