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