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