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