]> git.saurik.com Git - apple/network_cmds.git/blob - ifconfig.tproj/ifconfig.8
348d63b46ea1b7f5c5abe8fb64b5862337feb3b3
[apple/network_cmds.git] / ifconfig.tproj / ifconfig.8
1 .\" Copyright (c) 1983, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgment:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
33 .\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.27.2.14 2001/08/23 06:35:38 yar Exp $
34 .\"
35 .Dd July 15, 2004
36 .Dt IFCONFIG 8
37 .Os
38 .Sh NAME
39 .Nm ifconfig
40 .Nd configure network interface parameters
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl L
44 .Op Fl m
45 .Ar interface
46 .Op Cm create
47 .Op Ar address_family
48 .Oo
49 .Ar address Ns Op Cm / Ns Ar prefixlength
50 .Op Ar dest_address
51 .Oc
52 .Op Ar parameters
53 .Nm
54 .Ar interface
55 .Cm destroy
56 .Nm
57 .Fl a
58 .Op Fl L
59 .Op Fl d
60 .Op Fl m
61 .Op Fl u
62 .Op Ar address_family
63 .Nm
64 .Fl l
65 .Op Fl d
66 .Op Fl u
67 .Op Ar address_family
68 .Nm
69 .Op Fl L
70 .Op Fl b
71 .Op Fl d
72 .Op Fl m
73 .Op Fl u
74 .Nm
75 .Ar interface
76 .Cm vlan
77 .Ar vlan-tag
78 .Cm vlandev
79 .Ar iface
80 .Nm
81 .Ar interface
82 .Cm -vlandev
83 .Ar iface
84 .Nm
85 .Ar interface
86 .Cm bonddev
87 .Ar iface
88 .Nm
89 .Ar interface
90 .Cm -bonddev
91 .Ar iface
92 .Sh DESCRIPTION
93 .Nm Ifconfig
94 is used to assign an address
95 to a network interface and/or configure
96 network interface parameters.
97 .Nm Ifconfig
98 must be used at boot time to define the network address
99 of each interface present on a machine; it may also be used at
100 a later time to redefine an interface's address
101 or other operating parameters.
102 .Pp
103 The following options are available:
104 .Bl -tag -width indent
105 .It Ar address
106 For the
107 .Tn DARPA Ns -Internet
108 family,
109 the address is either a host name present in the host name data
110 base,
111 .Xr hosts 5 ,
112 or a
113 .Tn DARPA
114 Internet address expressed in the Internet standard
115 .Dq dot notation .
116 .Pp
117 It is also possible to use the CIDR notation (also known as the
118 slash notation) to include the netmask.
119 That is, one can specify an address like
120 .Li 192.168.0.1/16 .
121 .\" For the Xerox Network Systems(tm) family,
122 .\" addresses are
123 .\" .Ar net:a.b.c.d.e.f ,
124 .\" where
125 .\" .Ar net
126 .\" is the assigned network number (in decimal),
127 .\" and each of the six bytes of the host number,
128 .\" .Ar a
129 .\" through
130 .\" .Ar f ,
131 .\" are specified in hexadecimal.
132 .\" The host number may be omitted on IEEE 802 protocol
133 .\" (Ethernet, FDDI, and Token Ring) interfaces,
134 .\" which use the hardware physical address,
135 .\" and on interfaces other than the first.
136 .\" For the
137 .\" .Tn ISO
138 .\" family, addresses are specified as a long hexadecimal string,
139 .\" as in the Xerox family.
140 .\" However, two consecutive dots imply a zero
141 .\" byte, and the dots are optional, if the user wishes to (carefully)
142 .\" count out long strings of digits in network byte order.
143 .It Ar address_family
144 Specify the
145 address family
146 which affects interpretation of the remaining parameters.
147 Since an interface can receive transmissions in differing protocols
148 with different naming schemes, specifying the address family is recommended.
149 The address or protocol families currently
150 supported are
151 .Dq inet ,
152 .Dq inet6 ,
153 .\" and
154 .\" .Dq ns .
155 .It Ar dest_address
156 Specify the address of the correspondent on the other end
157 of a point to point link.
158 .It Ar interface
159 This
160 parameter is a string of the form
161 .Dq name unit ,
162 for example,
163 .Dq Li en0 .
164 .It Ar iface
165 This parameter has the same encoding as the
166 .Ar interface
167 parameter.
168 .El
169 .Pp
170 The following parameters may be set with
171 .Nm :
172 .Bl -tag -width indent
173 .It Cm add
174 Another name for the
175 .Cm alias
176 parameter.
177 Introduced for compatibility
178 with
179 .Bsx .
180 .It Cm alias
181 Establish an additional network address for this interface.
182 This is sometimes useful when changing network numbers, and
183 one wishes to accept packets addressed to the old interface.
184 If the address is on the same subnet as the first network address
185 for this interface, a netmask of
186 .Li 0xffffffff
187 has to be specified.
188 .It Fl alias
189 Remove the network address specified.
190 This would be used if you incorrectly specified an alias, or it
191 was no longer needed.
192 If you have incorrectly set an NS address having the side effect
193 of specifying the host portion, removing all NS addresses will
194 allow you to respecify the host portion.
195 .It Cm anycast
196 (Inet6 only.)
197 Specify that the address configured is an anycast address.
198 Based on the current specification,
199 only routers may configure anycast addresses.
200 Anycast address will not be used as source address of any of outgoing
201 IPv6 packets.
202 .It Cm arp
203 Enable the use of the Address Resolution Protocol
204 .Pq Xr arp 4
205 in mapping
206 between network level addresses and link level addresses (default).
207 This is currently implemented for mapping between
208 .Tn DARPA
209 Internet
210 addresses and
211 .Tn IEEE
212 802 48-bit MAC addresses (Ethernet, FDDI, and Token Ring addresses).
213 .It Fl arp
214 Disable the use of the Address Resolution Protocol
215 .Pq Xr arp 4 .
216 .It Cm bonddev Ar iface
217 If the interface is a bond pseudo device, associate physical interface
218 .Ar iface
219 with it. The bond pseudo device conforms
220 to the IEEE 802.3ad Link Aggregation specification.
221 .Pp
222 If this is the first physical interface to be associated with the bond
223 interface, the bond interface inherits the ethernet address from the
224 physical interface. Physical interfaces that are added to the bond have
225 their ethernet address re-programmed so that all members of the bond have
226 the same ethernet address. If the physical interface is subsequently
227 removed from the bond using
228 .Fl bonddev ,
229 a new ethernet address is chosen from the remaining interfaces, and all
230 interfaces are re-programmed again with the new ethernet address. If no
231 remaining interfaces exist, the bond interface's ethernet address is cleared.
232 .Pp
233 If the specified physical interface
234 .Ar iface
235 is not capable of having its ethernet address re-programmed, the
236 .Cm bonddev
237 command will fail.
238 .Pp
239 Once the physical interface
240 .Ar iface
241 is successfully associated with the bond interface, all received packets
242 are diverted to the bond interface. The physical interface is no longer
243 useable on its own, and remains that way until it is removed from the bond using
244 .Fl bonddev .
245 .Pp
246 It is possible that the specified interface
247 .Ar iface
248 is not capable of aggregating, and may remain unused until the operating
249 conditions change.
250 .Pp
251 The link status of the bond interface depends on the state of link aggregation.
252 If no active partner is detected, the link status will remain inactive.
253 .Pp
254 To monitor the 802.3ad Link Aggregation state, use the
255 .Fl b
256 option.
257 .Pp
258 A physical interface that is associated with a vlan pseudo device cannot
259 at the same time be associated with a bond pseudo device. A physical interface
260 cannot be associated with more than one bond pseudo device at the same time.
261 .Pp
262 It is not possible to associate a bond with pseudo interfaces such as vlan.
263 Only physical ethernet interfaces may be associated with a bond.
264 .It Fl bonddev Ar iface
265 If the interface is a bond pseudo device, disassociate the physical interface
266 .Ar iface
267 from it. Before the interface is removed from the bond, the bond device
268 announces to the link partner that the interface is now individual and
269 no longer aggregatable.
270 If the physical
271 .Ar iface
272 is the last interface in the bond, the bond interface clears its link address.
273 .It Cm broadcast
274 (Inet only.)
275 Specify the address to use to represent broadcasts to the
276 network.
277 The default broadcast address is the address with a host part of all 1's.
278 .It Cm debug
279 Enable driver dependent debugging code; usually, this turns on
280 extra console error logging.
281 .It Fl debug
282 Disable driver dependent debugging code.
283 .It Cm delete
284 Another name for the
285 .Fl alias
286 parameter.
287 .It Cm down
288 Mark an interface
289 .Dq down .
290 When an interface is marked
291 .Dq down ,
292 the system will not attempt to
293 transmit messages through that interface.
294 If possible, the interface will be reset to disable reception as well.
295 This action does not automatically disable routes using the interface.
296 .It Cm ether
297 Another name for the
298 .Cm lladdr
299 parameter.
300 .\" .It Cm ipdst
301 .\" This is used to specify an Internet host who is willing to receive
302 .\" ip packets encapsulating NS packets bound for a remote network.
303 .\" An apparent point to point link is constructed, and
304 .\" the address specified will be taken as the NS address and network
305 .\" of the destination.
306 .\" IP encapsulation of
307 .\" .Tn CLNP
308 .\" packets is done differently.
309 .It Cm lladdr Ar addr
310 Set the link-level address on an interface.
311 This can be used to
312 e.g. set a new MAC address on an ethernet interface, though the
313 mechanism used is not ethernet-specific.
314 The address
315 .Ar addr
316 is specified as a series of colon-separated hex digits.
317 If the interface is already
318 up when this option is used, it will be briefly brought down and
319 then brought back up again in order to ensure that the receive
320 filter in the underlying ethernet hardware is properly reprogrammed.
321 .It Cm media Ar type
322 If the driver supports the media selection system, set the media type
323 of the interface to
324 .Ar type .
325 Some interfaces support the mutually exclusive use of one of several
326 different physical media connectors.
327 For example, a 10Mb/s Ethernet
328 interface might support the use of either
329 .Tn AUI
330 or twisted pair connectors.
331 Setting the media type to
332 .Dq 10base5/AUI
333 would change the currently active connector to the AUI port.
334 Setting it to
335 .Dq 10baseT/UTP
336 would activate twisted pair.
337 Refer to the interfaces' driver
338 specific documentation or man page for a complete list of the
339 available types.
340 .It Cm mediaopt Ar opts
341 If the driver supports the media selection system, set the specified
342 media options on the interface.
343 The
344 .Ar opts
345 argument
346 is a comma delimited list of options to apply to the interface.
347 Refer to the interfaces' driver specific man page for a complete
348 list of available options.
349 .It Fl mediaopt Ar opts
350 If the driver supports the media selection system, disable the
351 specified media options on the interface.
352 .It Cm tunnel Ar src_addr dest_addr
353 (IP tunnel devices only.)
354 Configure the physical source and destination address for IP tunnel
355 interfaces
356 .Pq Xr gif 4 .
357 The arguments
358 .Ar src_addr
359 and
360 .Ar dest_addr
361 are interpreted as the outer source/destination for the encapsulating
362 IPv4/IPv6 header.
363 .It Cm deletetunnel
364 Unconfigure the physical source and destination address for IP tunnel
365 interfaces previously configured with
366 .Cm tunnel .
367 .It Cm create
368 Create the specified network pseudo-device.
369 If the interface is given without a unit number, try to create a new
370 device with an arbitrary unit number.
371 If creation of an arbitrary device is successful, the new device name is
372 printed to standard output.
373 .It Cm destroy
374 Destroy the specified network pseudo-device.
375 .It Cm plumb
376 Another name for the
377 .Cm create
378 parameter.
379 Included for
380 .Tn Solaris
381 compatibility.
382 .It Cm unplumb
383 Another name for the
384 .Cm destroy
385 parameter.
386 Included for
387 .Tn Solaris
388 compatibility.
389 .It Cm metric Ar n
390 Set the routing metric of the interface to
391 .Ar n ,
392 default 0.
393 The routing metric is used by the routing protocol
394 .Pq Xr routed 8 .
395 Higher metrics have the effect of making a route
396 less favorable; metrics are counted as addition hops
397 to the destination network or host.
398 .It Cm mtu Ar n
399 Set the maximum transmission unit of the interface to
400 .Ar n ,
401 default is interface specific.
402 The MTU is used to limit the size of packets that are transmitted on an
403 interface.
404 Not all interfaces support setting the MTU, and some interfaces have
405 range restrictions.
406 .It Cm netmask Ar mask
407 .\" (Inet and ISO.)
408 (Inet only.)
409 Specify how much of the address to reserve for subdividing
410 networks into sub-networks.
411 The mask includes the network part of the local address
412 and the subnet part, which is taken from the host field of the address.
413 The mask can be specified as a single hexadecimal number
414 with a leading
415 .Ql 0x ,
416 with a dot-notation Internet address,
417 or with a pseudo-network name listed in the network table
418 .Xr networks 5 .
419 The mask contains 1's for the bit positions in the 32-bit address
420 which are to be used for the network and subnet parts,
421 and 0's for the host part.
422 The mask should contain at least the standard network portion,
423 and the subnet field should be contiguous with the network
424 portion.
425 .Pp
426 The netmask can also be specified in CIDR notation after the address.
427 See the
428 .Ar address
429 option above for more information.
430 .It Cm prefixlen Ar len
431 (Inet6 only.)
432 Specify that
433 .Ar len
434 bits are reserved for subdividing networks into sub-networks.
435 The
436 .Ar len
437 must be integer, and for syntactical reason it must be between 0 to 128.
438 It is almost always 64 under the current IPv6 assignment rule.
439 If the parameter is omitted, 64 is used.
440 .\" see
441 .\" Xr eon 5 .
442 .\" .It Cm nsellength Ar n
443 .\" .Pf ( Tn ISO
444 .\" only)
445 .\" This specifies a trailing number of bytes for a received
446 .\" .Tn NSAP
447 .\" used for local identification, the remaining leading part of which is
448 .\" taken to be the
449 .\" .Tn NET
450 .\" (Network Entity Title).
451 .\" The default value is 1, which is conformant to US
452 .\" .Tn GOSIP .
453 .\" When an ISO address is set in an ifconfig command,
454 .\" it is really the
455 .\" .Tn NSAP
456 .\" which is being specified.
457 .\" For example, in
458 .\" .Tn US GOSIP ,
459 .\" 20 hex digits should be
460 .\" specified in the
461 .\" .Tn ISO NSAP
462 .\" to be assigned to the interface.
463 .\" There is some evidence that a number different from 1 may be useful
464 .\" for
465 .\" .Tn AFI
466 .\" 37 type addresses.
467 .It Cm remove
468 Another name for the
469 .Fl alias
470 parameter.
471 Introduced for compatibility
472 with
473 .Bsx .
474 .Sm off
475 .It Cm link Op Cm 0 No - Cm 2
476 .Sm on
477 Enable special processing of the link level of the interface.
478 These three options are interface specific in actual effect, however,
479 they are in general used to select special modes of operation.
480 An example
481 of this is to enable SLIP compression, or to select the connector type
482 for some Ethernet cards.
483 Refer to the man page for the specific driver
484 for more information.
485 .Sm off
486 .It Fl link Op Cm 0 No - Cm 2
487 .Sm on
488 Disable special processing at the link level with the specified interface.
489 .It Cm up
490 Mark an interface
491 .Dq up .
492 This may be used to enable an interface after an
493 .Dq Nm Cm down .
494 It happens automatically when setting the first address on an interface.
495 If the interface was reset when previously marked down,
496 the hardware will be re-initialized.
497 .It Cm vlan Ar vlan_tag Cm vlandev Ar iface
498 If the interface is a vlan pseudo interface, set its vlan tag value
499 to
500 .Ar vlan_tag
501 and associate it with the physical interface
502 .Ar iface .
503 .Pp
504 The
505 .Ar vlan_tag
506 value is a 16-bit number that is used to create an 802.1Q
507 vlan header for packets sent from the vlan interface.
508 .Pp
509 A packet that is transmitted through the vlan interface is sent
510 using the specified physical interface
511 .Ar iface
512 with 802.1Q vlan encapsulation with the specified
513 .Ar vlan_tag .
514 A packet with 802.1Q encapsulation received by the physical interface
515 is directed to the associated vlan interface with the matching
516 .Ar vlan_tag .
517 If there is no matching vlan interface, the packet is dropped.
518 .Pp
519 The vlan interface is assigned a
520 copy of the parent interface's flags and the parent's ethernet address.
521 If the vlan interface already has
522 a physical interface associated with it, this command will fail.
523 To
524 change the association to another physical interface, the existing
525 association must be cleared first using
526 .Fl vlandev .
527 .Pp
528 If the physical interface supports 802.1Q VLAN tagging in hardware,
529 the vlan pseudo interface does not itself insert or remove the 802.1Q
530 encapsulation header. Instead, the
531 .Ar vlan_tag
532 is passed out of band from the packet data.
533 .Pp
534 A physical interface that is associated with a bond pseudo device cannot
535 at the same time be associated with a vlan interface. However, a physical
536 interface can be associated with multiple vlan interfaces at the same time,
537 as long as each of the
538 .Ar vlan_tag
539 values are unique.
540 .It Fl vlandev Ar iface
541 If the driver is a vlan pseudo device, disassociate the physical interface
542 .Ar iface
543 from it.
544 This breaks the link between the vlan interface and its parent,
545 clears its vlan tag, flags and its link address.
546 .El
547 .Pp
548 .Nm Ifconfig
549 displays the current configuration for a network interface
550 when no optional parameters are supplied.
551 If a protocol family is specified,
552 .Nm
553 will report only the details specific to that protocol family.
554 .Pp
555 If the driver supports the media selection system, the supported
556 media list will be included in the output, regardless of whether the
557 .Fl m
558 flag is passed or not.
559 .Pp
560 The
561 .Fl b
562 option passed before the interface name will print the link aggregation
563 state for bond pseudo devices.
564 .Pp
565 If
566 .Fl L
567 flag is supplied, address lifetime is displayed for IPv6 addresses,
568 as time offset string.
569 .Pp
570 Optionally, the
571 .Fl a
572 flag may be used instead of an interface name.
573 This flag instructs
574 .Nm
575 to display information about all interfaces in the system.
576 The
577 .Fl d
578 flag limits this to interfaces that are down, and
579 .Fl u
580 limits this to interfaces that are up.
581 When no arguments are given,
582 .Fl a
583 is implied.
584 .Pp
585 The
586 .Fl l
587 flag may be used to list all available interfaces on the system, with
588 no other additional information.
589 Use of this flag is mutually exclusive
590 with all other flags and commands, except for
591 .Fl d
592 (only list interfaces that are down)
593 and
594 .Fl u
595 (only list interfaces that are up).
596 .Pp
597 Only the super-user may modify the configuration of a network interface.
598 .Sh NOTES
599 The media selection system is relatively new and only some drivers support
600 it (or have need for it).
601 .Sh DIAGNOSTICS
602 Messages indicating the specified interface does not exist, the
603 requested address is unknown, or the user is not privileged and
604 tried to alter an interface's configuration.
605 .Sh BUGS
606 IPv6 link-local addresses are required for several basic communication
607 between IPv6 node.
608 If they are deleted by
609 .Nm
610 manually, the kernel might show very strange behavior.
611 So, such manual deletions are strongly discouraged.
612 .Sh SEE ALSO
613 .Xr netstat 1 ,
614 .Xr netintro 4 ,
615 .\" .Xr eon 5 ,
616 .Xr rc 8 ,
617 .Xr routed 8
618 .Sh HISTORY
619 The
620 .Nm
621 command appeared in
622 .Bx 4.2 .