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

Thu Dec 11 10:10:19 UTC 2014
Alexander Dalloz <ad+lists at uni-x.org>

Am 11.12.2014 um 04:48 schrieb Warren Young:
> 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

No, that's just the way it is displayed for apache. In fact the service 
listens on IPv4 as well (given we speak about the default configuration 
with `Listen 80').

Easy to verify.

> 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


Alexander