One address, many forms
An IPv4 address such as 192.168.1.1 is really a single 32-bit number, 3232235777, written in four parts. Databases, firewalls and programming code often store or expect it in another form: as a whole number, in hexadecimal or binary, or wrapped in IPv6 as ::ffff:192.168.1.1. IPv6 addresses can be written in a long full form or shortened with ::.
What you get
- Decimal, hexadecimal and binary versions of an IPv4 address.
- IPv4-mapped IPv6 (::ffff:…), as servers show IPv4 visitors on IPv6 sockets.
- Expanded and compressed IPv6, following the RFC 5952 rules for the short form.
- The reverse DNS name (in-addr.arpa or ip6.arpa) used to look up the host name of an address.
Frequently asked questions
How do I convert an IP address to a number?
Multiply the first part by 16,777,216, the second by 65,536, the third by 256, and add them to the fourth. 192.168.1.1 becomes 3,232,235,777.
Why does my server log show ::ffff: before IPv4 addresses?
The server listens on IPv6 and represents IPv4 visitors as IPv4-mapped IPv6 addresses. The part after ::ffff: is the normal IPv4 address.
Can every IPv4 address be written as IPv6?
Yes, as an IPv4-mapped address. The reverse is not true: IPv6 has vastly more addresses than IPv4.