IPv6 addresses have their own formatting system because they represent an 128-bit addressing space: that's 16 octets, which would be extremely unwieldly! As well, at this time there are a lot of runs of embedded zeroes, so it's handy to be able to compress those out. To indicate that octets aren't being used, a colon is used instead of a period; as well, hexadecimal digits are used instead of decimal.
An IPv6 address looks like the following:
netmask works the same as IPv4, except that it can go up to 128.
%int is required for scoped addresses, which are not global addresses and only have meaning inside a local network, and specifies which network interface owns the address as two interfaces may have the same address.
Leading zeroes are allowed to be omitted, and a single run of zeroes in an address (the longest one, by convention) can be compressed by using
Leading zeroes removed:
Longest run of zeroes compressed:
There are some special cases:
Any address that starts completely with zeroes can be compressed to
::, then the non-zero portion (
IPv4-compatible and IPv4-mapped IPv6 addresses look like
/etc/hosts usage, almost nothing changes between IPv4 and IPv6 addresses: you won't have to worry about the network mask, and almost certainly won't have to worry about scoped addresses or IPv4-compatible addresses. Just follow the zero-compression rules and you should usually be fine. If you have a dual-homed address (where a host listens to both IPv4 and IPv6), you will have to enter it twice, once for the IPv4 address and once for the IPv6 address:
2001:db8:123:456::78 example.com www.example.com
192.0.2.56 example.com www.example.com
I won't discuss network masks and ranges, but if you want a reference to the standard ranges, RIPE produced a PDF with them if you would like a quick overview of them.