xref: /freebsd/sbin/ifconfig/ifconfig.8 (revision 1b6c76a2fe091c74f08427e6c870851025a9cf67)
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
13.\"    must display the following acknowledgment:
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.\"
32.\"     From: @(#)ifconfig.8	8.3 (Berkeley) 1/5/94
33.\" $FreeBSD$
34.\"
35.Dd February 13, 1996
36.Dt IFCONFIG 8
37.Os BSD 4.2
38.Sh NAME
39.Nm ifconfig
40.Nd configure network interface parameters
41.Sh SYNOPSIS
42.Nm
43.Op Fl L
44.Op Fl m
45.Ar interface
46.Op Ar address_family
47.Oo
48.Ar address Ns Op Cm / Ns Ar prefixlength
49.Op Ar dest_address
50.Oc
51.Op Ar parameters
52.Nm
53.Fl a
54.Op Fl L
55.Op Fl d
56.Op Fl m
57.Op Fl u
58.Op Ar address_family
59.Nm
60.Fl l
61.Op Fl d
62.Op Fl u
63.Op Ar address_family
64.Nm
65.Op Fl L
66.Op Fl d
67.Op Fl m
68.Op Fl u
69.Sh DESCRIPTION
70.Nm Ifconfig
71is used to assign an address
72to a network interface and/or configure
73network interface parameters.
74.Nm Ifconfig
75must be used at boot time to define the network address
76of each interface present on a machine; it may also be used at
77a later time to redefine an interface's address
78or other operating parameters.
79.Pp
80The following options are available:
81.Bl -tag -width indent
82.It Ar address
83For the
84.Tn DARPA Ns -Internet
85family,
86the address is either a host name present in the host name data
87base,
88.Xr hosts 5 ,
89or a
90.Tn DARPA
91Internet address expressed in the Internet standard
92.Dq dot notation .
93.Pp
94It is also possible to use the CIDR notation (also known as the
95slash notation) to include the netmask.
96That is, one can specify an address like
97.Li 192.168.0.1/16 .
98.\" For the Xerox Network Systems(tm) family,
99.\" addresses are
100.\" .Ar net:a.b.c.d.e.f ,
101.\" where
102.\" .Ar net
103.\" is the assigned network number (in decimal),
104.\" and each of the six bytes of the host number,
105.\" .Ar a
106.\" through
107.\" .Ar f ,
108.\" are specified in hexadecimal.
109.\" The host number may be omitted on IEEE 802 protocol
110.\" (Ethernet, FDDI, and Token Ring) interfaces,
111.\" which use the hardware physical address,
112.\" and on interfaces other than the first.
113.\" For the
114.\" .Tn ISO
115.\" family, addresses are specified as a long hexadecimal string,
116.\" as in the Xerox family.  However, two consecutive dots imply a zero
117.\" byte, and the dots are optional, if the user wishes to (carefully)
118.\" count out long strings of digits in network byte order.
119.It Ar address_family
120Specify the
121.Ar "address family"
122which affects interpretation of the remaining parameters.
123Since an interface can receive transmissions in differing protocols
124with different naming schemes, specifying the address family is recommended.
125The address or protocol families currently
126supported are
127.Dq inet ,
128.Dq inet6 ,
129.Dq atalk ,
130.Dq ether ,
131.\" .Dq iso ,
132and
133.Dq ipx .
134.\" and
135.\" .Dq ns .
136.It Ar dest_address
137Specify the address of the correspondent on the other end
138of a point to point link.
139.It Ar interface
140This
141parameter is a string of the form
142.Dq name unit ,
143for example,
144.Dq en0 .
145.El
146.Pp
147The following parameters may be set with
148.Nm :
149.Bl -tag -width indent
150.It Cm add
151Another name for the
152.Cm alias
153parameter.
154Introduced for compatibility
155with BSD/OS.
156.It Cm alias
157Establish an additional network address for this interface.
158This is sometimes useful when changing network numbers, and
159one wishes to accept packets addressed to the old interface.
160If the address is on the same subnet as the first network address
161for this interface, a netmask of 0xffffffff has to be specified.
162.It Fl alias
163Remove the network address specified.
164This would be used if you incorrectly specified an alias, or it
165was no longer needed.
166If you have incorrectly set an NS address having the side effect
167of specifying the host portion, removing all NS addresses will
168allow you to respecify the host portion.
169.It Cm anycast
170(Inet6 only)
171Specify that the address configured is an anycast address.
172Based on the current specification,
173only routers may configure anycast addresses.
174Anycast address will not be used as source address of any of outgoing
175IPv6 packets.
176.It Cm arp
177Enable the use of the Address Resolution Protocol in mapping
178between network level addresses and link level addresses (default).
179This is currently implemented for mapping between
180.Tn DARPA
181Internet
182addresses and
183.Tn IEEE
184802 48-bit MAC addresses (Ethernet, FDDI, and Token Ring addresses).
185.It Fl arp
186Disable the use of the Address Resolution Protocol.
187.It Cm broadcast
188(Inet only)
189Specify the address to use to represent broadcasts to the
190network.
191The default broadcast address is the address with a host part of all 1's.
192.It Cm debug
193Enable driver dependent debugging code; usually, this turns on
194extra console error logging.
195.It Fl debug
196Disable driver dependent debugging code.
197.It Cm delete
198Another name for the
199.Fl alias
200parameter.
201.It Cm down
202Mark an interface
203.Dq down .
204When an interface is marked
205.Dq down ,
206the system will not attempt to
207transmit messages through that interface.
208If possible, the interface will be reset to disable reception as well.
209This action does not automatically disable routes using the interface.
210.It Cm ether
211Another name for the
212.Dq lladdr
213parameter.
214.\" .It Cm ipdst
215.\" This is used to specify an Internet host who is willing to receive
216.\" ip packets encapsulating NS packets bound for a remote network.
217.\" An apparent point to point link is constructed, and
218.\" the address specified will be taken as the NS address and network
219.\" of the destination.
220.\" IP encapsulation of
221.\" .Tn CLNP
222.\" packets is done differently.
223.It Cm lladdr Ar addr
224Set the link-level address on an interface. This can be used to
225e.g. set a new MAC address on an ethernet interface, though the
226mechanism used is not ethernet-specific. The address
227.Ar addr
228is specified as a series of colon-separated hex digits.
229If the interface is already
230up when this option is used, it will be briefly brought down and
231then brought back up again in order to insure that the receive
232filter in the underlying ethernet hardware is properly reprogrammed.
233.It Cm media Ar type
234If the driver supports the media selection system, set the media type
235of the interface to
236.Ar type .
237Some interfaces support the mutually exclusive use of one of several
238different physical media connectors.  For example, a 10Mb/s Ethernet
239interface might support the use of either
240.Tn AUI
241or twisted pair connectors.  Setting the media type to
242.Dq 10base5/AUI
243would change the currently active connector to the AUI port.
244Setting it to
245.Dq 10baseT/UTP
246would activate twisted pair.  Refer to the interfaces' driver
247specific documentation or man page for a complete list of the
248available types.
249.It Cm mediaopt Ar opts
250If the driver supports the media selection system, set the specified
251media options on the interface.
252.Ar Opts
253is a comma delimited list of options to apply to the interface.
254Refer to the interfaces' driver specific man page for a complete
255list of available options.
256.It Fl mediaopt Ar opts
257If the driver supports the media selection system, disable the
258specified media options on the interface.
259.It Cm tunnel Ar src_addr Ar dest_addr
260(IP tunnel devices only)
261Configure the physical source and destination address for IP tunnel
262interfaces (gif).  The arguments
263.Ar src_addr
264and
265.Ar dest_addr
266are interpreted as the outer source/destination for the encapsulating
267IPv4/IPv6 header.
268.It Cm deletetunnel
269Unconfigure the physical source and destination address for IP tunnel
270interfaces previously configured with
271.Cm tunnel .
272.It Cm vlan Ar vlan_tag
273If the interface is a vlan pseudo interface, set the vlan tag value
274to
275.Ar vlan_tag .
276This value is a 16-bit number which is used to create an 802.1Q
277vlan header for packets sent from the vlan interface.
278Note that
279.Cm vlan
280and
281.Cm vlandev
282must both be set at the same time.
283.It Cm vlandev Ar iface
284If the interface is a vlan pseudo device, associate physical interface
285.Ar iface
286with it.
287Packets transmitted through the vlan interface will be
288diverted to the specified physical interface
289.Ar iface
290with 802.1Q vlan encapsulation.
291Packets with 802.1Q encapsulation received
292by the parent interface with the correct vlan tag will be diverted to
293the associated vlan pseudo-interface.
294The vlan interface is assigned a
295copy of the parent interface's flags and the parent's ethernet address.
296The
297.Cm vlandev
298and
299.Cm vlan
300must both be set at the same time.
301If the vlan interface already has
302a physical interface associated with it, this command will fail.
303To
304change the association to another physical interface, the existing
305association must be cleared first.
306.Pp
307Note: if the
308.Ar link0
309flag is set on the vlan interface, the vlan pseudo
310interface's behavior changes: the
311.Ar link0
312tells the vlan interface that the
313parent interface supports insertion and extraction of vlan tags on its
314own (usually in firmware) and that it should pass packets to and from
315the parent unaltered.
316.It Fl vlandev Ar iface
317If the driver is a vlan pseudo device, disassociate the physical interface
318.Ar iface
319from it.
320This breaks the link between the vlan interface and its parent,
321clears its vlan tag, flags and its link address and shuts the interface down.
322.It Cm metric Ar n
323Set the routing metric of the interface to
324.Ar n ,
325default 0.
326The routing metric is used by the routing protocol
327.Pq Xr routed 8 .
328Higher metrics have the effect of making a route
329less favorable; metrics are counted as addition hops
330to the destination network or host.
331.It Cm mtu Ar n
332Set the maximum transmission unit of the interface to
333.Ar n ,
334default is interface specific.
335The mtu is used to limit the size of packets that are transmitted on an
336interface.
337Not all interfaces support setting the mtu, and some interfaces have
338range restrictions.
339.It Cm netmask Ar mask
340.\" (Inet and ISO)
341(Inet only)
342Specify how much of the address to reserve for subdividing
343networks into sub-networks.
344The mask includes the network part of the local address
345and the subnet part, which is taken from the host field of the address.
346The mask can be specified as a single hexadecimal number
347with a leading 0x, with a dot-notation Internet address,
348or with a pseudo-network name listed in the network table
349.Xr networks 5 .
350The mask contains 1's for the bit positions in the 32-bit address
351which are to be used for the network and subnet parts,
352and 0's for the host part.
353The mask should contain at least the standard network portion,
354and the subnet field should be contiguous with the network
355portion.
356.Pp
357The netmask can also be specified in CIDR notation after the address.
358See the
359.Ar address
360option above for more information.
361.It Cm prefixlen Ar len
362(Inet6 only)
363Specify that
364.Ar len
365bits are reserved for subdividing networks into sub-networks.
366The
367.Ar len
368must be integer, and for syntactical reason it must be between 0 to 128.
369It is almost always 64 under the current IPv6 assignment rule.
370If the parameter is ommitted, 64 is used.
371.\" see
372.\" Xr eon 5 .
373.\" .It Cm nsellength Ar n
374.\" .Pf ( Tn ISO
375.\" only)
376.\" This specifies a trailing number of bytes for a received
377.\" .Tn NSAP
378.\" used for local identification, the remaining leading part of which is
379.\" taken to be the
380.\" .Tn NET
381.\" (Network Entity Title).
382.\" The default value is 1, which is conformant to US
383.\" .Tn GOSIP .
384.\" When an ISO address is set in an ifconfig command,
385.\" it is really the
386.\" .Tn NSAP
387.\" which is being specified.
388.\" For example, in
389.\" .Tn US GOSIP ,
390.\" 20 hex digits should be
391.\" specified in the
392.\" .Tn ISO NSAP
393.\" to be assigned to the interface.
394.\" There is some evidence that a number different from 1 may be useful
395.\" for
396.\" .Tn AFI
397.\" 37 type addresses.
398.It Cm range Ar netrange
399Under appletalk, set the interface to respond to a
400.Ar netrange
401of the form
402.Ar startnet Ns - Ns Ar endnet .
403Appletalk uses this scheme instead of
404netmasks though
405.Fx
406implements it internally as a set of netmasks.
407.It Cm remove
408Another name for the
409.Fl alias
410parameter.
411Introduced for compatibility
412with BSD/OS.
413.It Cm phase
414The argument following this specifies the version (phase) of the
415Appletalk network attached to the interface.
416Values of 1 or 2 are permitted.
417.It Cm link Ns Xo
418.Op Cm 0 Ns - Ns Cm 2
419.Xc
420Enable special processing of the link level of the interface.
421These three options are interface specific in actual effect, however,
422they are in general used to select special modes of operation.
423An example
424of this is to enable SLIP compression, or to select the connector type
425for some Ethernet cards.  Refer to the man page for the specific driver
426for more information.
427.It Fl link Ns Xo
428.Op Cm 0 Ns - Ns Cm 2
429.Xc
430Disable special processing at the link level with the specified interface.
431.It Cm up
432Mark an interface
433.Dq up .
434This may be used to enable an interface after an
435.Dq ifconfig down .
436It happens automatically when setting the first address on an interface.
437If the interface was reset when previously marked down,
438the hardware will be re-initialized.
439.It Cm ssid Ar ssid
440For IEEE 802.11 wireless interfaces, set the desired Service Set
441Identifier (aka network name.)  The SSID is a string up to 32 characters
442in length and may be specified as either a normal string or in
443hexadecimal when proceeded by
444.Sq 0x .
445Additionally, the SSID may be cleared by setting it to
446.Sq - .
447.It Cm nwid Ar ssid
448Another name for the
449.Dq ssid
450parameter.  Included for NetBSD compatibility.
451.It Cm stationname Ar name
452For IEEE 802.11 wireless interfaces, set the name of this station.
453It appears that the station name is not really part of the IEEE 802.11
454protocol though all interfaces seem to support it.  As such it only
455seems to be meaningful to identical or virtually identical equipment.
456Setting the station name is identical in syntax to setting the SSID.
457.It Cm station Ar name
458Another name for the
459.Dq stationname
460parameter.  Included for BSD/OS compatibility.
461.It Cm channel Ar number
462For IEEE 802.11 wireless interfaces, set the desired channel.
463Channels range from 1 to 14, but the exact selection available
464depends on the region your adaptor was manufactured for.  Setting
465the channel to 0 will give you the default for your adaptor.  Many
466adaptors ignore this setting unless you are in ad-hoc mode.
467.It Cm authmode Ar mode
468For IEEE 802.11 wireless interfaces, set the desired authentication mode
469in infrastructure mode.  Not all adaptors support all modes.  The set of
470valid modes is
471.Dq none ,
472.Dq open ,
473and
474.Dq shared .
475Modes are case insensitive.
476.It Cm powersave
477For IEEE 802.11 wireless interfaces, enable powersave mode.
478.It Cm -powersave
479For IEEE 802.11 wireless interfaces, disable powersave mode.
480.It Cm powersavesleep Ar sleep
481For IEEE 802.11 wireless interfaces, set the desired max powersave sleep
482time in milliseconds.
483.It Cm wepmode Ar mode
484For IEEE 802.11 wireless interfaces, set the desired WEP mode.  Not all
485adaptors support all modes.  The set of valid modes is
486.Dq off ,
487.Dq on ,
488and
489.Dq mixed .
490.Dq Mixed
491mode explicitly tells the adaptor to allow association with access
492points which allow both encrypted and unencrypted traffic.  On these
493adaptors,
494.Dq on
495means that the access point must only allow encrypted connections.  On
496other adaptors,
497.Dq on
498is generally another name for
499.Dq mixed .
500Modes are case insensitive.
501.It Cm weptxkey Ar index
502For IEEE 802.11 wireless interfaces, set the WEP key to be used for
503transmission.
504.It Cm wepkey Ar key|index:key
505For IEEE 802.11 wireless interfaces, set the selected WEP key.  If
506an
507.Ar index
508is not given, key 1 is set.  A WEP key will be either 5 or 13
509characters (40 or 104 bits) depending of the local network and the
510capabilities of the adaptor.  It may be specified either as a plain
511string or as a string of hexadecimal digits proceeded by
512.Sq 0x .
513A key may be cleared by setting it to
514.Sq - .
515If WEP is supported then there are at least four keys.  Some adaptors
516support more then four keys.  If that is the case, then the first four keys
517(1-4) will be the standard temporary keys and any others will be adaptor
518specific keys such as permanent keys stored in NVRAM.
519.It Cm wep
520Another way of saying
521.Dq wepmode on .
522Included for BSD/OS compatibility.
523.It Cm -wep
524Another way of saying
525.Dq wepmode off .
526Included for BSD/OS compatibility.
527.It Cm nwkey key
528Another way of saying:
529.Pp
530``wepmode on weptxkey 1 wepkey 1:key wepkey 2:- wepkey 3:- wepkey 4:-''.
531.Pp
532Included for NetBSD compatibility.
533.It Cm nwkey n:k1,k2,k3,k4
534Another way of saying
535.Pp
536``wepmode on weptxkey n wepkey 1:k1 wepkey 2:k2 wepkey 3:k3 wepkey 4:k4''.
537.Pp
538Included for NetBSD compatibility.
539.It Cm -nwkey
540Another way of saying
541.Dq wepmode off .
542.Pp
543Included for NetBSD compatibility.
544.El
545.Pp
546.Nm Ifconfig
547displays the current configuration for a network interface
548when no optional parameters are supplied.
549If a protocol family is specified,
550.Nm
551will report only the details specific to that protocol family.
552.Pp
553If the driver does supports the media selection system, the supported
554media list will be included in the output.
555.Pp
556If the
557.Fl m
558flag is passed before an interface name, ifconfig will display all
559of the supported media for the specified interface.
560If
561.Fl L
562flag is supplied, address lifetime is displayed for IPv6 addresses,
563as time offset string.
564.Pp
565Optionally, the
566.Fl a
567flag may be used instead of an interface name.  This flag instructs
568.Nm
569to display information about all interfaces in the system.
570The
571.Fl d
572flag limits this to interfaces that are down, and
573.Fl u
574limits this to interfaces that are up.
575When no arguments are given,
576.Fl a
577is implied.
578.Pp
579The
580.Fl l
581flag may be used to list all available interfaces on the system, with
582no other additional information.  Use of this flag is mutually exclusive
583with all other flags and commands, except for
584.Fl d
585(only list interfaces that are down)
586and
587.Fl u
588(only list interfaces that are up).
589.Pp
590Only the super-user may modify the configuration of a network interface.
591.Sh NOTES
592The media selection system is relatively new and only some drivers support
593it (or have need for it).
594.Sh DIAGNOSTICS
595Messages indicating the specified interface does not exist, the
596requested address is unknown, or the user is not privileged and
597tried to alter an interface's configuration.
598.Sh BUGS
599IPv6 link-local addresses are required for several basic communication
600between IPv6 node.
601If they are deleted by
602.Nm
603manually, the kernel might show very strange behavior.
604So, such manual deletions are strongly discouraged.
605.Sh SEE ALSO
606.Xr netstat 1 ,
607.Xr netintro 4 ,
608.Xr rc 8 ,
609.Xr routed 8
610.\" .Xr eon 5
611.Sh HISTORY
612The
613.Nm
614command appeared in
615.Bx 4.2 .
616