xref: /freebsd/sbin/ifconfig/ifconfig.8 (revision b601c69bdbe8755d26570261d7fd4c02ee4eff74)
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 February 13, 1996
36.Dt IFCONFIG 8
37.Os BSD 4.2
38.Sh NAME
39.Nm ifconfig
40.Nd configure network interface parameters
41.Sh SYNOPSIS
42.Nm ifconfig
43.Op Fl L
44.Ar interface
45.Op Ar address_family
46.Oo
47.Ar address
48.Op Ar dest_address
49.Oc
50.Op Ar parameters
51.Nm ifconfig
52.Fl a
53.Op Fl L
54.Op Fl d
55.Op Fl u
56.Op Ar address_family
57.Nm ifconfig
58.Fl l
59.Op Fl d
60.Op Fl u
61.Op Ar address_family
62.Nm ifconfig
63.Op Fl L
64.Op Fl d
65.Op Fl u
66.Sh DESCRIPTION
67.Nm Ifconfig
68is used to assign an address
69to a network interface and/or configure
70network interface parameters.
71.Nm Ifconfig
72must be used at boot time to define the network address
73of each interface present on a machine; it may also be used at
74a later time to redefine an interface's address
75or other operating parameters.
76.Pp
77The following options are available:
78.Bl -tag -width indent
79.It Ar address
80For the
81.Tn DARPA Ns -Internet
82family,
83the address is either a host name present in the host name data
84base,
85.Xr hosts 5 ,
86or a
87.Tn DARPA
88Internet address expressed in the Internet standard
89.Dq dot notation .
90.\" For the Xerox Network Systems(tm) family,
91.\" addresses are
92.\" .Ar net:a.b.c.d.e.f ,
93.\" where
94.\" .Ar net
95.\" is the assigned network number (in decimal),
96.\" and each of the six bytes of the host number,
97.\" .Ar a
98.\" through
99.\" .Ar f ,
100.\" are specified in hexadecimal.
101.\" The host number may be omitted on 10Mb/s Ethernet interfaces,
102.\" which use the hardware physical address,
103.\" and on interfaces other than the first.
104.\" For the
105.\" .Tn ISO
106.\" family, addresses are specified as a long hexadecimal string,
107.\" as in the Xerox family.  However, two consecutive dots imply a zero
108.\" byte, and the dots are optional, if the user wishes to (carefully)
109.\" count out long strings of digits in network byte order.
110.It Ar address_family
111Specify the
112.Ar "address family"
113which affects interpretation of the remaining parameters.
114Since an interface can receive transmissions in differing protocols
115with different naming schemes, specifying the address family is recommended.
116The address or protocol families currently
117supported are
118.Dq inet ,
119.Dq inet6 ,
120.Dq atalk ,
121.Dq ether ,
122.\" .Dq iso ,
123and
124.Dq ipx .
125.\" and
126.\" .Dq ns .
127.It Ar dest_address
128Specify the address of the correspondent on the other end
129of a point to point link.
130.It Ar interface
131This
132parameter is a string of the form
133.Dq name unit ,
134for example,
135.Dq en0 .
136.El
137.Pp
138The following parameters may be set with
139.Nm ifconfig :
140.Bl -tag -width indent
141.It Cm add
142Another name for the ``alias'' parameter.  Introduced for compatibility
143with BSD/OS.
144.It Cm alias
145Establish an additional network address for this interface.
146This is sometimes useful when changing network numbers, and
147one wishes to accept packets addressed to the old interface.
148If the address is on the same subnet as the first network address
149for this interface, a netmask of 0xffffffff has to be specified.
150.It Fl alias
151Remove the network address specified.
152This would be used if you incorrectly specified an alias, or it
153was no longer needed.
154If you have incorrectly set an NS address having the side effect
155of specifying the host portion, removing all NS addresses will
156allow you to respecify the host portion.
157.It Cm anycast
158(Inet6 only)
159Specify that the address configured is an anycast address.
160Based on the current specification,
161only routers may configure anycast addresses.
162Anycast address will not be used as source address of any of outgoing
163IPv6 packets.
164.It Cm arp
165Enable the use of the Address Resolution Protocol in mapping
166between network level addresses and link level addresses (default).
167This is currently implemented for mapping between
168.Tn DARPA
169Internet
170addresses and 10Mb/s Ethernet addresses.
171.It Fl arp
172Disable the use of the Address Resolution Protocol.
173.It Cm broadcast
174(Inet only)
175Specify the address to use to represent broadcasts to the
176network.
177The default broadcast address is the address with a host part of all 1's.
178.It Cm debug
179Enable driver dependent debugging code; usually, this turns on
180extra console error logging.
181.It Fl debug
182Disable driver dependent debugging code.
183.It Cm delete
184Another name for the ``-alias'' parameter.
185.It Cm down
186Mark an interface ``down''.  When an interface is
187marked ``down'', the system will not attempt to
188transmit messages through that interface.
189If possible, the interface will be reset to disable reception as well.
190This action does not automatically disable routes using the interface.
191.\" .It Cm ipdst
192.\" This is used to specify an Internet host who is willing to receive
193.\" ip packets encapsulating NS packets bound for a remote network.
194.\" An apparent point to point link is constructed, and
195.\" the address specified will be taken as the NS address and network
196.\" of the destination.
197.\" IP encapsulation of
198.\" .Tn CLNP
199.\" packets is done differently.
200.It Cm lladdr Ar addr
201Set the link-level address on an interface. This can be used to
202e.g. set a new MAC address on an ethernet interface, though the
203mechanism used is not ethernet-specific. The address
204.Ar addr
205is specified as a series of colon-separated hex digits.
206If the interface is already
207up when this option is used, it will be briefly brought down and
208then brought back up again in order to insure that the receive
209filter in the underlying ethernet hardware is properly reprogrammed.
210.It Cm media Ar type
211If the driver supports the media selection system, set the media type
212of the interface to
213.Ar type .
214Some interfaces support the mutually exclusive use of one of several
215different physical media connectors.  For example, a 10Mb/s Ethernet
216interface might support the use of either
217.Tn AUI
218or twisted pair connectors.  Setting the media type to
219.Dq 10base5/AUI
220would change the currently active connector to the AUI port.
221Setting it to
222.Dq 10baseT/UTP
223would activate twisted pair.  Refer to the interfaces' driver
224specific documentation or man page for a complete list of the
225available types.
226.It Cm mediaopt Ar opts
227If the driver supports the media selection system, set the specified
228media options on the interface.
229.Ar Opts
230is a comma delimited list of options to apply to the interface.
231Refer to the interfaces' driver specific man page for a complete
232list of available options.
233.It Fl mediaopt Ar opts
234If the driver supports the media selection system, disable the
235specified media options on the interface.
236.It Cm vlan Ar vlan_tag
237If the interface is a vlan pseudo interface, set the vlan tag value
238to
239.Ar vlan_tag .
240This value is a 16-bit number which is used to create an 802.1Q
241vlan header for packets sent from the vlan interface.
242Note that
243.Cm vlan
244and
245.Cm vlandev
246must both be set at the same time.
247.It Cm vlandev Ar iface
248If the interface is a vlan pseudo device, associate physical interface
249.Ar iface
250with it.
251Packets transmitted through the vlan interface will be
252diverted to the specified physical interface
253.Ar iface
254with 802.1Q vlan encapsulation.
255Packets with 802.1Q encapsulation received
256by the parent interface with the correct vlan tag will be diverted to
257the associated vlan pseudo-interface.
258The vlan interface is assigned a
259copy of the parent interface's flags and the parent's ethernet address.
260The
261.Cm vlandev
262and
263.Cm vlan
264must both be set at the same time.
265If the vlan interface already has
266a physical interface associated with it, this command will fail.
267To
268change the association to another physical interface, the existing
269association must be cleared first.
270.Pp
271Note: if the
272.Ar link0
273flag is set on the vlan interface, the vlan pseudo
274interface's behavior changes: the
275.Ar link0
276tells the vlan interface that the
277parent interface supports insertion and extraction of vlan tags on its
278own (usually in firmware) and that it should pass packets to and from
279the parent unaltered.
280.It Fl vlandev Ar iface
281If the driver is a vlan pseudo device, disassociate the physical interface
282.Ar iface
283from it.
284This breaks the link between the vlan interface and its parent,
285clears its vlan tag, flags and its link address and shuts the interface down.
286.It Cm metric Ar n
287Set the routing metric of the interface to
288.Ar n ,
289default 0.
290The routing metric is used by the routing protocol
291.Pq Xr routed 8 .
292Higher metrics have the effect of making a route
293less favorable; metrics are counted as addition hops
294to the destination network or host.
295.It Cm mtu Ar n
296Set the maximum transmission unit of the interface to
297.Ar n ,
298default is interface specific.
299The mtu is used to limit the size of packets that are transmitted on an
300interface.
301Not all interfaces support setting the mtu, and some interfaces have
302range restrictions.
303.It Cm netmask Ar mask
304.\" (Inet and ISO)
305(Inet only)
306Specify how much of the address to reserve for subdividing
307networks into sub-networks.
308The mask includes the network part of the local address
309and the subnet part, which is taken from the host field of the address.
310The mask can be specified as a single hexadecimal number
311with a leading 0x, with a dot-notation Internet address,
312or with a pseudo-network name listed in the network table
313.Xr networks 5 .
314The mask contains 1's for the bit positions in the 32-bit address
315which are to be used for the network and subnet parts,
316and 0's for the host part.
317The mask should contain at least the standard network portion,
318and the subnet field should be contiguous with the network
319portion.
320.It Cm prefixlen Ar len
321(Inet6 only)
322Specify that
323.Ar len
324bits are reserved for subdividing networks into sub-networks.
325The
326.Ar len
327must be integer, and for syntactical reason it must be between 0 to 128.
328It is almost always 64 under the current IPv6 assignment rule.
329If the parameter is ommitted, 64 is used.
330.\" see
331.\" Xr eon 5 .
332.\" .It Cm nsellength Ar n
333.\" .Pf ( Tn ISO
334.\" only)
335.\" This specifies a trailing number of bytes for a received
336.\" .Tn NSAP
337.\" used for local identification, the remaining leading part of which is
338.\" taken to be the
339.\" .Tn NET
340.\" (Network Entity Title).
341.\" The default value is 1, which is conformant to US
342.\" .Tn GOSIP .
343.\" When an ISO address is set in an ifconfig command,
344.\" it is really the
345.\" .Tn NSAP
346.\" which is being specified.
347.\" For example, in
348.\" .Tn US GOSIP ,
349.\" 20 hex digits should be
350.\" specified in the
351.\" .Tn ISO NSAP
352.\" to be assigned to the interface.
353.\" There is some evidence that a number different from 1 may be useful
354.\" for
355.\" .Tn AFI
356.\" 37 type addresses.
357.It Cm range
358Under appletalk, set the interface to respond to a
359.Em netrange.
360of the form startnet-endnet.
361Appletalk uses this scheme instead of
362netmasks though
363.Fx
364implements it internally as a set of netmasks.
365.It Cm remove
366Another name for the ``-alias'' parameter.  Introduced for compatibility
367with BSD/OS.
368.It Cm phase
369The argument following this specifies the version (phase) of the
370Appletalk network attached to the interface.
371Values of 1 or 2 are permitted.
372.It Cm link[0-2]
373Enable special processing of the link level of the interface.
374These three options are interface specific in actual effect, however,
375they are in general used to select special modes of operation.
376An example
377of this is to enable SLIP compression, or to select the connector type
378for some Ethernet cards.  Refer to the man page for the specific driver
379for more information.
380.It Fl link[0-2]
381Disable special processing at the link level with the specified interface.
382.It Cm up
383Mark an interface
384.Dq up .
385This may be used to enable an interface after an
386.Dq ifconfig down .
387It happens automatically when setting the first address on an interface.
388If the interface was reset when previously marked down,
389the hardware will be re-initialized.
390.El
391.Pp
392.Nm Ifconfig
393displays the current configuration for a network interface
394when no optional parameters are supplied.
395If a protocol family is specified,
396.Nm
397will report only the details specific to that protocol family.
398.Pp
399If the driver does supports the media selection system, the supported
400media list will be included in the output.
401.Pp
402If
403.Fl L
404flag is supplied, address lifetime is dislayed for IPv6 addresses,
405as time offset string.
406.Pp
407Optionally, the
408.Fl a
409flag may be used instead of an interface name.  This flag instructs
410.Nm
411to display information about all interfaces in the system.
412The
413.Fl d
414flag limits this to interfaces that are down, and
415.Fl u
416limits this to interfaces that are up.
417When no arguments are given,
418.Fl a
419is implied.
420.Pp
421The
422.Fl l
423flag may be used to list all available interfaces on the system, with
424no other additional information.  Use of this flag is mutually exclusive
425with all other flags and commands, except for
426.Fl d
427(only list interfaces that are down)
428and
429.Fl u
430(only list interfaces that are up).
431.Pp
432Only the super-user may modify the configuration of a network interface.
433.Sh NOTES
434The media selection system is relatively new and only some drivers support
435it (or have need for it).
436.Sh DIAGNOSTICS
437Messages indicating the specified interface does not exist, the
438requested address is unknown, or the user is not privileged and
439tried to alter an interface's configuration.
440.Sh BUGS
441IPv6 link-local addresses are required for several basic communication
442between IPv6 node.
443If they are deleted by
444.Nm ifconfig
445manually, the kernel might show very strange behavior.
446So, such manual deletions are strongly discouraged.
447.Sh SEE ALSO
448.Xr netstat 1 ,
449.Xr netintro 4 ,
450.Xr rc 8 ,
451.Xr routed 8
452.\" .Xr eon 5
453.Sh HISTORY
454The
455.Nm
456command appeared in
457.Bx 4.2 .
458