2 .\" Copyright (C) 2006, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH IPADDRSEL 1M "Feb 6, 2006"
8 ipaddrsel \- configure IPv6 default address selection
12 \fB/usr/sbin/ipaddrsel\fR
17 \fB/usr/sbin/ipaddrsel\fR \fB-f\fR \fIfile\fR
22 \fB/usr/sbin/ipaddrsel\fR \fB-d\fR
28 Use the \fBipaddrsel\fR utility to configure the IPv6 default address selection
29 policy table. The policy table is a longest-matching-prefix lookup table that
30 is used for IPv6 source address selection and for destination address ordering
31 when resolving names to \fBAF_INET6\fR addresses. For a description of how the
32 policy table is used for source address selection, see \fBinet6\fR(7P). For a
33 description of how the policy table is used for destination address ordering,
34 see \fBgetaddrinfo\fR(3SOCKET).
37 The unmodified policy table is valid for all typical IPv6 deployments. Modify
38 the table only if a circumstance exists for which the default behavior of the
39 IPv6 source address selection or destination address ordering mechanism is
40 unsatisfactory. See the section for examples of such circumstances. You should
41 carefully consider your addressing strategy before you change the table from
45 When the \fBipaddrsel\fR command is issued without any arguments, the address
46 selection policy currently in use is printed. The format of the output is
47 compatible with the format of the configuration file that the \fB-f\fR option
53 If the \fBusesrc\fR subcommand to \fBifconfig\fR(1M) is applied to a particular
54 physical interface, the selection policy specified by \fBusesrc\fR overrides
55 the source address selection policies specified by \fBipaddrsel\fR. This is
56 true for packets that are locally generated and for applications that do not
57 choose a non-zero source address using \fBbind\fR(3SOCKET).
59 .SS "The Configuration File"
62 The configuration file that the \fB-f\fR option accepts can contain either
63 comment lines or policy entries. Comment lines have a '\fB#\fR' character as
64 the first non-blank character. and they are ignored by the \fBipaddrsel\fR
65 utility. Policy entry lines have the following format:
69 \fIprefix\fR/\fIprefix_length\fR \fIprecedence\fR \fIlabel\fR [# \fIcomment\fR]
75 The \fIprefix\fR must be an IPv6 prefix in a format consistent with
76 \fBinet\fR(3SOCKET). The \fIprefix_length\fR is an integer ranging from 0 to
77 128. The IPv6 source address selection and destination address ordering
78 algorithms determine the precedence or label of an address by doing a
79 longest-prefix-match lookup using the prefixes in this table, much like
80 next-hop determination for a destination is done by doing a
81 longest-prefix-match lookup using an IP routing table.
84 The precedence is a non-negative integer that represents how the destination
85 address ordering mechanism will sort addresses returned from name lookups. In
86 general, addresses with a higher precedence will be in front of addresses with
87 a lower precedence. Other factors, such as destinations with undesirable source
88 addresses can, however, override these precedence values.
91 The label is a string of at most fifteen characters, not including the
92 \fINULL\fR terminator. The label allows particular source address prefixes to
93 be used with destination prefixes of the same label. Specifically, for a
94 particular destination address, the IPv6 source address selection algorithm
95 prefers source addresses whose label is equal that of the destination.
98 The label may be followed by an optional comment.
101 The file must contain a default policy entry, which is an entry with
102 \fB::0/0\fR as its \fIprefix\fR and \fIprefix_length\fR. This is to ensure that
103 all possible addresses match a policy.
107 The \fBippadrsel\fR utility supports the following options:
111 \fB\fB-f\fR \fIfile\fR\fR
114 Replace the address selection policy table with the policy specified in the
124 Revert the kernel's address selection policy table back to the default table.
125 Invoking \fBipaddrsel\fR in this way only changes the currently running
126 kernel's policy table, and does not alter the configuration file
127 \fB/etc/inet/ipaddrsel.conf\fR. To revert the configuration file back to its
128 default settings, use \fBipaddrsel\fR \fB-d\fR, then dump the contents of the
129 table to the configuration file by redirecting the output of \fBipaddrsel\fR to
130 \fB/etc/inet/ipaddrsel.conf\fR.
134 example# \fBipaddrsel -d\fR
135 example# \fBipaddrsel > /etc/inet/ipaddrsel.conf\fR
144 \fBExample 1 \fRThe Default Policy in \fB/etc/inet/ipaddrsel.conf\fR
147 The following example is the default policy that is located in
148 \fB/etc/inet/ipaddrsel.conf\fR:
153 # Prefix Precedence Label
155 ::/96 20 IPv4_Compatible
156 ::ffff:0.0.0.0/96 10 IPv4
164 \fBExample 2 \fRAssigning a Lower Precedence to Link-local and Site-local
168 By default, the destination address ordering rules sort addresses of smaller
169 scope before those of larger scope. For example, if a name resolves to a global
170 and a site-local address, the site local address would be ordered before the
171 global address. An administrator can override this ordering rule by assigning a
172 lower precedence to addresses of smaller scope, as the following table
178 # Prefix Precedence Label
182 fec0::/10 27 Site-Local
183 fe80::/10 23 Link-Local
184 ::/96 20 IPv4_Compatible
185 ::ffff:0.0.0.0/96 10 IPv4
191 \fBExample 3 \fRAssigning Higher Precedence to IPv4 Destinations
194 By default, IPv6 addresses are ordered in front of IPv4 addresses in name
195 lookups. \fB::ffff:0.0.0.0/96\fR has the lowest precedence in the default
196 table. In the following example, IPv4 addresses are assigned higher precedence
197 and are ordered in front of IPv6 destinations:
202 # Prefix Precedence Label
206 ::/96 20 IPv4_Compatible
207 ::ffff:0.0.0.0/96 60 IPv4
213 \fBExample 4 \fREnsuring that a Particular Source Address is Used
216 This example ensures that a particular source address is used only when
217 communicating with destinations in a particular network.
221 The following policy table assigns a label of 5 to a particular source address
222 on the local system, \fB2001:1111:1111::1\fR. The table assigns the same label
223 to a network, \fB2001:2222:2222::/48\fR. The result of this policy is that the
224 \fB2001:1111:1111::1\fR source address will only be used when communicating
225 with destinations contained in the \fB2001:2222:2222::/48\fR network. For this
226 example, this network is the \fBClientNet\fR, which could represent a
227 particular client's network.
232 # Prefix Precedence Label
234 2001:1111:1111::1/128 40 ClientNet
235 2001:2222:2222::/48 40 ClientNet
238 ::/96 20 IPv4_Compatible
239 ::ffff:0.0.0.0/96 10 IPv4
246 This example assumes that the local system has one physical interface, and that
247 all global prefixes are assigned to that physical interface.
252 \fBipaddrsel\fR returns the following exit values:
259 \fBipaddrsel\fR successfully completed.
268 An error occurred. If a failure is encountered, the kernel's current policy
276 \fB\fB/etc/inet/ipaddrsel.conf\fR\fR
279 The file that contains the IPv6 default address selection policy to be
280 installed at boot time. This file is loaded before any Internet services are
287 See \fBattributes\fR(5) for descriptions of the following attributes:
295 ATTRIBUTE TYPE ATTRIBUTE VALUE
297 Interface Stability Evolving
303 \fBnscd\fR(1M), \fBinet\fR(3SOCKET), \fBgetaddrinfo\fR(3SOCKET),
304 \fBipaddrsel.conf\fR(4), \fBattributes\fR(5), \fBinet6\fR(7P)
308 The ipnodes cache kept by \fBnscd\fR(1M) contains addresses that are ordered
309 using the destination address ordering algorithm, which is one of the reasons
310 why \fBipaddrsel\fR is called before \fBnscd\fR in the boot sequence. If
311 \fBipaddrsel\fR is used to change the address selection policy after \fBnscd\fR
312 has started, you should invalidate the \fBnscd\fR ipnodes cache invalidated by
313 invoking the following command:
317 example# \fB/usr/sbin/nscd -i ipnodes\fR