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