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