Merge branch 'ical'
[alpine.git] / imap / docs / IPv6.txt
blob5b1af6213d0dfa8b256de576581ce35ab9978d33
1 /* ========================================================================
2  * Copyright 1988-2006 University of Washington
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * 
11  * ========================================================================
12  */
14 The following information about configuring inetd and xinetd for IPv6 was
15 contributed by a user.  I have not checked it for accuracy or completeness,
16 but have included it as-is in the hope that it may be useful:
18 ---------------------------------------------------------------------------
19 One thing you might consider adding to the docs are hints for setting up
20 inetd or xinetd to simultaneously listen on BOTH IPv4 and IPv6 for
21 different OS.
23 Some OS want to see separate IPv4-only and IPv6-only listening sockets
24 configured in inetd.conf or xinetd.conf.  Others will accept IPv4
25 connections on lines configured for IPv6 and actually generate errors if
26 you have both configured when inetd or xinetd start up.  It's not clear to
27 me whether this difference is due to how inetd or xinetd are built or
28 whether it's due to the kernel's IP stack implementation.  I suspect it's
29 really the latter.  Below are some examples:
31 Here's a fragment of /usr/local/etc/xinetd.conf for a FreeBSD 4.9 server:
33 service imap
35         socket_type     = stream
36         protocol        = tcp
37         wait            = no
38         user            = root
39         server          = /usr/local/libexec/imapd
41 service imap
43         flags           = IPv6
44         socket_type     = stream
45         protocol        = tcp
46         wait            = no
47         user            = root
48         server          = /usr/local/libexec/imapd
50 service imaps
52         socket_type     = stream
53         protocol        = tcp
54         wait            = no
55         user            = root
56         server          = /usr/local/libexec/imapd
58 service imaps
60         flags           = IPv6
61         socket_type     = stream
62         protocol        = tcp
63         wait            = no
64         user            = root
65         server          = /usr/local/libexec/imapd
68 Note that you have to specify a nearly identical paragraph for each
69 service which differs only by the 'flags = IPv6'.  An equivalent
70 inetd.conf would look something like:
72 imap  stream  tcp     nowait  root    /usr/local/libexec/imapd        imapd
73 imap  stream  tcp6    nowait  root    /usr/local/libexec/imapd        imapd
74 imaps stream  tcp     nowait  root    /usr/local/libexec/imapd        imapd
75 imaps stream  tcp6    nowait  root    /usr/local/libexec/imapd        imapd
77 The man pages for inetd suggest that if you use a single entry with
78 'tcp46' replacing either 'tcp' or 'tcp6' the system will listen on both
79 types of addresses.  At least for the case of FreeBSD this is actually
80 incorrect.
82 Now if you were to use the above xinetd.conf on Fedora Linux, it would
83 complain.  What does work under Linux is to create a single service
84 paragraph for each service which will accept connections on both IPv4 and
85 IPv6:
87 In /etc/xinetd.d/imap:
89 service imap
91         flags       = IPv6
92         disable     = no
93         socket_type = stream
94         wait        = no
95         user        = root
96         server      = /usr/local/sbin/imapd
99 In /etc/xinetd.d/imaps:
101 service imaps
103         flags       = IPv6
104         disable     = no
105         socket_type = stream
106         wait        = no
107         user        = root
108         server      = /usr/local/sbin/imapd
111 The man page for xinetd says the IPv6 flag means xinetd will listen ONLY
112 on IPv6.  However the actual behaviour (for Fedora Linux) is to listen on
113 both IPv4 and IPv6.
115 All of the above also applies to ipop3d.  Anyway, this might save some
116 folks a little bit of head scratching time.
117 ---------------------------------------------------------------------------
118 Addendum from the original submitter:
119 ---------------------------------------------------------------------------
120 I've since learned that the discrepancy really is a function of the OS.
121 It seems those systems that force you to create separate IPv4 and IPv6
122 listeners in inetd (or xinetd) are the same systems that also disable
123 IPv4-mapped IPv6 addresses by default.  This is a boot-time configuration
124 option.  If you enable IPv4-mapped IPv6 addresses, then the 'tcp46' option
125 in inetd works and the simplified config would look like:
127 imap4   stream  tcp46   nowait  root    /usr/local/libexec/imapd        imapd
128 imaps   stream  tcp46   nowait  root    /usr/local/libexec/imapd        imapd
130 In FreeBSD, enabling IPv4-mapped addresses is done by adding
131 ipv6_ipv4mapping="YES" to /etc/rc.conf (in addition to ipv6_enable="YES").