]> git.saurik.com Git - apple/network_cmds.git/blob - ifconfig.tproj/ifconfig.8
network_cmds-433.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 .El
562 .Pp
563 The following parameters are specific to link aggregate interfaces:
564 .Bl -tag -width indent
565 .It Cm bonddev Ar iface
566 If the interface is a bond pseudo device, associate physical interface
567 .Ar iface
568 with it. By default, the bond pseudo device is in LACP
569 (Link Aggregation Control Protocol) mode (see \fBbondmode\fR below). In
570 this mode, the device conforms to the IEEE 802.3ad Link Aggregation
571 specification.
572 .Pp
573 If this is the first physical interface to be associated with the bond
574 interface, the bond interface inherits the ethernet address from the
575 physical interface. Physical interfaces that are added to the bond have
576 their ethernet address re-programmed so that all members of the bond have
577 the same ethernet address. If the physical interface is subsequently
578 removed from the bond using
579 .Fl bonddev ,
580 a new ethernet address is chosen from the remaining interfaces, and all
581 interfaces are re-programmed again with the new ethernet address. If no
582 remaining interfaces exist, the bond interface's ethernet address is cleared.
583 .Pp
584 If the specified physical interface
585 .Ar iface
586 is not capable of having its ethernet address re-programmed, the
587 .Cm bonddev
588 command will fail.
589 .Pp
590 Once the physical interface
591 .Ar iface
592 is successfully associated with the bond interface, all received packets
593 are diverted to the bond interface. The physical interface is no longer
594 useable on its own, and remains that way until it is removed from the bond using
595 .Fl bonddev .
596 .Pp
597 It is possible that the specified interface
598 .Ar iface
599 is not capable of aggregating, and may remain unused until the operating
600 conditions change.
601 .Pp
602 The link status of the bond interface depends on the state of link aggregation.
603 If no active partner is detected, the link status will remain inactive.
604 .Pp
605 To monitor the 802.3ad Link Aggregation state, use the
606 .Fl b
607 option.
608 .Pp
609 A physical interface that is associated with a vlan pseudo device cannot
610 at the same time be associated with a bond pseudo device. A physical interface
611 cannot be associated with more than one bond pseudo device at the same time.
612 .Pp
613 It is not possible to associate a bond with pseudo interfaces such as vlan.
614 Only physical ethernet interfaces may be associated with a bond.
615 .It Fl bonddev Ar iface
616 If the interface is a bond pseudo device, disassociate the physical interface
617 .Ar iface
618 from it. Before the interface is removed from the bond, the bond device
619 announces to the link partner that the interface is now individual and
620 no longer aggregatable.
621 If the physical
622 .Ar iface
623 is the last interface in the bond, the bond interface clears its link address.
624 .It Cm bondmode Ar lacp | static
625 If the interface is a bond pseudo device, this option will set the \fImode\fR
626 on the bond interface. The two currently supported modes are
627 .Ar lacp
628 and
629 .Ar static .
630 The default mode is
631 .Ar lacp .
632 .Pp
633 To enable static mode (and turn off LACP), specify
634 .Ar static .
635 In static mode, a member interface is made an active part of the
636 link aggregate as long as the link status is active.
637 .Pp
638 To re-enable LACP mode, specify
639 .Ar lacp .
640 .El
641 .Pp
642 The following parameters are specific to IP tunnel interfaces,
643 .Xr gif 4 :
644 .Bl -tag -width indent
645 .It Cm tunnel Ar src_addr dest_addr
646 Configure the physical source and destination address for IP tunnel
647 interfaces.
648 The arguments
649 .Ar src_addr
650 and
651 .Ar dest_addr
652 are interpreted as the outer source/destination for the encapsulating
653 IPv4/IPv6 header.
654 .It Fl tunnel
655 Unconfigure the physical source and destination address for IP tunnel
656 interfaces previously configured with
657 .Cm tunnel .
658 .It Cm deletetunnel
659 Another name for the
660 .Fl tunnel
661 parameter.
662 .El
663 .Pp
664 The following parameters are specific to bridge interfaces:
665 .Bl -tag -width indent
666 .It Cm addm Ar interface
667 Add the interface named by
668 .Ar interface
669 as a member of the bridge.
670 The interface is put into promiscuous mode
671 so that it can receive every packet sent on the network.
672 .It Cm deletem Ar interface
673 Remove the interface named by
674 .Ar interface
675 from the bridge.
676 Promiscuous mode is disabled on the interface when
677 it is removed from the bridge.
678 .It Cm maxaddr Ar size
679 Set the size of the bridge address cache to
680 .Ar size .
681 The default is 100 entries.
682 .It Cm timeout Ar seconds
683 Set the timeout of address cache entries to
684 .Ar seconds
685 seconds.
686 If
687 .Ar seconds
688 is zero, then address cache entries will not be expired.
689 The default is 240 seconds.
690 .It Cm addr
691 Display the addresses that have been learned by the bridge.
692 .It Cm static Ar interface-name Ar address
693 Add a static entry into the address cache pointing to
694 .Ar interface-name .
695 Static entries are never aged out of the cache or re-placed, even if the
696 address is seen on a different interface.
697 .It Cm deladdr Ar address
698 Delete
699 .Ar address
700 from the address cache.
701 .It Cm flush
702 Delete all dynamically-learned addresses from the address cache.
703 .It Cm flushall
704 Delete all addresses, including static addresses, from the address cache.
705 .It Cm discover Ar interface
706 Mark an interface as a
707 .Dq discovering
708 interface.
709 When the bridge has no address cache entry
710 (either dynamic or static)
711 for the destination address of a packet,
712 the bridge will forward the packet to all
713 member interfaces marked as
714 .Dq discovering .
715 This is the default for all interfaces added to a bridge.
716 .It Cm -discover Ar interface
717 Clear the
718 .Dq discovering
719 attribute on a member interface.
720 For packets without the
721 .Dq discovering
722 attribute, the only packets forwarded on the interface are broadcast
723 or multicast packets and packets for which the destination address
724 is known to be on the interface's segment.
725 .It Cm learn Ar interface
726 Mark an interface as a
727 .Dq learning
728 interface.
729 When a packet arrives on such an interface, the source
730 address of the packet is entered into the address cache as being a
731 destination address on the interface's segment.
732 This is the default for all interfaces added to a bridge.
733 .It Cm -learn Ar interface
734 Clear the
735 .Dq learning
736 attribute on a member interface.
737 .\".It Cm sticky Ar interface
738 .\"Mark an interface as a
739 .\".Dq sticky
740 .\"interface.
741 .\"Dynamically learned address entries are treated at static once entered into
742 .\"the cache.
743 .\"Sticky entries are never aged out of the cache or replaced, even if the
744 .\"address is seen on a different interface.
745 .\".It Cm -sticky Ar interface
746 .\"Clear the
747 .\".Dq sticky
748 .\"attribute on a member interface.
749 .\".It Cm private Ar interface
750 .\"Mark an interface as a
751 .\".Dq private
752 .\"interface.
753 .\"A private interface does not forward any traffic to any other port that is also
754 .\"a private interface.
755 .\".It Cm -private Ar interface
756 .\"Clear the
757 .\".Dq private
758 .\"attribute on a member interface.
759 .\".It Cm span Ar interface
760 .\"Add the interface named by
761 .\".Ar interface
762 .\"as a span port on the bridge.
763 .\"Span ports transmit a copy of every frame received by the bridge.
764 .\"This is most useful for snooping a bridged network passively on
765 .\"another host connected to one of the span ports of the bridge.
766 .\".It Cm -span Ar interface
767 .\"Delete the interface named by
768 .\".Ar interface
769 .\"from the list of span ports of the bridge.
770 .It Cm stp Ar interface
771 Enable Spanning Tree protocol on
772 .Ar interface .
773 The
774 .Xr if_bridge 4
775 driver has support for the IEEE 802.1D Spanning Tree protocol (STP).
776 Spanning Tree is used to detect and remove loops in a network topology.
777 .It Cm -stp Ar interface
778 Disable Spanning Tree protocol on
779 .Ar interface .
780 This is the default for all interfaces added to a bridge.
781 .\".It Cm edge Ar interface
782 .\"Set
783 .\".Ar interface
784 .\"as an edge port.
785 .\"An edge port connects directly to end stations cannot create bridging
786 .\"loops in the network, this allows it to transition straight to forwarding.
787 .\".It Cm -edge Ar interface
788 .\"Disable edge status on
789 .\".Ar interface .
790 .\".It Cm autoedge Ar interface
791 .\"Allow
792 .\".Ar interface
793 .\"to automatically detect edge status.
794 .\"This is the default for all interfaces added to a bridge.
795 .\".It Cm -autoedge Ar interface
796 .\"Disable automatic edge status on
797 .\".Ar interface .
798 .\".It Cm ptp Ar interface
799 .\"Set the
800 .\".Ar interface
801 .\"as a point to point link.
802 .\"This is required for straight transitions to forwarding and
803 .\"should be enabled on a direct link to another RSTP capable switch.
804 .\".It Cm -ptp Ar interface
805 .\"Disable point to point link status on
806 .\".Ar interface .
807 .\"This should be disabled for a half duplex link and for an interface
808 .\"connected to a shared network segment,
809 .\"like a hub or a wireless network.
810 .\".It Cm autoptp Ar interface
811 .\"Automatically detect the point to point status on
812 .\".Ar interface
813 .\"by checking the full duplex link status.
814 .\"This is the default for interfaces added to the bridge.
815 .\".It Cm -autoptp Ar interface
816 .\"Disable automatic point to point link detection on
817 .\".Ar interface .
818 .It Cm maxage Ar seconds
819 Set the time that a Spanning Tree protocol configuration is valid.
820 The default is 20 seconds.
821 The minimum is 6 seconds and the maximum is 40 seconds.
822 .It Cm fwddelay Ar seconds
823 Set the time that must pass before an interface begins forwarding
824 packets when Spanning Tree is enabled.
825 The default is 15 seconds.
826 The minimum is 4 seconds and the maximum is 30 seconds.
827 .It Cm hellotime Ar seconds
828 Set the time between broadcasting of Spanning Tree protocol
829 configuration messages.
830 The hello time may only be changed when operating in legacy stp mode.
831 The default is 2 seconds.
832 The minimum is 1 second and the maximum is 2 seconds.
833 .It Cm priority Ar value
834 Set the bridge priority for Spanning Tree.
835 The default is 32768.
836 The minimum is 0 and the maximum is 61440.
837 .\".It Cm proto Ar value
838 .\"Set the Spanning Tree protocol.
839 .\"The default is rstp.
840 .\"The available options are stp and rstp.
841 .\".It Cm holdcnt Ar value
842 .\"Set the transmit hold count for Spanning Tree.
843 .\"This is the number of packets transmitted before being rate limited.
844 .\"The default is 6.
845 .\"The minimum is 1 and the maximum is 10.
846 .It Cm ifpriority Ar interface Ar value
847 Set the Spanning Tree priority of
848 .Ar interface
849 to
850 .Ar value .
851 The default is 128.
852 The minimum is 0 and the maximum is 240.
853 .It Cm ifpathcost Ar interface Ar value
854 Set the Spanning Tree path cost of
855 .Ar interface
856 to
857 .Ar value .
858 The default is calculated from the link speed.
859 To change a previously selected path cost back to automatic, set the
860 cost to 0.
861 The minimum is 1 and the maximum is 200000000.
862 .It Cm ifmaxaddr Ar interface Ar size
863 Set the maximum number of hosts allowed from an interface, packets with unknown
864 source addresses are dropped until an existing host cache entry expires or is
865 removed.
866 Set to 0 to disable.
867 .El
868 .Pp
869 The following parameters are specific to vlan interfaces:
870 .Bl -tag -width indent
871 .It Cm vlan Ar vlan_tag
872 Set the VLAN tag value to
873 .Ar vlan_tag .
874 This value is a 16-bit number which is used to create an 802.1Q
875 VLAN header for packets sent from the
876 .Xr vlan 4
877 interface.
878 Note that
879 .Cm vlan
880 and
881 .Cm vlandev
882 must both be set at the same time.
883 .It Cm vlandev Ar iface
884 Associate the physical interface
885 .Ar iface
886 with a
887 .Xr vlan 4
888 interface.
889 Packets transmitted through the
890 .Xr vlan 4
891 interface will be
892 diverted to the specified physical interface
893 .Ar iface
894 with 802.1Q VLAN encapsulation.
895 Packets with 802.1Q encapsulation received
896 by the parent interface with the correct VLAN tag will be diverted to
897 the associated
898 .Xr vlan 4
899 pseudo-interface.
900 The
901 .Xr vlan 4
902 interface is assigned a
903 copy of the parent interface's flags and the parent's ethernet address.
904 The
905 .Cm vlandev
906 and
907 .Cm vlan
908 must both be set at the same time.
909 If the
910 .Xr vlan 4
911 interface already has
912 a physical interface associated with it, this command will fail.
913 To
914 change the association to another physical interface, the existing
915 association must be cleared first.
916 .Pp
917 Note: if the hardware tagging capability
918 is set on the parent interface, the
919 .Xr vlan 4
920 pseudo
921 interface's behavior changes:
922 the
923 .Xr vlan 4
924 interface recognizes that the
925 parent interface supports insertion and extraction of VLAN tags on its
926 own (usually in firmware) and that it should pass packets to and from
927 the parent unaltered.
928 .It Fl vlandev Op Ar iface
929 If the driver is a
930 .Xr vlan 4
931 pseudo device, disassociate the parent interface from it.
932 This breaks the link between the
933 .Xr vlan 4
934 interface and its parent,
935 clears its VLAN tag, flags and its link address and shuts the interface down.
936 The
937 .Ar iface
938 argument is useless and hence deprecated.
939 .El
940 .Pp
941 The
942 .Nm
943 utility displays the current configuration for a network interface
944 when no optional parameters are supplied.
945 If a protocol family is specified,
946 .Nm
947 will report only the details specific to that protocol family.
948 .Pp
949 If the
950 .Fl m
951 flag is passed before an interface name,
952 .Nm
953 will display the capability list and all
954 of the supported media for the specified interface.
955 .Pp
956 If
957 .Fl L
958 flag is supplied, address lifetime is displayed for IPv6 addresses,
959 as time offset string.
960 .Pp
961 Optionally, the
962 .Fl a
963 flag may be used instead of an interface name.
964 This flag instructs
965 .Nm
966 to display information about all interfaces in the system.
967 The
968 .Fl d
969 flag limits this to interfaces that are down, and
970 .Fl u
971 limits this to interfaces that are up.
972 When no arguments are given,
973 .Fl a
974 is implied.
975 .Pp
976 The
977 .Fl l
978 flag may be used to list all available interfaces on the system, with
979 no other additional information.
980 Use of this flag is mutually exclusive
981 with all other flags and commands, except for
982 .Fl d
983 (only list interfaces that are down)
984 and
985 .Fl u
986 (only list interfaces that are up).
987 .Pp
988 The
989 .Fl v
990 flag may be used to get more verbose status for an interface.
991 .Pp
992 The
993 .Fl C
994 flag may be used to list all of the interface cloners available on
995 the system, with no additional information.
996 Use of this flag is mutually exclusive with all other flags and commands.
997 .Pp
998 The
999 .Fl r
1000 flag may be used to show additional information related to the count of route references on the network interface.
1001 .Pp
1002 For bridge interfaces, the list of addresses learned by the bridge is not shown when displaying information about
1003 all interfaces except when the
1004 .Fl v
1005 flag is used.
1006 .Pp
1007 Only the super-user may modify the configuration of a network interface.
1008 .Sh NOTES
1009 The media selection system is relatively new and only some drivers support
1010 it (or have need for it).
1011 .Sh EXAMPLES
1012 Assign the IPv4 address
1013 .Li 192.0.2.10 ,
1014 with a network mask of
1015 .Li 255.255.255.0 ,
1016 to the interface
1017 .Li en0 :
1018 .Dl # ifconfig en0 inet 192.0.2.10 netmask 255.255.255.0
1019 .Pp
1020 Add the IPv4 address
1021 .Li 192.0.2.45 ,
1022 with the CIDR network prefix
1023 .Li /28 ,
1024 to the interface
1025 .Li en0 ,
1026 using
1027 .Cm add
1028 as a synonym for the canonical form of the option
1029 .Cm alias :
1030 .Dl # ifconfig en0 inet 192.0.2.45/28 add
1031 .Pp
1032 Remove the IPv4 address
1033 .Li 192.0.2.45
1034 from the interface
1035 .Li en0 :
1036 .Dl # ifconfig en0 inet 192.0.2.45 -alias
1037 .Pp
1038 Add the IPv6 address
1039 .Li 2001:DB8:DBDB::123/48
1040 to the interface
1041 .Li en0 :
1042 .Dl # ifconfig en0 inet6 2001:db8:bdbd::123 prefixlen 48 alias
1043 Note that lower case hexadecimal IPv6 addresses are acceptable.
1044 .Pp
1045 Remove the IPv6 address added in the above example,
1046 using the
1047 .Li /
1048 character as shorthand for the network prefix,
1049 and using
1050 .Cm delete
1051 as a synonym for the canonical form of the option
1052 .Fl alias :
1053 .Dl # ifconfig en0 inet6 2001:db8:bdbd::123/48 delete
1054 .Pp
1055 Configure the interface
1056 .Li en1 ,
1057 to use 100baseTX, full duplex Ethernet media options:
1058 .Dl # ifconfig en1 media 100baseTX mediaopt full-duplex
1059 .Pp
1060 Create the software network interface
1061 .Li gif1 :
1062 .Dl # ifconfig gif1 create
1063 .Pp
1064 Destroy the software network interface
1065 .Li gif1 :
1066 .Dl # ifconfig gif1 destroy
1067 .Sh DIAGNOSTICS
1068 Messages indicating the specified interface does not exist, the
1069 requested address is unknown, or the user is not privileged and
1070 tried to alter an interface's configuration.
1071 .Sh SEE ALSO
1072 .Xr netstat 1 ,
1073 .Xr netintro 4 ,
1074 .Xr sysctl 8
1075 .Sh HISTORY
1076 The
1077 .Nm
1078 utility appeared in
1079 .Bx 4.2 .
1080 .Sh BUGS
1081 Basic IPv6 node operation requires a link-local address on each
1082 interface configured for IPv6.
1083 Normally, such an address is automatically configured by the
1084 kernel on each interface added to the system; this behaviour may
1085 be disabled by setting the sysctl MIB variable
1086 .Va net.inet6.ip6.auto_linklocal
1087 to 0.
1088 .Pp
1089 If you delete such an address using
1090 .Nm ,
1091 the kernel may act very odd.
1092 Do this at your own risk.