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