I have an Apache httpd web server and like to monitor my website's access_log files. I've noticed that I only ever see IPv4 addresses there. My personal computer has an IPv6 address, but this never shows in my access_log, it is always changed into an IPv4 address somehow. Why is that? Is there a way to change that?
1 Answer
As @dan hinted, your problem is probably not related to logging, as Apache would cheerfully also log IPv6 addresses... if someone connects to it over IPv6.
So you will first need to double check that your server is indeed listening on an IPv6 and is reachable from outside.
For that, you may need the Listen
directive.
Try locally by going to http://[::1]/
, this is the IPv6 localhost, the server itself. Or use the server public IPv6 address. If you do not get a reply at all this means your Apache is not listening on this IP address. But if it does, you should see the IPv6 address in the logfiles.
-
This doesn't appear to be true. Apache by default does NOT log ipv6 addresses as they come through as something like
207.206.229.0
where the last number is always 0. I haven't found the solution yet, but it will not log them by default.– AlanCommented Aug 7, 2018 at 20:11 -
@Alan It certainly does. Even if it did only IPv4 as you say, it logs the true client IP, not forcing any kind of
0
as last byte. What you describe does look like a lot about a (bad) privacy/obfuscation tool resulting in that. You do not even say which Apache logfile you look at; and the relevant configuration. Commented Aug 11, 2018 at 6:29
ipconfig
on Windows orifconfig
on Linux, you'll likely see that your computer/server/router is assigned both an IPv6 and IPv4 address (for a router, you'll need to check the admin "connections" or "status" page). In your config file, you need to bind theListen
port (usually 80) to your IPv6 address, for example:Listen [2001:db8::a00:20ff:fea7:ccea]:80
.