1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 4<html> 5 6<head> 7 8<title>Postfix IPv6 Support</title> 9 10<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> 11 12</head> 13 14<body> 15 16<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix 17IPv6 Support</h1> 18 19<hr> 20 21<h2>Introduction</h2> 22 23<p> Postfix 2.2 introduces support for the IPv6 (IP version 6) 24protocol. IPv6 support for older Postfix versions was available as 25an add-on patch. The section "<a href="#compat">Compatibility with 26Postfix <2.2 IPv6 support</a>" below discusses the differences 27between these implementations. </p> 28 29<p> The main feature of interest is that IPv6 uses 128-bit IP 30addresses instead of the 32-bit addresses used by IPv4. It can 31therefore accommodate a much larger number of hosts and networks 32without ugly kluges such as NAT. A side benefit of the much larger 33address space is that it makes random network scanning impractical. 34</p> 35 36<p> Postfix uses the same SMTP protocol over IPv6 as it already 37uses over the older IPv4 network, and does AAAA record lookups in 38the DNS in addition to the older A records. Information about IPv6 39can be found at http://www.ipv6.org/. </p> 40 41<p> This document provides information on the following topics: 42</p> 43 44<ul> 45 46<li><a href="#platforms">Supported platforms</a> 47 48<li><a href="#configuration">Configuration</a> 49 50<li><a href="#limitations">Known limitations</a> 51 52<li><a href="#compat">Compatibility with Postfix <2.2 IPv6 support</a> 53 54<li><a href="#porting">IPv6 Support for unsupported platforms</a> 55 56<li><a href="#credits">Credits</a> 57 58</ul> 59 60<h2><a name="platforms">Supported Platforms</a></h2> 61 62<p> Postfix version 2.2 supports IPv4 and IPv6 on the following 63platforms: </p> 64 65<ul> 66 67<li> AIX 5.1+ 68<li> Darwin 7.3+ 69<li> FreeBSD 4+ 70<li> Linux 2.4+ 71<li> NetBSD 1.5+ 72<li> OpenBSD 2+ 73<li> Solaris 8+ 74<li> Tru64Unix V5.1+ 75 76</ul> 77 78<p> On other platforms Postfix will simply use IPv4 as it has always 79done. </p> 80 81<p> See <a href="#porting">below</a> for tips how to port Postfix 82IPv6 support to other environments. </p> 83 84<h2><a name="configuration">Configuration</a></h2> 85 86<p> Postfix IPv6 support introduces two new main.cf configuration 87parameters, and introduces an important change in address syntax 88notation in match lists such as mynetworks or 89debug_peer_list. </p> 90 91<p> Postfix IPv6 address syntax is a little tricky, because there 92are a few places where you must enclose an IPv6 address inside 93"<tt>[]</tt>" characters, and a few places where you must not. It is 94a good idea to use "<tt>[]</tt>" only in the few places where you 95have to. Check out the postconf(5) manual whenever you do IPv6 96related configuration work with Postfix. </p> 97 98<ul> 99 100<li> <p> Instead of hard-coding 127.0.0.1 and ::1 loopback addresses 101in master.cf, specify "inet_interfaces = loopback-only" in main.cf. 102This way you can use the same master.cf file regardless of whether 103or not Postfix will run on an IPv6-enabled system. </p> 104 105<li> <p> The first new parameter is called inet_protocols. This 106specifies what protocols Postfix will use when it makes or accepts 107network connections, and also controls what DNS lookups Postfix 108will use when it makes network connections. </p> 109 110<blockquote> 111<pre> 112/etc/postfix/main.cf: 113 # You must stop/start Postfix after changing this parameter. 114 inet_protocols = ipv4 (DEFAULT: enable IPv4 only) 115 inet_protocols = all (enable IPv4, and IPv6 if supported) 116 inet_protocols = ipv4, ipv6 (enable both IPv4 and IPv6) 117 inet_protocols = ipv6 (enable IPv6 only) 118</pre> 119</blockquote> 120 121<p> By default, Postfix uses IPv4 only, because most systems aren't 122attached to an IPv6 network. </p> 123 124<ul> 125 126<li> <p> On systems with combined IPv4/IPv6 stacks, attempts to 127deliver mail via IPv6 would always fail with "network unreachable", 128and those attempts would only slow down Postfix. </p> 129 130<li> <p> Linux kernels don't even load IPv6 protocol support by 131default. Any attempt to use it would fail immediately. </p> 132 133</ul> 134 135<p> Note 1: you must stop and start Postfix after changing the 136inet_protocols configuration parameter. </p> 137 138<p> Note 2: if you see error messages like the following, then 139you're running Linux and need to turn on IPv6 in the kernel: see 140http://www.ipv6.org/ for hints and tips. Unlike other systems, 141Linux does not have a combined stack for IPv4 and IPv6, and IPv6 142protocol support is not loaded by default. </p> 143 144<blockquote> 145<pre> 146postconf: warning: inet_protocols: IPv6 support is disabled: Address family not supported by protocol 147postconf: warning: inet_protocols: configuring for IPv4 support only 148</pre> 149</blockquote> 150 151<p> Note 3: on older Linux and Solaris systems, the setting 152"inet_protocols = ipv6" will not prevent Postfix from 153accepting IPv4 connections. Postfix will present the client IP 154addresses in IPv6 format, though. In all other cases, Postfix always 155presents IPv4 client IP addresses in the traditional dotted quad 156IPv4 format. </p> 157 158<li> <p> The other new parameter is smtp_bind_address6. 159This sets the local interface address for outgoing IPv6 SMTP 160connections, just like the smtp_bind_address parameter 161does for IPv4: </p> 162 163<blockquote> 164<pre> 165/etc/postfix/main.cf: 166 smtp_bind_address6 = 2001:240:587:0:250:56ff:fe89:1 167</pre> 168</blockquote> 169 170<li> <p> If you left the value of the mynetworks parameter at its 171default (i.e. no mynetworks setting in main.cf) Postfix will figure 172out by itself what its network addresses are. This is what a typical 173setting looks like: </p> 174 175<blockquote> 176<pre> 177% postconf mynetworks 178mynetworks = 127.0.0.0/8 168.100.189.0/28 [::1]/128 [fe80::]/10 [2001:240:587::]/64 179</pre> 180</blockquote> 181 182<p> If you did specify the mynetworks parameter value in 183main.cf, you need update the mynetworks value to include 184the IPv6 networks the system is in. Be sure to specify IPv6 address 185information inside "<tt>[]</tt>", like this: </p> 186 187<blockquote> 188<pre> 189/etc/postfix/main.cf: 190 mynetworks = ...<i>IPv4 networks</i>... [::1]/128 [2001:240:587::]/64 ... 191</pre> 192</blockquote> 193 194</ul> 195 196<p> <b> NOTE: when configuring Postfix match lists such as 197mynetworks or debug_peer_list, you must specify 198IPv6 address information inside "<tt>[]</tt>" in the main.cf parameter 199value and in files specified with a "<i>/file/name</i>" pattern. 200IPv6 addresses contain the ":" character, and would otherwise be 201confused with a "<i>type:table</i>" pattern. </b> </p> 202 203<h2><a name="limitations">Known Limitations</a></h2> 204 205<ul> 206 207<li> <p> Postfix SMTP clients before version 2.8 try to connect 208over IPv6 before trying IPv4. With more recent Postfix versions, 209the order of IPv6 versus IPv4 outgoing connection attempts is 210configurable with the smtp_address_preference parameter. </p> 211 212<li> <p> Postfix versions before 2.6 do not support DNSBL (real-time 213blackhole list) lookups for IPv6 client IP addresses. </p> 214 215<li> <p> IPv6 does not have class A, B, C, etc. networks. With IPv6 216networks, the setting "mynetworks_style = class" has the 217same effect as the setting "mynetworks_style = subnet". 218</p> 219 220<li> <p> On Tru64Unix and AIX, Postfix can't figure out the local 221subnet mask 222and always assumes a /128 network. This is a problem only with 223"mynetworks_style = subnet" and no explicit mynetworks 224setting in main.cf. </p> 225 226</ul> 227 228<h2> <a name="compat">Compatibility with Postfix <2.2 IPv6 support</a> 229</h2> 230 231<p> Postfix version 2.2 IPv6 support is based on the Postfix/IPv6 patch 232by Dean Strik and others, but differs in a few minor ways. </p> 233 234<ul> 235 236<li> <p> main.cf: The inet_interfaces parameter does not support 237the notation "ipv6:all" or "ipv4:all". Use the 238inet_protocols parameter instead. </p> 239 240<li> <p> main.cf: Specify "inet_protocols = all" or 241"inet_protocols = ipv4, ipv6" in order to enable both IPv4 242and IPv6 support. </p> 243 244<li> <p> main.cf: The inet_protocols parameter also controls 245what DNS lookups Postfix will attempt to make when delivering or 246receiving mail. </p> 247 248<li> <p> main.cf: Specify "inet_interfaces = loopback-only" 249to listen on loopback network interfaces only. </p> 250 251<li> <p> The lmtp_bind_address and lmtp_bind_address6 252features were omitted. The Postfix LMTP client will be absorbed 253into the SMTP client, so there is no reason to keep adding features 254to the LMTP client. </p> 255 256<li> <p> The SMTP server now requires that IPv6 addresses in SMTP 257commands are specified as [ipv6:<i>ipv6address</i>], as 258described in RFC 2821. </p> 259 260<li> <p> The IPv6 network address matching code was rewritten from 261the ground up, and is expected to be closer to the specification. 262The result may be incompatible with the Postfix/IPv6 patch. 263</p> 264 265</ul> 266 267<h2><a name="porting">IPv6 Support for unsupported platforms</a></h2> 268 269<p> Getting Postfix IPv6 working on other platforms involves the 270following steps: </p> 271 272<ul> 273 274<li> <p> Specify how Postfix should find the local network interfaces. 275Postfix needs this information to avoid mailer loops and to find out 276if mail for <i>user@[ipaddress]</i> is a local or remote destination. </p> 277 278<p> If your system has the getifaddrs() routine then add 279the following to your platform-specific section in 280src/util/sys_defs.h: </p> 281 282<blockquote> 283<pre> 284#ifndef NO_IPV6 285# define HAS_IPV6 286# define HAVE_GETIFADDRS 287#endif 288</pre> 289</blockquote> 290 291<p> Otherwise, if your system has the SIOCGLIF ioctl() 292command in /usr/include/*/*.h, add the following to your 293platform-specific section in src/util/sys_defs.h: </p> 294 295<blockquote> 296<pre> 297#ifndef NO_IPV6 298# define HAS_IPV6 299# define HAS_SIOCGLIF 300#endif 301</pre> 302</blockquote> 303 304<p> Otherwise, Postfix will have to use the old SIOCGIF commands 305and get along with reduced IPv6 functionality (it won't be able to 306figure out your IPv6 netmasks, which are needed for "mynetworks_style 307= subnet". Add this to your platform-specific section in 308src/util/sys_defs.h: </p> 309 310<blockquote> 311<pre> 312#ifndef NO_IPV6 313# define HAS_IPV6 314#endif 315</pre> 316</blockquote> 317 318<li> <p> Test if Postfix can figure out its interface information. </p> 319 320<p> After compiling Postfix in the usual manner, step into the 321src/util directory and type "<b>make inet_addr_local</b>". 322Running this file by hand should produce all the interface addresses 323and network masks, for example: </p> 324 325<blockquote> 326<pre> 327% make 328% cd src/util 329% make inet_addr_local 330[... some messages ...] 331% ./inet_addr_local 332[... some messages ...] 333./inet_addr_local: inet_addr_local: configured 2 IPv4 addresses 334./inet_addr_local: inet_addr_local: configured 4 IPv6 addresses 335168.100.189.2/255.255.255.224 336127.0.0.1/255.0.0.0 337fe80:1::2d0:b7ff:fe88:2ca7/ffff:ffff:ffff:ffff:: 3382001:240:587:0:2d0:b7ff:fe88:2ca7/ffff:ffff:ffff:ffff:: 339fe80:5::1/ffff:ffff:ffff:ffff:: 340::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 341</pre> 342</blockquote> 343 344<p> The above is for an old FreeBSD machine. Other systems produce 345slightly different results, but you get the idea. </p> 346 347</ul> 348 349<p> If none of all this produces a usable result, send email to the 350postfix-users@postfix.org mailing list and we'll try to help you 351through this. </p> 352 353<h2><a name="credits">Credits</a></h2> 354 355<p> The following information is in part based on information that 356was compiled by Dean Strik. </p> 357 358<ul> 359 360<li> <p> Mark Huizer wrote the original Postfix IPv6 patch. </p> 361 362<li> <p> Jun-ichiro 'itojun' Hagino of the KAME project made 363substantial improvements. Since then, we speak of the KAME patch. 364</p> 365 366<li> <p> The PLD Linux Distribution ported the code to other stacks 367(notably USAGI). We speak of the PLD patch. A very important 368feature of the PLD patch was that it can work with Lutz Jaenicke's 369TLS patch for Postfix. </p> 370 371<li> <p> Dean Strik extended IPv6 support to platforms other than 372KAME and USAGI, updated the patch to keep up with Postfix development, 373and provided a combined IPv6 + TLS patch. Information about his 374effort can be found on Dean Strik's Postfix website at 375http://www.ipnet6.org/postfix/. </p> 376 377<li> <p> Wietse Venema took Dean Strik's IPv6 patch, merged it into 378Postfix 2.2, and took the opportunity to eliminate all IPv4-specific 379code from Postfix that could be removed. For systems without IPv6 380support in the kernel and system libraries, Postfix has a simple 381compatibility layer, so that it will use IPv4 as before. </p> 382 383</ul> 384 385</body> 386 387</html> 388