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