1.\" $NetBSD: ifconfig.8,v 1.80 2005/09/11 23:37:14 wiz Exp $ 2.\" 3.\" Copyright (c) 1983, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94 31.\" 32.Dd August 11, 2005 33.Dt IFCONFIG 8 34.Os 35.Sh NAME 36.Nm ifconfig 37.Nd configure network interface parameters 38.Sh SYNOPSIS 39.Nm 40.Ar interface address_family 41.Oo 42.Ar address 43.Op Ar dest_address 44.Oc 45.Op Ar parameters 46.Nm 47.Op Fl hLmvz 48.Ar interface 49.Op Ar protocol_family 50.Nm 51.Fl a 52.Op Fl bdhLmsuvz 53.Op Ar protocol_family 54.Nm 55.Fl l 56.Op Fl bdsu 57.Nm 58.Fl s 59.Ar interface 60.Nm 61.Fl C 62.Sh DESCRIPTION 63.Nm 64is used to assign an address 65to a network interface and/or configure 66network interface parameters. 67.Nm 68must be used at boot time to define the network address 69of each interface present on a machine; it may also be used at 70a later time to redefine an interface's address 71or other operating parameters. 72.Pp 73Available operands for 74.Nm : 75.Bl -tag -width Ds 76.It Ar address 77For the 78.Tn DARPA-Internet 79family, 80the address is either a host name present in the host name data 81base, 82.Xr hosts 5 , 83or a 84.Tn DARPA 85Internet address expressed in the Internet standard 86.Dq dot notation . 87For the Xerox Network Systems(tm) family, 88addresses are 89.Ar net:a.b.c.d.e.f , 90where 91.Ar net 92is the assigned network number 93.Pq in decimal , 94and each of the six bytes of the host number, 95.Ar a 96through 97.Ar f , 98are specified in hexadecimal. 99The host number may be omitted on Ethernet interfaces, 100which use the hardware physical address, 101and on interfaces other than the first. 102For the 103.Tn ISO 104family, addresses are specified as a long hexadecimal string, 105as in the Xerox family. 106However, two consecutive dots imply a zero 107byte, and the dots are optional, if the user wishes to 108.Pq carefully 109count out long strings of digits in network byte order. 110.It Ar address_family 111Specifies 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 iso , 122and 123.Dq ns . 124.It Ar interface 125The 126.Ar interface 127parameter is a string of the form 128.Dq name unit , 129for example, 130.Dq en0 131.El 132.Pp 133The following parameters may be set with 134.Nm : 135.Bl -tag -width dest_addressxx 136.It Cm alias 137Establish an additional network address for this interface. 138This is sometimes useful when changing network numbers, and 139one wishes to accept packets addressed to the old interface. 140.It Fl alias 141Remove the specified network address alias. 142.It Cm arp 143Enable the use of the Address Resolution Protocol in mapping 144between network level addresses and link level addresses 145.Pq default . 146This is currently implemented for mapping between 147.Tn DARPA 148Internet 149addresses and Ethernet addresses. 150.It Fl arp 151Disable the use of the Address Resolution Protocol. 152.It Cm anycast 153.Pq inet6 only 154Set the IPv6 anycast address bit. 155.It Fl anycast 156.Pq inet6 only 157Clear the IPv6 anycast address bit. 158.It Cm broadcast Ar mask 159.Pq Inet only 160Specify the address to use to represent broadcasts to the 161network. 162The default broadcast address is the address with a host part of all 1's. 163.It Cm debug 164Enable driver dependent debugging code; usually, this turns on 165extra console error logging. 166.It Fl debug 167Disable driver dependent debugging code. 168.ne 1i 169.It Cm delete 170Remove the network address specified. 171This would be used if you incorrectly specified an alias, or it 172was no longer needed. 173If you have incorrectly set an NS address having the side effect 174of specifying the host portion, removing all NS addresses will 175allow you to respecify the host portion. 176.Cm delete 177does not work for IPv6 addresses. 178Use 179.Fl alias 180with explicit IPv6 address instead. 181.It Ar dest_address 182Specify the address of the correspondent on the other end 183of a point to point link. 184.It Cm down 185Mark an interface ``down''. 186When 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 192This is used to specify an Internet host who is willing to receive 193ip packets encapsulating NS packets bound for a remote network. 194An apparent point to point link is constructed, and 195the address specified will be taken as the NS address and network 196of the destination. 197IP encapsulation of 198.Tn CLNP 199packets is done differently. 200.It Cm media Ar type 201Set the media type of the interface to 202.Ar type . 203Some interfaces support the mutually exclusive use of one of several 204different physical media connectors. 205For example, a 10Mb/s Ethernet 206interface might support the use of either 207.Tn AUI 208or twisted pair connectors. 209Setting the media type to 210.Dq 10base5 211or 212.Dq AUI 213would change the currently active connector to the AUI port. 214Setting it to 215.Dq 10baseT 216or 217.Dq UTP 218would activate twisted pair. 219Refer to the interfaces' driver 220specific man page for a complete list of the available types. 221.It Cm mediaopt Ar opts 222Set the specified media options on the interface. 223.Ar opts 224is a comma delimited list of options to apply to the interface. 225Refer to the interfaces' driver specific man page for a complete 226list of available options. 227.It Fl mediaopt Ar opts 228Disable the specified media options on the interface. 229.It Cm mode Ar mode 230If the driver supports the media selection system, set the specified 231operating mode on the interface to 232.Ar mode . 233For IEEE 802.11 wireless interfaces that support multiple operating modes 234this directive is used to select between 802.11a 235.Pq Dq 11a , 236802.11b 237.Pq Dq 11b , 238and 802.11g 239.Pq Dq 11g 240operating modes. 241.It Cm instance Ar minst 242Set the media instance to 243.Ar minst . 244This is useful for devices which have multiple physical layer interfaces 245.Pq PHYs . 246Setting the instance on such devices may not be strictly required 247by the network interface driver as the driver may take care of this 248automatically; see the driver's manual page for more information. 249.It Cm metric Ar n 250Set the routing metric of the interface to 251.Ar n , 252default 0. 253The routing metric is used by the routing protocol 254.Pq Xr routed 8 . 255Higher metrics have the effect of making a route 256less favorable; metrics are counted as addition hops 257to the destination network or host. 258.It Cm mtu Ar n 259Set the maximum transmission unit of the interface to 260.Ar n . 261Most interfaces don't support this option. 262.It Cm netmask Ar mask 263.Pq inet, inet6, and ISO 264Specify how much of the address to reserve for subdividing 265networks into sub-networks. 266The mask includes the network part of the local address 267and the subnet part, which is taken from the host field of the address. 268The mask can be specified as a single hexadecimal number 269with a leading 0x, with a dot-notation Internet address, 270or with a pseudo-network name listed in the network table 271.Xr networks 5 . 272The mask contains 1's for the bit positions in the 32-bit address 273which are to be used for the network and subnet parts, 274and 0's for the host part. 275The mask should contain at least the standard network portion, 276and the subnet field should be contiguous with the network 277portion. 278.Pp 279For INET and INET6 addresses, the netmask can also be given with 280slash-notation after the address 281.Pq e.g 192.168.17.3/24 . 282.\" see 283.\" Xr eon 5 . 284.It Cm nsellength Ar n 285.Pf ( Tn ISO 286only) 287This specifies a trailing number of bytes for a received 288.Tn NSAP 289used for local identification, the remaining leading part of which is 290taken to be the 291.Tn NET 292.Pq Network Entity Title . 293The default value is 1, which is conformant to US 294.Tn GOSIP . 295When an ISO address is set in an ifconfig command, 296it is really the 297.Tn NSAP 298which is being specified. 299For example, in 300.Tn US GOSIP , 30120 hex digits should be 302specified in the 303.Tn ISO NSAP 304to be assigned to the interface. 305There is some evidence that a number different from 1 may be useful 306for 307.Tn AFI 30837 type addresses. 309.It Cm ssid Ar id 310.Pq IEEE 802.11 devices only 311Configure the Service Set Identifier (a.k.a. the network name) 312for IEEE 802.11-based wireless network interfaces. 313The 314.Ar id 315can either be any text string up to 32 characters in length, 316or a series of up to 64 hexadecimal digits preceded by 317.Dq 0x . 318Setting 319.Ar id 320to the empty string allows the interface to connect to any available 321access point. 322.It Cm nwid Ar id 323Synonym for 324.Dq ssid . 325.It Cm nwkey Ar key 326.Pq IEEE 802.11 devices only 327Enable WEP encryption for IEEE 802.11-based wireless network interfaces 328with the 329.Ar key . 330The 331.Ar key 332can either be a string, a series of hexadecimal digits preceded by 333.Dq 0x , 334or a set of keys in the form 335.Ar n:k1,k2,k3,k4 , 336where 337.Ar n 338specifies which of keys will be used for all transmitted packets, 339and four keys, 340.Ar k1 341through 342.Ar k4 , 343are configured as WEP keys. 344Note that the order must be match within same network if multiple keys 345are used. 346For IEEE 802.11 wireless network, the length of each key is restricted to 34740 bits, i.e. 5-character string or 10 hexadecimal digits, 348while the WaveLAN/IEEE Gold cards accept the 104 bits 349.Pq 13 characters 350key. 351.It Cm nwkey Cm persist 352.Pq IEEE 802.11 devices only 353Enable WEP encryption for IEEE 802.11-based wireless network interfaces 354with the persistent key written in the network card. 355.It Cm nwkey Cm persist: Ns Ar key 356.Pq IEEE 802.11 devices only 357Write the 358.Ar key 359to the persistent memory of the network card, and 360enable WEP encryption for IEEE 802.11-based wireless network interfaces 361with the 362.Ar key . 363.It Fl nwkey 364.Pq IEEE 802.11 devices only 365Disable WEP encryption for IEEE 802.11-based wireless network interfaces. 366.It Cm powersave 367.Pq IEEE 802.11 devices only 368Enable 802.11 power saving mode. 369.It Fl powersave 370.Pq IEEE 802.11 devices only 371Disable 802.11 power saving mode. 372.It Cm powersavesleep Ar duration 373.Pq IEEE 802.11 devices only 374Set the receiver sleep duration in milliseconds for 802.11 power saving mode. 375.It Cm bssid Ar bssid 376.Pq IEEE 802.11 devices only 377Set the desired BSSID for IEEE 802.11-based wireless network interfaces. 378.It Fl bssid 379.Pq IEEE 802.11 devices only 380Unset the desired BSSID for IEEE 802.11-based wireless network interfaces. 381The interface will automatically select a BSSID in this mode, which is 382the default. 383.It Cm chan Ar chan 384.Pq IEEE 802.11 devices only 385Select the channel 386.Pq radio frequency 387to be used for IEEE 802.11-based wireless network interfaces. 388.It Fl chan 389.Pq IEEE 802.11 devices only 390Unset the desired channel to be used 391for IEEE 802.11-based wireless network interfaces. 392It doesn't effect the channel to be created for IBSS or hostap mode. 393.It Cm tunnel Ar src_addr Ar dest_addr 394.Pq IP tunnel devices only 395Configure the physical source and destination address for IP tunnel 396interfaces, including 397.Xr gif 4 . 398The arguments 399.Ar src_addr 400and 401.Ar dest_addr 402are interpreted as the outer source/destination for the encapsulating 403IPv4/IPv6 header. 404.It Cm deletetunnel 405Unconfigure the physical source and destination address for IP tunnel 406interfaces previously configured with 407.Cm tunnel . 408.It Cm create 409Create the specified network pseudo-device. 410.It Cm destroy 411Destroy the specified network pseudo-device. 412.It Cm pltime Ar n 413.Pq inet6 only 414Set preferred lifetime for the address. 415.It Cm prefixlen Ar n 416.Pq inet and inet6 only 417Effect is similar to 418.Cm netmask . 419but you can specify by prefix length by digits. 420.It Cm deprecated 421.Pq inet6 only 422Set the IPv6 deprecated address bit. 423.It Fl deprecated 424.Pq inet6 only 425Clear the IPv6 deprecated address bit. 426.It Cm tentative 427.Pq inet6 only 428Set the IPv6 tentative address bit. 429.It Fl tentative 430.Pq inet6 only 431Clear the IPv6 tentative address bit. 432.It Cm eui64 433.Pq inet6 only 434Fill interface index 435.Pq lowermost 64bit of an IPv6 address 436automatically. 437.It Cm link[0-2] 438Enable special processing of the link level of the interface. 439These three options are interface specific in actual effect, however, 440they are in general used to select special modes of operation. 441An example 442of this is to enable SLIP compression, or to select the connector type 443for some ethernet cards. 444Refer to the man page for the specific driver 445for more information. 446.ne 1i 447.It Fl link[0-2] 448Disable special processing at the link level with the specified interface. 449.It Cm up 450Mark an interface ``up''. 451This may be used to enable an interface after an ``ifconfig down.'' 452It happens automatically when setting the first address on an interface. 453If the interface was reset when previously marked down, 454the hardware will be re-initialized. 455.It Cm vlan Ar tag 456If the interface is a 457.Xr vlan 4 458pseudo-interface, set the VLAN tag to 459.Ar tag . 460This is a 16-bit number which is used to create an 802.1Q VLAN header for 461packets sent from the 462.Xr vlan 4 463interface. 464Note that 465.Cm vlan 466and 467.Cm vlanif 468must be set at the same time. 469.It Cm vlanif Ar iface 470If the interface is a 471.Xr vlan 4 472pseudo-interface, associate the physical interface 473.Ar iface 474with it. 475Packets transmitted through the 476.Xr vlan 4 477interface will be diverted to the specified physical interface 478.Ar iface 479with 802.1Q VLAN encapsulation. 480Packets with 802.1Q encapsulation received 481by the physical interface with the correct VLAN tag will be diverted to the 482associated 483.Xr vlan 4 484pseudo-interface. 485The VLAN interface is assigned a copy of the physical 486interface's flags and 487.Tn Ethernet 488address. 489If the 490.Xr vlan 4 491interface already has a physical interface associated with it, this command 492will fail. 493To change the association to another physical interface, the 494existing association must be cleared first. 495Note that 496.Cm vlanif 497and 498.Cm vlan 499must be set at the same time. 500.It Cm agrport Ar iface 501Add 502.Ar iface 503to the 504.Xr agr 4 505interface. 506.It Cm -agrport Ar iface 507Remove 508.Ar iface 509from the 510.Xr agr 4 511interface. 512.It Cm vltime Ar n 513.Pq inet6 only 514Set valid lifetime for the address. 515.It Cm ip4csum 516Shorthand of 517.Dq ip4csum-tx ip4csum-rx 518.It Cm -ip4csum 519Shorthand of 520.Dq -ip4csum-tx -ip4csum-rx 521.It Cm tcp4csum 522Shorthand of 523.Dq tcp4csum-tx tcp4csum-rx 524.It Cm -tcp4csum 525Shorthand of 526.Dq -tcp4csum-tx -tcp4csum-rx 527.It Cm udp4csum 528Shorthand of 529.Dq udp4csum-tx udp4csum-rx 530.It Cm -udp4csum 531Shorthand of 532.Dq -udp4csum-tx -udp4csum-rx 533.It Cm tcp6csum 534Shorthand of 535.Dq tcp6csum-tx tcp6csum-rx 536.It Cm -tcp6csum 537Shorthand of 538.Dq -tcp6csum-tx -tcp6csum-rx 539.It Cm udp6csum 540Shorthand of 541.Dq udp6csum-tx udp6csum-rx 542.It Cm -udp6csum 543Shorthand of 544.Dq -udp6csum-tx -udp6csum-rx 545.It Cm ip4csum-tx 546Enable hardware-assisted IPv4 header checksums for the out-bound direction. 547.It Cm -ip4csum-tx 548Disable hardware-assisted IPv4 header checksums for the out-bound direction. 549.It Cm ip4csum-rx 550Enable hardware-assisted IPv4 header checksums for the in-bound direction. 551.It Cm -ip4csum-rx 552Disable hardware-assisted IPv4 header checksums for the in-bound direction. 553.It Cm tcp4csum-tx 554Enable hardware-assisted TCP/IPv4 checksums for the out-bound direction. 555.It Cm -tcp4csum-tx 556Disable hardware-assisted TCP/IPv4 checksums for the out-bound direction. 557.It Cm tcp4csum-rx 558Enable hardware-assisted TCP/IPv4 checksums for the in-bound direction. 559.It Cm -tcp4csum-rx 560Disable hardware-assisted TCP/IPv4 checksums for the in-bound direction. 561.It Cm udp4csum-tx 562Enable hardware-assisted UDP/IPv4 checksums for the out-bound direction. 563.It Cm -udp4csum-tx 564Disable hardware-assisted UDP/IPv4 checksums for the out-bound direction. 565.It Cm udp4csum-rx 566Enable hardware-assisted UDP/IPv4 checksums for the in-bound direction. 567.It Cm -udp4csum-rx 568Disable hardware-assisted UDP/IPv4 checksums for the in-bound direction. 569.It Cm tcp6csum-tx 570Enable hardware-assisted TCP/IPv6 checksums for the out-bound direction. 571.It Cm -tcp6csum-tx 572Disable hardware-assisted TCP/IPv6 checksums for the out-bound direction. 573.It Cm tcp6csum-rx 574Enable hardware-assisted TCP/IPv6 checksums for the in-bound direction. 575.It Cm -tcp6csum-rx 576Disable hardware-assisted TCP/IPv6 checksums for the in-bound direction. 577.It Cm udp6csum-tx 578Enable hardware-assisted UDP/IPv6 checksums for the out-bound direction. 579.It Cm -udp6csum-tx 580Disable hardware-assisted UDP/IPv6 checksums for the out-bound direction. 581.It Cm udp6csum-rx 582Enable hardware-assisted UDP/IPv6 checksums for the in-bound direction. 583.It Cm -udp6csum-rx 584Disable hardware-assisted UDP/IPv6 checksums for the in-bound direction. 585.It Cm tso4 586Enable hardware-assisted TCP/IPv4 segmentation on interfaces that 587support it. 588.It Cm -tso4 589Disable hardware-assisted TCP/IPv4 segmentation on interfaces that 590support it. 591.El 592.Pp 593.Nm 594displays the current configuration for a network interface 595when no optional parameters are supplied. 596If a protocol family is specified, 597.Nm 598will report only the details specific to that protocol 599family. 600.Pp 601If the 602.Fl s 603flag is passed before an interface name, 604.Nm 605will attempt to query the interface for its media status. 606If the 607interface supports reporting media status, and it reports that it does 608not appear to be connected to a network, 609.Nm 610will exit with status of 1 611.Pq false ; 612otherwise, it will exit with a 613zero 614.Pq true 615exit status. 616Not all interface drivers support media 617status reporting. 618.Pp 619If the 620.Fl m 621flag is passed before an interface name, 622.Nm 623will display all of the supported media for the specified interface. 624If the 625.Fl L 626flag is supplied, address lifetime is displayed for IPv6 addresses, 627as time offset string. 628.Pp 629Optionally, the 630.Fl a 631flag may be used instead of an interface name. 632This flag instructs 633.Nm 634to display information about all interfaces in the system. 635.Fl d 636limits this to interfaces that are down, 637.Fl u 638limits this to interfaces that are up, 639.Fl b 640limits this to broadcast interfaces, and 641.Fl s 642omits interfaces which appear not to be connected to a network. 643.Pp 644The 645.Fl l 646flag may be used to list all available interfaces on the system, with 647no other additional information. 648Use of this flag is mutually exclusive 649with all other flags and commands, except for 650.Fl d 651.Pq only list interfaces that are down , 652.Fl u 653.Pq only list interfaces that are up , 654.Fl s 655.Pq only list interfaces that may be connected , 656.Fl b 657.Pq only list broadcast interfaces . 658.Pp 659The 660.Fl C 661flag may be used to list all of the interface cloners available on 662the system, with no additional information. 663Use of this flag is 664mutually exclusive with all other flags and commands. 665.Pp 666The 667.Fl v 668flag prints statistics on packets sent and received on the given 669interface. 670If 671.Fl h 672is used in conjunction with 673.Fl v , 674the byte statistics will be printed in "human-readable" format. 675The 676.Fl z 677flag is identical to the 678.Fl v 679flag except that it zeros the interface input and output statistics 680after printing them. 681.Pp 682Only the super-user may modify the configuration of a network interface. 683.Sh DIAGNOSTICS 684Messages indicating the specified interface does not exist, the 685requested address is unknown, or the user is not privileged and 686tried to alter an interface's configuration. 687.Sh SEE ALSO 688.Xr netstat 1 , 689.Xr agr 4 , 690.Xr ifmedia 4 , 691.Xr netintro 4 , 692.Xr vlan 4 , 693.Xr ifconfig.if 5 , 694.\" .Xr eon 5 , 695.Xr rc 8 , 696.Xr routed 8 697.Sh HISTORY 698The 699.Nm 700command appeared in 701.Bx 4.2 . 702