]> git.saurik.com Git - apple/network_cmds.git/blob - ifconfig.tproj/ifconfig.8
cba935e1bdc7ae1a08cf6d5ebfe83138b316a5fe
[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 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
29 .\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.142.2.6.2.1 2008/11/25 02:59:29 kensmith Exp $
30 .\"
31 .Dd June 20, 2008
32 .Dt IFCONFIG 8
33 .Os
34 .Sh NAME
35 .Nm ifconfig
36 .Nd configure network interface parameters
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl L
40 .Op Fl m
41 .Ar interface
42 .Op Cm create
43 .Op Ar address_family
44 .Oo
45 .Ar address
46 .Op Ar dest_address
47 .Oc
48 .Op Ar parameters
49 .Nm
50 .Ar interface
51 .Cm destroy
52 .Nm
53 .Fl a
54 .Op Fl L
55 .Op Fl d
56 .Op Fl m
57 .Op Fl u
58 .Op Fl v
59 .Op Ar address_family
60 .Nm
61 .Fl l
62 .Op Fl d
63 .Op Fl u
64 .Op Ar address_family
65 .Nm
66 .Op Fl L
67 .Op Fl d
68 .Op Fl m
69 .Op Fl u
70 .Op Fl v
71 .Op Fl C
72 .Nm
73 .Ar interface
74 .Cm vlan
75 .Ar vlan-tag
76 .Cm vlandev
77 .Ar iface
78 .Nm
79 .Ar interface
80 .Cm -vlandev
81 .Ar iface
82 .Nm
83 .Ar interface
84 .Cm bonddev
85 .Ar iface
86 .Nm
87 .Ar interface
88 .Cm -bonddev
89 .Ar iface
90 .Nm
91 .Ar interface
92 .Cm bondmode
93 .Ar lacp | static
94 .Sh DESCRIPTION
95 The
96 .Nm
97 utility is used to assign an address
98 to a network interface and/or configure
99 network interface parameters.
100 .Pp
101 The following options are available:
102 .Bl -tag -width indent
103 .It Ar address
104 For the
105 .Tn DARPA Ns -Internet
106 family,
107 the address is either a host name present in the host name data
108 base,
109 .Xr hosts 5 ,
110 or a
111 .Tn DARPA
112 Internet address expressed in the Internet standard
113 .Dq dot notation .
114 .Pp
115 It is also possible to use the CIDR notation (also known as the
116 slash notation) to include the netmask.
117 That is, one can specify an address like
118 .Li 192.168.0.1/16 .
119 .Pp
120 For
121 .Dq inet6
122 family, it is also possible to specify the prefix length using the slash
123 notation, like
124 .Li ::1/128 .
125 See the
126 .Cm prefixlen
127 parameter below for more information.
128 .\" For the Xerox Network Systems(tm) family,
129 .\" addresses are
130 .\" .Ar net:a.b.c.d.e.f ,
131 .\" where
132 .\" .Ar net
133 .\" is the assigned network number (in decimal),
134 .\" and each of the six bytes of the host number,
135 .\" .Ar a
136 .\" through
137 .\" .Ar f ,
138 .\" are specified in hexadecimal.
139 .\" The host number may be omitted on IEEE 802 protocol
140 .\" (Ethernet, FDDI, and Token Ring) interfaces,
141 .\" which use the hardware physical address,
142 .\" and on interfaces other than the first.
143 .\" For the
144 .\" .Tn ISO
145 .\" family, addresses are specified as a long hexadecimal string,
146 .\" as in the Xerox family.
147 .\" However, two consecutive dots imply a zero
148 .\" byte, and the dots are optional, if the user wishes to (carefully)
149 .\" count out long strings of digits in network byte order.
150 .Pp
151 The link-level
152 .Pq Dq link
153 address
154 is specified as a series of colon-separated hex digits.
155 This can be used to
156 e.g.\& set a new MAC address on an ethernet interface, though the
157 mechanism used is not ethernet-specific.
158 If the interface is already
159 up when this option is used, it will be briefly brought down and
160 then brought back up again in order to ensure that the receive
161 filter in the underlying ethernet hardware is properly reprogrammed.
162 .It Ar address_family
163 Specify the
164 address family
165 which affects interpretation of the remaining parameters.
166 Since an interface can receive transmissions in differing protocols
167 with different naming schemes, specifying the address family is recommended.
168 The address or protocol families currently
169 supported are
170 .Dq inet ,
171 .Dq inet6 ,
172 .\".Dq atalk ,
173 .\".Dq ipx ,
174 .\" .Dq iso ,
175 and
176 .Dq link .
177 .\" and
178 .\" .Dq ns .
179 The default is
180 .Dq inet .
181 .Dq ether
182 and
183 .Dq lladdr
184 are synonyms for
185 .Dq link .
186 .It Ar dest_address
187 Specify the address of the correspondent on the other end
188 of a point to point link.
189 .It Ar interface
190 This
191 parameter is a string of the form
192 .Dq name unit ,
193 for example,
194 .Dq Li en0 .
195 \.El
196 .Pp
197 The following parameters may be set with
198 .Nm :
199 .Bl -tag -width indent
200 .It Cm add
201 Another name for the
202 .Cm alias
203 parameter.
204 Introduced for compatibility
205 with
206 .Bsx .
207 .It Cm alias
208 Establish an additional network address for this interface.
209 This is sometimes useful when changing network numbers, and
210 one wishes to accept packets addressed to the old interface.
211 If the address is on the same subnet as the first network address
212 for this interface, a non-conflicting netmask must be given.
213 Usually
214 .Li 0xffffffff
215 is most appropriate.
216 .It Fl alias
217 Remove the network address specified.
218 This would be used if you incorrectly specified an alias, or it
219 was no longer needed.
220 If you have incorrectly set an NS address having the side effect
221 of specifying the host portion, removing all NS addresses will
222 allow you to respecify the host portion.
223 .It Cm anycast
224 (Inet6 only.)
225 Specify that the address configured is an anycast address.
226 Based on the current specification,
227 only routers may configure anycast addresses.
228 Anycast address will not be used as source address of any of outgoing
229 IPv6 packets.
230 .It Cm arp
231 Enable the use of the Address Resolution Protocol
232 .Pq Xr arp 4
233 in mapping
234 between network level addresses and link level addresses (default).
235 This is currently implemented for mapping between
236 .Tn DARPA
237 Internet
238 addresses and
239 .Tn IEEE
240 802 48-bit MAC addresses (Ethernet, FDDI, and Token Ring addresses).
241 .It Fl arp
242 Disable the use of the Address Resolution Protocol
243 .Pq Xr arp 4 .
244 .It Cm broadcast
245 (Inet only.)
246 Specify the address to use to represent broadcasts to the
247 network.
248 The default broadcast address is the address with a host part of all 1's.
249 .It Cm debug
250 Enable driver dependent debugging code; usually, this turns on
251 extra console error logging.
252 .It Fl debug
253 Disable driver dependent debugging code.
254 .It Cm delete
255 Another name for the
256 .Fl alias
257 parameter.
258 .It Cm down
259 Mark an interface
260 .Dq down .
261 When an interface is marked
262 .Dq down ,
263 the system will not attempt to
264 transmit messages through that interface.
265 If possible, the interface will be reset to disable reception as well.
266 This action does not automatically disable routes using the interface.
267 .It Cm ether
268 Another name for the
269 .Cm lladdr
270 parameter.
271 .\" .It Cm ipdst
272 .\" This is used to specify an Internet host who is willing to receive
273 .\" ip packets encapsulating NS packets bound for a remote network.
274 .\" An apparent point to point link is constructed, and
275 .\" the address specified will be taken as the NS address and network
276 .\" of the destination.
277 .\" IP encapsulation of
278 .\" .Tn CLNP
279 .\" packets is done differently.
280 .It Cm lladdr Ar addr
281 Set the link-level address on an interface.
282 This can be used to
283 e.g. set a new MAC address on an ethernet interface, though the
284 mechanism used is not ethernet-specific.
285 The address
286 .Ar addr
287 is specified as a series of colon-separated hex digits.
288 If the interface is already
289 up when this option is used, it will be briefly brought down and
290 then brought back up again in order to ensure that the receive
291 filter in the underlying ethernet hardware is properly reprogrammed.
292 .It Cm media Ar type
293 If the driver supports the media selection system, set the media type
294 of the interface to
295 .Ar type .
296 Some interfaces support the mutually exclusive use of one of several
297 different physical media connectors.
298 For example, a 10Mb/s Ethernet
299 interface might support the use of either
300 .Tn AUI
301 or twisted pair connectors.
302 Setting the media type to
303 .Dq 10base5/AUI
304 would change the currently active connector to the AUI port.
305 Setting it to
306 .Dq 10baseT/UTP
307 would activate twisted pair.
308 Refer to the interfaces' driver
309 specific documentation or man page for a complete list of the
310 available types.
311 .It Cm mediaopt Ar opts
312 If the driver supports the media selection system, set the specified
313 media options on the interface.
314 The
315 .Ar opts
316 argument
317 is a comma delimited list of options to apply to the interface.
318 Refer to the interfaces' driver specific man page for a complete
319 list of available options.
320 .It Fl mediaopt Ar opts
321 If the driver supports the media selection system, disable the
322 specified media options on the interface.
323 .It Cm create
324 Create the specified network pseudo-device.
325 If the interface is given without a unit number, try to create a new
326 device with an arbitrary unit number.
327 If creation of an arbitrary device is successful, the new device name is
328 printed to standard output unless the interface is renamed or destroyed
329 in the same
330 .Nm
331 invocation.
332 .It Cm destroy
333 Destroy the specified network pseudo-device.
334 .It Cm plumb
335 Another name for the
336 .Cm create
337 parameter.
338 Included for
339 .Tn Solaris
340 compatibility.
341 .It Cm unplumb
342 Another name for the
343 .Cm destroy
344 parameter.
345 Included for
346 .Tn Solaris
347 compatibility.
348 .It Cm metric Ar n
349 Set the routing metric of the interface to
350 .Ar n ,
351 default 0.
352 The routing metric is used by the routing protocol
353 .Pq Xr routed 8 .
354 Higher metrics have the effect of making a route
355 less favorable; metrics are counted as additional hops
356 to the destination network or host.
357 .It Cm mtu Ar n
358 Set the maximum transmission unit of the interface to
359 .Ar n ,
360 default is interface specific.
361 The MTU is used to limit the size of packets that are transmitted on an
362 interface.
363 Not all interfaces support setting the MTU, and some interfaces have
364 range restrictions.
365 .It Cm netmask Ar mask
366 .\" (Inet and ISO.)
367 (Inet only.)
368 Specify how much of the address to reserve for subdividing
369 networks into sub-networks.
370 The mask includes the network part of the local address
371 and the subnet part, which is taken from the host field of the address.
372 The mask can be specified as a single hexadecimal number
373 with a leading
374 .Ql 0x ,
375 with a dot-notation Internet address,
376 or with a pseudo-network name listed in the network table
377 .Xr networks 5 .
378 The mask contains 1's for the bit positions in the 32-bit address
379 which are to be used for the network and subnet parts,
380 and 0's for the host part.
381 The mask should contain at least the standard network portion,
382 and the subnet field should be contiguous with the network
383 portion.
384 .Pp
385 The netmask can also be specified in CIDR notation after the address.
386 See the
387 .Ar address
388 option above for more information.
389 .It Cm prefixlen Ar len
390 (Inet6 only.)
391 Specify that
392 .Ar len
393 bits are reserved for subdividing networks into sub-networks.
394 The
395 .Ar len
396 must be integer, and for syntactical reason it must be between 0 to 128.
397 It is almost always 64 under the current IPv6 assignment rule.
398 If the parameter is omitted, 64 is used.
399 .Pp
400 The prefix can also be specified using the slash notation after the address.
401 See the
402 .Ar address
403 option above for more information.
404 .\" see
405 .\" Xr eon 5 .
406 .\" .It Cm nsellength Ar n
407 .\" .Pf ( Tn ISO
408 .\" only)
409 .\" This specifies a trailing number of bytes for a received
410 .\" .Tn NSAP
411 .\" used for local identification, the remaining leading part of which is
412 .\" taken to be the
413 .\" .Tn NET
414 .\" (Network Entity Title).
415 .\" The default value is 1, which is conformant to US
416 .\" .Tn GOSIP .
417 .\" When an ISO address is set in an ifconfig command,
418 .\" it is really the
419 .\" .Tn NSAP
420 .\" which is being specified.
421 .\" For example, in
422 .\" .Tn US GOSIP ,
423 .\" 20 hex digits should be
424 .\" specified in the
425 .\" .Tn ISO NSAP
426 .\" to be assigned to the interface.
427 .\" There is some evidence that a number different from 1 may be useful
428 .\" for
429 .\" .Tn AFI
430 .\" 37 type addresses.
431 .It Cm remove
432 Another name for the
433 .Fl alias
434 parameter.
435 Introduced for compatibility
436 with
437 .Bsx .
438 .Sm off
439 .It Cm link Op Cm 0 No - Cm 2
440 .Sm on
441 Enable special processing of the link level of the interface.
442 These three options are interface specific in actual effect, however,
443 they are in general used to select special modes of operation.
444 An example
445 of this is to enable SLIP compression, or to select the connector type
446 for some Ethernet cards.
447 Refer to the man page for the specific driver
448 for more information.
449 .Sm off
450 .It Fl link Op Cm 0 No - Cm 2
451 .Sm on
452 Disable special processing at the link level with the specified interface.
453 .It Cm up
454 Mark an interface
455 .Dq up .
456 This may be used to enable an interface after an
457 .Dq Nm Cm down .
458 It happens automatically when setting the first address on an interface.
459 If the interface was reset when previously marked down,
460 the hardware will be re-initialized.
461 .El
462 .Pp
463 The following parameters are specific to link aggregate interfaces:
464 .Bl -tag -width indent
465 .It Cm bonddev Ar iface
466 If the interface is a bond pseudo device, associate physical interface
467 .Ar iface
468 with it. By default, the bond pseudo device is in LACP
469 (Link Aggregation Control Protocol) mode (see \fBbondmode\fR below). In
470 this mode, the device conforms to the IEEE 802.3ad Link Aggregation
471 specification.
472 .Pp
473 If this is the first physical interface to be associated with the bond
474 interface, the bond interface inherits the ethernet address from the
475 physical interface. Physical interfaces that are added to the bond have
476 their ethernet address re-programmed so that all members of the bond have
477 the same ethernet address. If the physical interface is subsequently
478 removed from the bond using
479 .Fl bonddev ,
480 a new ethernet address is chosen from the remaining interfaces, and all
481 interfaces are re-programmed again with the new ethernet address. If no
482 remaining interfaces exist, the bond interface's ethernet address is cleared.
483 .Pp
484 If the specified physical interface
485 .Ar iface
486 is not capable of having its ethernet address re-programmed, the
487 .Cm bonddev
488 command will fail.
489 .Pp
490 Once the physical interface
491 .Ar iface
492 is successfully associated with the bond interface, all received packets
493 are diverted to the bond interface. The physical interface is no longer
494 useable on its own, and remains that way until it is removed from the bond using
495 .Fl bonddev .
496 .Pp
497 It is possible that the specified interface
498 .Ar iface
499 is not capable of aggregating, and may remain unused until the operating
500 conditions change.
501 .Pp
502 The link status of the bond interface depends on the state of link aggregation.
503 If no active partner is detected, the link status will remain inactive.
504 .Pp
505 To monitor the 802.3ad Link Aggregation state, use the
506 .Fl b
507 option.
508 .Pp
509 A physical interface that is associated with a vlan pseudo device cannot
510 at the same time be associated with a bond pseudo device. A physical interface
511 cannot be associated with more than one bond pseudo device at the same time.
512 .Pp
513 It is not possible to associate a bond with pseudo interfaces such as vlan.
514 Only physical ethernet interfaces may be associated with a bond.
515 .It Fl bonddev Ar iface
516 If the interface is a bond pseudo device, disassociate the physical interface
517 .Ar iface
518 from it. Before the interface is removed from the bond, the bond device
519 announces to the link partner that the interface is now individual and
520 no longer aggregatable.
521 If the physical
522 .Ar iface
523 is the last interface in the bond, the bond interface clears its link address.
524 .It Cm bondmode Ar lacp | static
525 If the interface is a bond pseudo device, this option will set the \fImode\fR
526 on the bond interface. The two currently supported modes are
527 .Ar lacp
528 and
529 .Ar static .
530 The default mode is
531 .Ar lacp .
532 .Pp
533 To enable static mode (and turn off LACP), specify
534 .Ar static .
535 In static mode, a member interface is made an active part of the
536 link aggregate as long as the link status is active.
537 .Pp
538 To re-enable LACP mode, specify
539 .Ar lacp .
540 .El
541 .Pp
542 The following parameters are specific to IP tunnel interfaces,
543 .Xr gif 4 :
544 .Bl -tag -width indent
545 .It Cm tunnel Ar src_addr dest_addr
546 Configure the physical source and destination address for IP tunnel
547 interfaces.
548 The arguments
549 .Ar src_addr
550 and
551 .Ar dest_addr
552 are interpreted as the outer source/destination for the encapsulating
553 IPv4/IPv6 header.
554 .It Fl tunnel
555 Unconfigure the physical source and destination address for IP tunnel
556 interfaces previously configured with
557 .Cm tunnel .
558 .It Cm deletetunnel
559 Another name for the
560 .Fl tunnel
561 parameter.
562 .El
563 .Pp
564 The following parameters are specific to bridge interfaces:
565 .Bl -tag -width indent
566 .It Cm addm Ar interface
567 Add the interface named by
568 .Ar interface
569 as a member of the bridge.
570 The interface is put into promiscuous mode
571 so that it can receive every packet sent on the network.
572 .It Cm deletem Ar interface
573 Remove the interface named by
574 .Ar interface
575 from the bridge.
576 Promiscuous mode is disabled on the interface when
577 it is removed from the bridge.
578 .It Cm maxaddr Ar size
579 Set the size of the bridge address cache to
580 .Ar size .
581 The default is 100 entries.
582 .It Cm timeout Ar seconds
583 Set the timeout of address cache entries to
584 .Ar seconds
585 seconds.
586 If
587 .Ar seconds
588 is zero, then address cache entries will not be expired.
589 The default is 240 seconds.
590 .It Cm addr
591 Display the addresses that have been learned by the bridge.
592 .It Cm static Ar interface-name Ar address
593 Add a static entry into the address cache pointing to
594 .Ar interface-name .
595 Static entries are never aged out of the cache or re-placed, even if the
596 address is seen on a different interface.
597 .It Cm deladdr Ar address
598 Delete
599 .Ar address
600 from the address cache.
601 .It Cm flush
602 Delete all dynamically-learned addresses from the address cache.
603 .It Cm flushall
604 Delete all addresses, including static addresses, from the address cache.
605 .It Cm discover Ar interface
606 Mark an interface as a
607 .Dq discovering
608 interface.
609 When the bridge has no address cache entry
610 (either dynamic or static)
611 for the destination address of a packet,
612 the bridge will forward the packet to all
613 member interfaces marked as
614 .Dq discovering .
615 This is the default for all interfaces added to a bridge.
616 .It Cm -discover Ar interface
617 Clear the
618 .Dq discovering
619 attribute on a member interface.
620 For packets without the
621 .Dq discovering
622 attribute, the only packets forwarded on the interface are broadcast
623 or multicast packets and packets for which the destination address
624 is known to be on the interface's segment.
625 .It Cm learn Ar interface
626 Mark an interface as a
627 .Dq learning
628 interface.
629 When a packet arrives on such an interface, the source
630 address of the packet is entered into the address cache as being a
631 destination address on the interface's segment.
632 This is the default for all interfaces added to a bridge.
633 .It Cm -learn Ar interface
634 Clear the
635 .Dq learning
636 attribute on a member interface.
637 .It Cm sticky Ar interface
638 Mark an interface as a
639 .Dq sticky
640 interface.
641 Dynamically learned address entries are treated at static once entered into
642 the cache.
643 Sticky entries are never aged out of the cache or replaced, even if the
644 address is seen on a different interface.
645 .It Cm -sticky Ar interface
646 Clear the
647 .Dq sticky
648 attribute on a member interface.
649 .It Cm private Ar interface
650 Mark an interface as a
651 .Dq private
652 interface.
653 A private interface does not forward any traffic to any other port that is also
654 a private interface.
655 .It Cm -private Ar interface
656 Clear the
657 .Dq private
658 attribute on a member interface.
659 .It Cm span Ar interface
660 Add the interface named by
661 .Ar interface
662 as a span port on the bridge.
663 Span ports transmit a copy of every frame received by the bridge.
664 This is most useful for snooping a bridged network passively on
665 another host connected to one of the span ports of the bridge.
666 .It Cm -span Ar interface
667 Delete the interface named by
668 .Ar interface
669 from the list of span ports of the bridge.
670 .It Cm stp Ar interface
671 Enable Spanning Tree protocol on
672 .Ar interface .
673 The
674 .Xr if_bridge 4
675 driver has support for the IEEE 802.1D Spanning Tree protocol (STP).
676 Spanning Tree is used to detect and remove loops in a network topology.
677 .It Cm -stp Ar interface
678 Disable Spanning Tree protocol on
679 .Ar interface .
680 This is the default for all interfaces added to a bridge.
681 .It Cm edge Ar interface
682 Set
683 .Ar interface
684 as an edge port.
685 An edge port connects directly to end stations cannot create bridging
686 loops in the network, this allows it to transition straight to forwarding.
687 .It Cm -edge Ar interface
688 Disable edge status on
689 .Ar interface .
690 .It Cm autoedge Ar interface
691 Allow
692 .Ar interface
693 to automatically detect edge status.
694 This is the default for all interfaces added to a bridge.
695 .It Cm -autoedge Ar interface
696 Disable automatic edge status on
697 .Ar interface .
698 .It Cm ptp Ar interface
699 Set the
700 .Ar interface
701 as a point to point link.
702 This is required for straight transitions to forwarding and
703 should be enabled on a direct link to another RSTP capable switch.
704 .It Cm -ptp Ar interface
705 Disable point to point link status on
706 .Ar interface .
707 This should be disabled for a half duplex link and for an interface
708 connected to a shared network segment,
709 like a hub or a wireless network.
710 .It Cm autoptp Ar interface
711 Automatically detect the point to point status on
712 .Ar interface
713 by checking the full duplex link status.
714 This is the default for interfaces added to the bridge.
715 .It Cm -autoptp Ar interface
716 Disable automatic point to point link detection on
717 .Ar interface .
718 .It Cm maxage Ar seconds
719 Set the time that a Spanning Tree protocol configuration is valid.
720 The default is 20 seconds.
721 The minimum is 6 seconds and the maximum is 40 seconds.
722 .It Cm fwddelay Ar seconds
723 Set the time that must pass before an interface begins forwarding
724 packets when Spanning Tree is enabled.
725 The default is 15 seconds.
726 The minimum is 4 seconds and the maximum is 30 seconds.
727 .It Cm hellotime Ar seconds
728 Set the time between broadcasting of Spanning Tree protocol
729 configuration messages.
730 The hello time may only be changed when operating in legacy stp mode.
731 The default is 2 seconds.
732 The minimum is 1 second and the maximum is 2 seconds.
733 .It Cm priority Ar value
734 Set the bridge priority for Spanning Tree.
735 The default is 32768.
736 The minimum is 0 and the maximum is 61440.
737 .It Cm proto Ar value
738 Set the Spanning Tree protocol.
739 The default is rstp.
740 The available options are stp and rstp.
741 .It Cm holdcnt Ar value
742 Set the transmit hold count for Spanning Tree.
743 This is the number of packets transmitted before being rate limited.
744 The default is 6.
745 The minimum is 1 and the maximum is 10.
746 .It Cm ifpriority Ar interface Ar value
747 Set the Spanning Tree priority of
748 .Ar interface
749 to
750 .Ar value .
751 The default is 128.
752 The minimum is 0 and the maximum is 240.
753 .It Cm ifpathcost Ar interface Ar value
754 Set the Spanning Tree path cost of
755 .Ar interface
756 to
757 .Ar value .
758 The default is calculated from the link speed.
759 To change a previously selected path cost back to automatic, set the
760 cost to 0.
761 The minimum is 1 and the maximum is 200000000.
762 .It Cm ifmaxaddr Ar interface Ar size
763 Set the maximum number of hosts allowed from an interface, packets with unknown
764 source addresses are dropped until an existing host cache entry expires or is
765 removed.
766 Set to 0 to disable.
767 .El
768 .Pp
769 The following parameters are specific to vlan interfaces:
770 .Bl -tag -width indent
771 .It Cm vlan Ar vlan_tag
772 Set the VLAN tag value to
773 .Ar vlan_tag .
774 This value is a 16-bit number which is used to create an 802.1Q
775 VLAN header for packets sent from the
776 .Xr vlan 4
777 interface.
778 Note that
779 .Cm vlan
780 and
781 .Cm vlandev
782 must both be set at the same time.
783 .It Cm vlandev Ar iface
784 Associate the physical interface
785 .Ar iface
786 with a
787 .Xr vlan 4
788 interface.
789 Packets transmitted through the
790 .Xr vlan 4
791 interface will be
792 diverted to the specified physical interface
793 .Ar iface
794 with 802.1Q VLAN encapsulation.
795 Packets with 802.1Q encapsulation received
796 by the parent interface with the correct VLAN tag will be diverted to
797 the associated
798 .Xr vlan 4
799 pseudo-interface.
800 The
801 .Xr vlan 4
802 interface is assigned a
803 copy of the parent interface's flags and the parent's ethernet address.
804 The
805 .Cm vlandev
806 and
807 .Cm vlan
808 must both be set at the same time.
809 If the
810 .Xr vlan 4
811 interface already has
812 a physical interface associated with it, this command will fail.
813 To
814 change the association to another physical interface, the existing
815 association must be cleared first.
816 .Pp
817 Note: if the hardware tagging capability
818 is set on the parent interface, the
819 .Xr vlan 4
820 pseudo
821 interface's behavior changes:
822 the
823 .Xr vlan 4
824 interface recognizes that the
825 parent interface supports insertion and extraction of VLAN tags on its
826 own (usually in firmware) and that it should pass packets to and from
827 the parent unaltered.
828 .It Fl vlandev Op Ar iface
829 If the driver is a
830 .Xr vlan 4
831 pseudo device, disassociate the parent interface from it.
832 This breaks the link between the
833 .Xr vlan 4
834 interface and its parent,
835 clears its VLAN tag, flags and its link address and shuts the interface down.
836 The
837 .Ar iface
838 argument is useless and hence deprecated.
839 .El
840 .Pp
841 The
842 .Nm
843 utility displays the current configuration for a network interface
844 when no optional parameters are supplied.
845 If a protocol family is specified,
846 .Nm
847 will report only the details specific to that protocol family.
848 .Pp
849 If the
850 .Fl m
851 flag is passed before an interface name,
852 .Nm
853 will display the capability list and all
854 of the supported media for the specified interface.
855 .Pp
856 If
857 .Fl L
858 flag is supplied, address lifetime is displayed for IPv6 addresses,
859 as time offset string.
860 .Pp
861 Optionally, the
862 .Fl a
863 flag may be used instead of an interface name.
864 This flag instructs
865 .Nm
866 to display information about all interfaces in the system.
867 The
868 .Fl d
869 flag limits this to interfaces that are down, and
870 .Fl u
871 limits this to interfaces that are up.
872 When no arguments are given,
873 .Fl a
874 is implied.
875 .Pp
876 The
877 .Fl l
878 flag may be used to list all available interfaces on the system, with
879 no other additional information.
880 Use of this flag is mutually exclusive
881 with all other flags and commands, except for
882 .Fl d
883 (only list interfaces that are down)
884 and
885 .Fl u
886 (only list interfaces that are up).
887 .Pp
888 The
889 .Fl v
890 flag may be used to get more verbose status for an interface.
891 .Pp
892 The
893 .Fl C
894 flag may be used to list all of the interface cloners available on
895 the system, with no additional information.
896 Use of this flag is mutually exclusive with all other flags and commands.
897 .Pp
898 For bridge interfaces, the list of addresses learned by the bridge is not shown when displaying information about
899 all interfaces except when the
900 .Fl v
901 flag is used.
902 .Pp
903 Only the super-user may modify the configuration of a network interface.
904 .Sh NOTES
905 The media selection system is relatively new and only some drivers support
906 it (or have need for it).
907 .Sh EXAMPLES
908 Assign the IPv4 address
909 .Li 192.0.2.10 ,
910 with a network mask of
911 .Li 255.255.255.0 ,
912 to the interface
913 .Li en0 :
914 .Dl # ifconfig en0 inet 192.0.2.10 netmask 255.255.255.0
915 .Pp
916 Add the IPv4 address
917 .Li 192.0.2.45 ,
918 with the CIDR network prefix
919 .Li /28 ,
920 to the interface
921 .Li en0 ,
922 using
923 .Cm add
924 as a synonym for the canonical form of the option
925 .Cm alias :
926 .Dl # ifconfig en0 inet 192.0.2.45/28 add
927 .Pp
928 Remove the IPv4 address
929 .Li 192.0.2.45
930 from the interface
931 .Li en0 :
932 .Dl # ifconfig en0 inet 192.0.2.45 -alias
933 .Pp
934 Add the IPv6 address
935 .Li 2001:DB8:DBDB::123/48
936 to the interface
937 .Li en0 :
938 .Dl # ifconfig en0 inet6 2001:db8:bdbd::123 prefixlen 48 alias
939 Note that lower case hexadecimal IPv6 addresses are acceptable.
940 .Pp
941 Remove the IPv6 address added in the above example,
942 using the
943 .Li /
944 character as shorthand for the network prefix,
945 and using
946 .Cm delete
947 as a synonym for the canonical form of the option
948 .Fl alias :
949 .Dl # ifconfig en0 inet6 2001:db8:bdbd::123/48 delete
950 .Pp
951 Configure the interface
952 .Li en1 ,
953 to use 100baseTX, full duplex Ethernet media options:
954 .Dl # ifconfig en1 media 100baseTX mediaopt full-duplex
955 .Pp
956 Create the software network interface
957 .Li gif1 :
958 .Dl # ifconfig gif1 create
959 .Pp
960 Destroy the software network interface
961 .Li gif1 :
962 .Dl # ifconfig gif1 destroy
963 .Sh DIAGNOSTICS
964 Messages indicating the specified interface does not exist, the
965 requested address is unknown, or the user is not privileged and
966 tried to alter an interface's configuration.
967 .Sh SEE ALSO
968 .Xr netstat 1 ,
969 .Xr netintro 4 ,
970 .Xr sysctl 8
971 .Sh HISTORY
972 The
973 .Nm
974 utility appeared in
975 .Bx 4.2 .
976 .Sh BUGS
977 Basic IPv6 node operation requires a link-local address on each
978 interface configured for IPv6.
979 Normally, such an address is automatically configured by the
980 kernel on each interface added to the system; this behaviour may
981 be disabled by setting the sysctl MIB variable
982 .Va net.inet6.ip6.auto_linklocal
983 to 0.
984 .Pp
985 If you delete such an address using
986 .Nm ,
987 the kernel may act very odd.
988 Do this at your own risk.