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