One of the details in my Apache configuration which I had placed emphasis on, was that this Web-server is supposed to listen on all IPv4 as well as all IPv6 interfaces, on the host-machine I name ‘Phoenix’. And so in the configuration file ‘
/etc/apache2/ports.conf‘, I have set up so:
# If you just change the port or add more ports here, you will likely also # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default.conf Listen 80 <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
And, in the file ‘
sites-enabled/000-default.conf‘ I have stated:
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin firstname.lastname@example.org
But, when I run the command ‘
netstat‘, what that command seems to reveal is:
dirk@Phoenix:~$ netstat -l --tcp --numeric | grep 80 tcp6 0 0 :::80 :::* LISTEN dirk@Phoenix:~$ netstat -l --tcp --numeric | grep 443 tcp6 0 0 :::443 :::* LISTEN dirk@Phoenix:~$
What I expect to see, is instead:
dirk@Phoenix:~$ netstat -l --tcp --numeric | grep 80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp6 0 0 :::80 :::* LISTEN dirk@Phoenix:~$ netstat -l --tcp --numeric | grep 443 tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN tcp6 0 0 :::443 :::* LISTEN dirk@Phoenix:~$
Yet, contrarily to what catastrophic expectations might suggest, I find that my site is accessible to IPv4 addresses to begin with. Not only that, but I routinely use the internal, IPv4 loopback-address, and the URL:
To access my own blog. The surprising fact about this setup, is that it still works, and I could come up with some creative ideas, about why this has been working all along.
- The router could be forwarding all the IPv4 traffic from the WAN, to a LAN-specific IPv6 address belonging to my host-machine,
- The way the kernel works could be such, that if any server is listening on ‘
:::80‘, it is also automatically listening on ‘
My actual router settings only show my host as having an IPv4, LAN address.
I don’t understand it, but as long as this has not been creating any malfunctions, I’m not going to dig deeper into the subject for now. If indeed, my server was no longer listening on any IPv4 WAN addresses, I would have obtained notifications to that effect by now.
(Edit : )
This has just been confirmed as the standard behavior of Apache (to use just one socket), as described in this external BB posting.