]> git.saurik.com Git - apple/network_cmds.git/blame - ifconfig.tproj/ifconfig.8
network_cmds-245.19.tar.gz
[apple/network_cmds.git] / ifconfig.tproj / ifconfig.8
CommitLineData
b7080c8e
A
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
7ba0088d 13.\" must display the following acknowledgment:
b7080c8e
A
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
7ba0088d
A
32.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
33.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.27.2.14 2001/08/23 06:35:38 yar Exp $
b7080c8e 34.\"
2b484d24 35.Dd July 15, 2004
b7080c8e 36.Dt IFCONFIG 8
7ba0088d 37.Os
b7080c8e
A
38.Sh NAME
39.Nm ifconfig
40.Nd configure network interface parameters
41.Sh SYNOPSIS
7ba0088d
A
42.Nm
43.Op Fl L
44.Op Fl m
45.Ar interface
46.Op Cm create
47.Op Ar address_family
b7080c8e 48.Oo
7ba0088d 49.Ar address Ns Op Cm / Ns Ar prefixlength
b7080c8e
A
50.Op Ar dest_address
51.Oc
52.Op Ar parameters
7ba0088d 53.Nm
b7080c8e 54.Ar interface
7ba0088d
A
55.Cm destroy
56.Nm
b7080c8e 57.Fl a
7ba0088d 58.Op Fl L
b7080c8e 59.Op Fl d
7ba0088d 60.Op Fl m
b7080c8e
A
61.Op Fl u
62.Op Ar address_family
7ba0088d 63.Nm
b7080c8e
A
64.Fl l
65.Op Fl d
66.Op Fl u
67.Op Ar address_family
7ba0088d
A
68.Nm
69.Op Fl L
2b484d24 70.Op Fl b
7ba0088d
A
71.Op Fl d
72.Op Fl m
73.Op Fl u
2b484d24
A
74.Nm
75.Ar interface
76.Cm vlan
77.Ar vlan-tag
78.Cm vlandev
79.Ar iface
80.Nm
81.Ar interface
82.Cm -vlandev
83.Ar iface
84.Nm
85.Ar interface
86.Cm bonddev
87.Ar iface
88.Nm
89.Ar interface
90.Cm -bonddev
91.Ar iface
b7080c8e
A
92.Sh DESCRIPTION
93.Nm Ifconfig
94is used to assign an address
95to a network interface and/or configure
96network interface parameters.
97.Nm Ifconfig
98must be used at boot time to define the network address
99of each interface present on a machine; it may also be used at
100a later time to redefine an interface's address
101or other operating parameters.
102.Pp
7ba0088d
A
103The following options are available:
104.Bl -tag -width indent
105.It Ar address
b7080c8e 106For the
7ba0088d 107.Tn DARPA Ns -Internet
b7080c8e
A
108family,
109the address is either a host name present in the host name data
7ba0088d 110base,
b7080c8e
A
111.Xr hosts 5 ,
112or a
113.Tn DARPA
114Internet address expressed in the Internet standard
115.Dq dot notation .
7ba0088d
A
116.Pp
117It is also possible to use the CIDR notation (also known as the
118slash notation) to include the netmask.
119That is, one can specify an address like
120.Li 192.168.0.1/16 .
121.\" For the Xerox Network Systems(tm) family,
122.\" addresses are
123.\" .Ar net:a.b.c.d.e.f ,
124.\" where
125.\" .Ar net
126.\" is the assigned network number (in decimal),
127.\" and each of the six bytes of the host number,
128.\" .Ar a
129.\" through
130.\" .Ar f ,
131.\" are specified in hexadecimal.
132.\" The host number may be omitted on IEEE 802 protocol
133.\" (Ethernet, FDDI, and Token Ring) interfaces,
134.\" which use the hardware physical address,
135.\" and on interfaces other than the first.
136.\" For the
137.\" .Tn ISO
138.\" family, addresses are specified as a long hexadecimal string,
139.\" as in the Xerox family.
140.\" However, two consecutive dots imply a zero
141.\" byte, and the dots are optional, if the user wishes to (carefully)
142.\" count out long strings of digits in network byte order.
b7080c8e 143.It Ar address_family
7ba0088d
A
144Specify the
145address family
b7080c8e
A
146which affects interpretation of the remaining parameters.
147Since an interface can receive transmissions in differing protocols
7ba0088d 148with different naming schemes, specifying the address family is recommended.
b7080c8e
A
149The address or protocol families currently
150supported are
151.Dq inet ,
7ba0088d
A
152.Dq inet6 ,
153.\" and
154.\" .Dq ns .
155.It Ar dest_address
156Specify the address of the correspondent on the other end
157of a point to point link.
158.It Ar interface
159This
b7080c8e
A
160parameter is a string of the form
161.Dq name unit ,
162for example,
7ba0088d 163.Dq Li en0 .
2b484d24
A
164.It Ar iface
165This parameter has the same encoding as the
166.Ar interface
167parameter.
b7080c8e
A
168.El
169.Pp
7ba0088d
A
170The following parameters may be set with
171.Nm :
172.Bl -tag -width indent
173.It Cm add
174Another name for the
175.Cm alias
176parameter.
177Introduced for compatibility
178with
179.Bsx .
b7080c8e 180.It Cm alias
7ba0088d
A
181Establish an additional network address for this interface.
182This is sometimes useful when changing network numbers, and
183one wishes to accept packets addressed to the old interface.
184If the address is on the same subnet as the first network address
185for this interface, a netmask of
186.Li 0xffffffff
187has to be specified.
188.It Fl alias
189Remove the network address specified.
190This would be used if you incorrectly specified an alias, or it
191was no longer needed.
192If you have incorrectly set an NS address having the side effect
193of specifying the host portion, removing all NS addresses will
194allow you to respecify the host portion.
195.It Cm anycast
196(Inet6 only.)
197Specify that the address configured is an anycast address.
198Based on the current specification,
199only routers may configure anycast addresses.
200Anycast address will not be used as source address of any of outgoing
201IPv6 packets.
b7080c8e 202.It Cm arp
7ba0088d
A
203Enable the use of the Address Resolution Protocol
204.Pq Xr arp 4
205in mapping
b7080c8e
A
206between network level addresses and link level addresses (default).
207This is currently implemented for mapping between
208.Tn DARPA
209Internet
7ba0088d
A
210addresses and
211.Tn IEEE
212802 48-bit MAC addresses (Ethernet, FDDI, and Token Ring addresses).
b7080c8e 213.It Fl arp
7ba0088d
A
214Disable the use of the Address Resolution Protocol
215.Pq Xr arp 4 .
2b484d24
A
216.It Cm bonddev Ar iface
217If the interface is a bond pseudo device, associate physical interface
218.Ar iface
219with it. The bond pseudo device conforms
220to the IEEE 802.3ad Link Aggregation specification.
221.Pp
222If this is the first physical interface to be associated with the bond
223interface, the bond interface inherits the ethernet address from the
224physical interface. Physical interfaces that are added to the bond have
225their ethernet address re-programmed so that all members of the bond have
226the same ethernet address. If the physical interface is subsequently
227removed from the bond using
228.Fl bonddev ,
229a new ethernet address is chosen from the remaining interfaces, and all
230interfaces are re-programmed again with the new ethernet address. If no
231remaining interfaces exist, the bond interface's ethernet address is cleared.
232.Pp
233If the specified physical interface
234.Ar iface
235is not capable of having its ethernet address re-programmed, the
236.Cm bonddev
237command will fail.
238.Pp
239Once the physical interface
240.Ar iface
241is successfully associated with the bond interface, all received packets
242are diverted to the bond interface. The physical interface is no longer
243useable on its own, and remains that way until it is removed from the bond using
244.Fl bonddev .
245.Pp
246It is possible that the specified interface
247.Ar iface
248is not capable of aggregating, and may remain unused until the operating
249conditions change.
250.Pp
251The link status of the bond interface depends on the state of link aggregation.
252If no active partner is detected, the link status will remain inactive.
253.Pp
254To monitor the 802.3ad Link Aggregation state, use the
255.Fl b
256option.
257.Pp
258A physical interface that is associated with a vlan pseudo device cannot
259at the same time be associated with a bond pseudo device. A physical interface
260cannot be associated with more than one bond pseudo device at the same time.
261.Pp
262It is not possible to associate a bond with pseudo interfaces such as vlan.
263Only physical ethernet interfaces may be associated with a bond.
264.It Fl bonddev Ar iface
265If the interface is a bond pseudo device, disassociate the physical interface
266.Ar iface
267from it. Before the interface is removed from the bond, the bond device
268announces to the link partner that the interface is now individual and
269no longer aggregatable.
270If the physical
271.Ar iface
272is the last interface in the bond, the bond interface clears its link address.
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
A
294If possible, the interface will be reset to disable reception as well.
295This action does not automatically disable routes using the interface.
7ba0088d
A
296.It Cm ether
297Another name for the
298.Cm lladdr
299parameter.
300.\" .It Cm ipdst
301.\" This is used to specify an Internet host who is willing to receive
302.\" ip packets encapsulating NS packets bound for a remote network.
303.\" An apparent point to point link is constructed, and
304.\" the address specified will be taken as the NS address and network
305.\" of the destination.
306.\" IP encapsulation of
307.\" .Tn CLNP
308.\" packets is done differently.
309.It Cm lladdr Ar addr
310Set the link-level address on an interface.
311This can be used to
312e.g. set a new MAC address on an ethernet interface, though the
313mechanism used is not ethernet-specific.
314The address
315.Ar addr
316is specified as a series of colon-separated hex digits.
317If the interface is already
318up when this option is used, it will be briefly brought down and
319then brought back up again in order to ensure that the receive
320filter in the underlying ethernet hardware is properly reprogrammed.
321.It Cm media Ar type
322If the driver supports the media selection system, set the media type
323of the interface to
324.Ar type .
325Some interfaces support the mutually exclusive use of one of several
326different physical media connectors.
327For example, a 10Mb/s Ethernet
328interface might support the use of either
329.Tn AUI
330or twisted pair connectors.
331Setting the media type to
332.Dq 10base5/AUI
333would change the currently active connector to the AUI port.
334Setting it to
335.Dq 10baseT/UTP
336would activate twisted pair.
337Refer to the interfaces' driver
338specific documentation or man page for a complete list of the
339available types.
340.It Cm mediaopt Ar opts
341If the driver supports the media selection system, set the specified
342media options on the interface.
343The
344.Ar opts
345argument
346is a comma delimited list of options to apply to the interface.
347Refer to the interfaces' driver specific man page for a complete
348list of available options.
349.It Fl mediaopt Ar opts
350If the driver supports the media selection system, disable the
351specified media options on the interface.
352.It Cm tunnel Ar src_addr dest_addr
353(IP tunnel devices only.)
354Configure the physical source and destination address for IP tunnel
355interfaces
356.Pq Xr gif 4 .
357The arguments
358.Ar src_addr
359and
360.Ar dest_addr
361are interpreted as the outer source/destination for the encapsulating
362IPv4/IPv6 header.
363.It Cm deletetunnel
364Unconfigure the physical source and destination address for IP tunnel
365interfaces previously configured with
366.Cm tunnel .
367.It Cm create
368Create the specified network pseudo-device.
369If the interface is given without a unit number, try to create a new
370device with an arbitrary unit number.
7902cf7e 371If creation of an arbitrary device is successful, the new device name is
7ba0088d
A
372printed to standard output.
373.It Cm destroy
374Destroy the specified network pseudo-device.
375.It Cm plumb
376Another name for the
377.Cm create
378parameter.
379Included for
380.Tn Solaris
381compatibility.
382.It Cm unplumb
383Another name for the
384.Cm destroy
385parameter.
386Included for
387.Tn Solaris
388compatibility.
b7080c8e
A
389.It Cm metric Ar n
390Set the routing metric of the interface to
391.Ar n ,
392default 0.
393The routing metric is used by the routing protocol
394.Pq Xr routed 8 .
395Higher metrics have the effect of making a route
396less favorable; metrics are counted as addition hops
397to the destination network or host.
7ba0088d
A
398.It Cm mtu Ar n
399Set the maximum transmission unit of the interface to
400.Ar n ,
401default is interface specific.
402The MTU is used to limit the size of packets that are transmitted on an
403interface.
404Not all interfaces support setting the MTU, and some interfaces have
405range restrictions.
b7080c8e 406.It Cm netmask Ar mask
7ba0088d
A
407.\" (Inet and ISO.)
408(Inet only.)
b7080c8e
A
409Specify how much of the address to reserve for subdividing
410networks into sub-networks.
411The mask includes the network part of the local address
412and the subnet part, which is taken from the host field of the address.
413The mask can be specified as a single hexadecimal number
7ba0088d
A
414with a leading
415.Ql 0x ,
416with a dot-notation Internet address,
b7080c8e
A
417or with a pseudo-network name listed in the network table
418.Xr networks 5 .
419The mask contains 1's for the bit positions in the 32-bit address
420which are to be used for the network and subnet parts,
421and 0's for the host part.
422The mask should contain at least the standard network portion,
423and the subnet field should be contiguous with the network
424portion.
7ba0088d
A
425.Pp
426The netmask can also be specified in CIDR notation after the address.
427See the
428.Ar address
429option above for more information.
430.It Cm prefixlen Ar len
431(Inet6 only.)
432Specify that
433.Ar len
434bits are reserved for subdividing networks into sub-networks.
435The
436.Ar len
437must be integer, and for syntactical reason it must be between 0 to 128.
438It is almost always 64 under the current IPv6 assignment rule.
439If the parameter is omitted, 64 is used.
440.\" see
b7080c8e 441.\" Xr eon 5 .
7ba0088d
A
442.\" .It Cm nsellength Ar n
443.\" .Pf ( Tn ISO
444.\" only)
445.\" This specifies a trailing number of bytes for a received
446.\" .Tn NSAP
447.\" used for local identification, the remaining leading part of which is
448.\" taken to be the
449.\" .Tn NET
450.\" (Network Entity Title).
451.\" The default value is 1, which is conformant to US
452.\" .Tn GOSIP .
453.\" When an ISO address is set in an ifconfig command,
454.\" it is really the
455.\" .Tn NSAP
456.\" which is being specified.
457.\" For example, in
458.\" .Tn US GOSIP ,
459.\" 20 hex digits should be
460.\" specified in the
461.\" .Tn ISO NSAP
462.\" to be assigned to the interface.
463.\" There is some evidence that a number different from 1 may be useful
464.\" for
465.\" .Tn AFI
466.\" 37 type addresses.
467.It Cm remove
468Another name for the
469.Fl alias
470parameter.
471Introduced for compatibility
472with
473.Bsx .
474.Sm off
475.It Cm link Op Cm 0 No - Cm 2
476.Sm on
b7080c8e
A
477Enable special processing of the link level of the interface.
478These three options are interface specific in actual effect, however,
7ba0088d
A
479they are in general used to select special modes of operation.
480An example
481of this is to enable SLIP compression, or to select the connector type
482for some Ethernet cards.
483Refer to the man page for the specific driver
484for more information.
485.Sm off
486.It Fl link Op Cm 0 No - Cm 2
487.Sm on
b7080c8e
A
488Disable special processing at the link level with the specified interface.
489.It Cm up
7ba0088d
A
490Mark an interface
491.Dq up .
492This may be used to enable an interface after an
493.Dq Nm Cm down .
b7080c8e
A
494It happens automatically when setting the first address on an interface.
495If the interface was reset when previously marked down,
496the hardware will be re-initialized.
2b484d24
A
497.It Cm vlan Ar vlan_tag Cm vlandev Ar iface
498If the interface is a vlan pseudo interface, set its vlan tag value
499to
500.Ar vlan_tag
501and associate it with the physical interface
502.Ar iface .
503.Pp
504The
505.Ar vlan_tag
506value is a 16-bit number that is used to create an 802.1Q
507vlan header for packets sent from the vlan interface.
508.Pp
509A packet that is transmitted through the vlan interface is sent
510using the specified physical interface
511.Ar iface
512with 802.1Q vlan encapsulation with the specified
513.Ar vlan_tag .
514A packet with 802.1Q encapsulation received by the physical interface
515is directed to the associated vlan interface with the matching
516.Ar vlan_tag .
517If there is no matching vlan interface, the packet is dropped.
518.Pp
519The vlan interface is assigned a
520copy of the parent interface's flags and the parent's ethernet address.
521If the vlan interface already has
522a physical interface associated with it, this command will fail.
523To
524change the association to another physical interface, the existing
525association must be cleared first using
526.Fl vlandev .
527.Pp
528If the physical interface supports 802.1Q VLAN tagging in hardware,
529the vlan pseudo interface does not itself insert or remove the 802.1Q
530encapsulation header. Instead, the
531.Ar vlan_tag
532is passed out of band from the packet data.
533.Pp
534A physical interface that is associated with a bond pseudo device cannot
535at the same time be associated with a vlan interface. However, a physical
536interface can be associated with multiple vlan interfaces at the same time,
537as long as each of the
538.Ar vlan_tag
539values are unique.
540.It Fl vlandev Ar iface
541If the driver is a vlan pseudo device, disassociate the physical interface
542.Ar iface
543from it.
544This breaks the link between the vlan interface and its parent,
545clears its vlan tag, flags and its link address.
b7080c8e
A
546.El
547.Pp
b7080c8e
A
548.Nm Ifconfig
549displays the current configuration for a network interface
550when no optional parameters are supplied.
551If a protocol family is specified,
7ba0088d
A
552.Nm
553will report only the details specific to that protocol family.
554.Pp
2b484d24
A
555If the driver supports the media selection system, the supported
556media list will be included in the output, regardless of whether the
7ba0088d 557.Fl m
2b484d24
A
558flag is passed or not.
559.Pp
560The
561.Fl b
562option passed before the interface name will print the link aggregation
563state for bond pseudo devices.
564.Pp
7ba0088d
A
565If
566.Fl L
567flag is supplied, address lifetime is displayed for IPv6 addresses,
568as time offset string.
569.Pp
570Optionally, the
571.Fl a
572flag may be used instead of an interface name.
573This flag instructs
574.Nm
575to display information about all interfaces in the system.
576The
577.Fl d
578flag limits this to interfaces that are down, and
579.Fl u
580limits this to interfaces that are up.
581When no arguments are given,
582.Fl a
583is implied.
584.Pp
585The
586.Fl l
587flag may be used to list all available interfaces on the system, with
588no other additional information.
589Use of this flag is mutually exclusive
590with all other flags and commands, except for
591.Fl d
592(only list interfaces that are down)
593and
594.Fl u
595(only list interfaces that are up).
596.Pp
b7080c8e 597Only the super-user may modify the configuration of a network interface.
7ba0088d
A
598.Sh NOTES
599The media selection system is relatively new and only some drivers support
600it (or have need for it).
b7080c8e 601.Sh DIAGNOSTICS
7ba0088d 602Messages indicating the specified interface does not exist, the
b7080c8e
A
603requested address is unknown, or the user is not privileged and
604tried to alter an interface's configuration.
7ba0088d
A
605.Sh BUGS
606IPv6 link-local addresses are required for several basic communication
607between IPv6 node.
608If they are deleted by
609.Nm
610manually, the kernel might show very strange behavior.
611So, such manual deletions are strongly discouraged.
b7080c8e
A
612.Sh SEE ALSO
613.Xr netstat 1 ,
614.Xr netintro 4 ,
7ba0088d 615.\" .Xr eon 5 ,
b7080c8e 616.Xr rc 8 ,
7ba0088d 617.Xr routed 8
b7080c8e
A
618.Sh HISTORY
619The
620.Nm
621command appeared in
622.Bx 4.2 .