1 /* ========================================================================
2 * Copyright 1988-2006 University of Washington
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
8 * http://www.apache.org/licenses/LICENSE-2.0
11 * ========================================================================
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
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:
39 server = /usr/local/libexec/imapd
48 server = /usr/local/libexec/imapd
56 server = /usr/local/libexec/imapd
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
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
87 In /etc/xinetd.d/imap:
96 server = /usr/local/sbin/imapd
99 In /etc/xinetd.d/imaps:
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
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").