IPv6 Syntax Specialities

Introduction

IPv6 is not really news, but unfortunately not all configuration files or options expect the same syntax.

The following config snippets should help a bit.

Prefix over Netmask

An IPv6 address can be quite long to write, unless it contains a high number of suppressable 0 nibbles.

IPv6 netmasks would start with many 'f's nobody wants to count, like ffff:ffff:ffff:ffff::.

Therefore the length of the network part of an IPv6 address can only be specified as prefix, i.e. /16 (large provider ranges), /32 (medium provider ranges), /64 (typically customer subnets).

Common syntax to specify an IPv6 address and a port number

For IPv4, a colon (:) separates the IP address and the port, like this: 127.0.0.1:80

In IPv6 the colon is integral part of the syntax for IP addresses, and the support for shortening addresses using :: makes the number of colons variable, so counting colons won't help to detect the port-separator reliably, especially where the port part is optional (like common for specifying the adress and port on which a daemon shall listen).

In the config files of most applications, i.e. Apache 2.x, the solution is to put the square brackets around the IPv6 address, like this counterpart to above's IPv4 example: [::1]:80

Applications diverting from common syntaxes

TCPWrapper

In TCPWrapper's files /etc/hosts.allow and /etc/hosts.deny requires square brackets around the IPv6 network despite '/' would be a clear separator.

Example: [2001:1234:4321:abcd::]/64