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