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