$OpenBSD: ifmedia.4,v 1.30 2023/08/15 00:43:00 jsg Exp $
$NetBSD: ifmedia.4,v 1.14 2001/06/30 17:57:56 bjh21 Exp $

Copyright (c) 1998 The NetBSD Foundation, Inc.
All rights reserved.

This code is derived from software contributed to The NetBSD Foundation
by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
NASA Ames Research Center.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

.Dd $Mdocdate: March 31 2022 $ .Dt IFMEDIA 4 .Os .Sh NAME .Nm ifmedia .Nd network interface media settings .Sh SYNOPSIS n sys/socket.h n net/if.h n net/if_media.h .Sh DESCRIPTION The .Nm interface provides a consistent method for querying and setting network interface media and media options. The media is typically set using the .Xr ifconfig 8 command.

p Currently these link types are supported by .Nm ifmedia :

p l -tag -offset indent -width IFM_IEEE80211 -compact t Dv IFM_ETHER Ethernet t Dv IFM_FDDI FDDI t Dv IFM_IEEE80211 IEEE802.11 Wireless LAN t Dv IFM_TDM Time Division Multiplex t Dv IFM_CARP CARP .El

p The following sections describe the possible media settings for each link type. Not all of these are supported by every device; refer to your device's manual page for more information.

p The lists below provide the possible names of each media type or option. The first name in the list is the canonical name of the media type or option. Additional names are acceptable aliases for the media type or option. .Sh COMMON MEDIA TYPES AND OPTIONS The following media types are shared by all link types:

p l -tag -offset indent -width IFM_MANUAL -compact t Dv IFM_AUTO Autoselect the best media. [autoselect, auto] t Dv IFM_MANUAL Jumper or switch on device selects media. [manual] t Dv IFM_NONE Deselect all media. [none] .El

p The following media options are shared by all link types: l -tag -offset indent -width IFM_FLAG0 t Dv IFM_FDX Place the device into full-duplex mode. This option only has meaning if the device is normally not full-duplex. t Dv IFM_HDX Place the device into half-duplex mode. This option only has meaning if the device is normally not half-duplex. [half-duplex, hdx] t Dv IFM_FLOW Enable hardware flow control on device. t Dv IFM_FLAG0 Driver-defined flag. [flag0] t Dv IFM_FLAG1 Driver-defined flag. [flag1] t Dv IFM_FLAG2 Driver-defined flag. [flag2] t Dv IFM_LOOP Place the device into hardware loopback mode. [loopback, hw-loopback, loop] .El .Sh MEDIA TYPES AND OPTIONS FOR ETHERNET The following media types are defined for Ethernet: l -tag -offset indent -width IFM_10G_SFP_CU t Dv IFM_10_T 10BASE-T, 10Mb/s over unshielded twisted pair, RJ45 connector. [10baseT, UTP, 10UTP] t Dv IFM_10_2 10BASE2, 10Mb/s over coaxial cable, BNC connector; also called Thinnet. [10base2, BNC, 10BNC] t Dv IFM_10_5 10BASE5, 10Mb/s over 15-wire cables, DB15 connector; also called AUI. [10base5, AUI, 10AUI] t Dv IFM_10_STP 10BASE-STP, 10Mb/s over shielded twisted pair, DB9 connector. [10baseSTP, STP, 10STP] t Dv IFM_10_FL 10BASE-FL, 10Mb/s over fiber optic cables. [10baseFL, FL, 10FL] t Dv IFM_100_TX 100BASE-TX, 100Mb/s over unshielded twisted pair, RJ45 connector. [100baseTX, 100TX] t Dv IFM_100_FX 100BASE-FX, 100Mb/s over fiber optic cables. [100baseFX, 100FX] t Dv IFM_100_T4 100BASE-T4, 100Mb/s over 4-wire (category 3) unshielded twisted pair, RJ45 connector. [100baseT4, 100T4] t Dv IFM_100_T2 100BASE-T2. [100baseT2, 100T2] t Dv IFM_100_VG 100VG-AnyLAN. [100baseVG, 100VG] t Dv IFM_1000_SX 1000BASE-SX, 1Gb/s over multi-mode fiber optic cables. [1000baseSX, 1000SX] t Dv IFM_1000_LX 1000BASE-LX, 1Gb/s over single-mode fiber optic cables. [1000baseLX, 1000LX] t Dv IFM_1000_CX 1000BASE-CX, 1Gb/s over shielded twisted pair. [1000baseCX, 1000CX] t Dv IFM_1000_T 1000BASE-T, 1Gb/s over category 5 unshielded twisted pair, RJ45 connector. [1000baseT, 1000T] t Dv IFM_1000_TX Compatibility for 1000BASE-T. [1000baseTX, 1000TX] t Dv IFM_2500_SX 2500BASE-SX, 2.5Gb/s over multi-mode fiber optic cables. [2500baseSX, 2500SX] t Dv IFM_2500_T 2500BASE-T, 2.5Gb/s over unshielded twisted pair, RJ45 connector. [2500baseT, 2500BASE-T] t Dv IFM_10G_CX4 10GBASE-CX4, 10Gb/s over XAUI 4-lane PCS and copper cables. [10GbaseCX4, 10GCX4, 10GBASE-CX4] t Dv IFM_10G_LR 10GBASE-LR, 10Gb/s over single-mode fiber optic cables. [10GbaseLR, 10GLR, 10GBASE-LR] t Dv IFM_10G_SFP_CU 10GSFP+Cu, 10Gb/s over SFP+ Direct Attach cables. [10GSFP+Cu, 10GCu] t Dv IFM_10G_SR 10GBASE-SR, 10Gb/s over multi-mode fiber optic cables. [10GbaseSR, 10GSR, 10GBASE-SR] t Dv IFM_10G_T 10GBASE-T, 10Gb/s over unshielded twisted pair, RJ45 connector. [10GbaseT, 10GT, 10GBASE-T] t Dv IFM_HPNA_1 HomePNA 1.0, 1Mb/s over 2-wire (category 3) unshielded twisted pair [HomePNA1, HPNA1] .El

p The following media options are defined for Ethernet: l -tag -offset indent -width IFM_ETH_RXPAUSE t Dv IFM_ETH_MASTER Configure a 1000BASE-T PHY as a MASTER PHY. t Dv IFM_ETH_RXPAUSE Receive flow control is enabled on the 1000BASE-T PHY. t Dv IFM_ETH_TXPAUSE Transmit flow control is enabled on the 1000BASE-T PHY. .El .Sh MEDIA TYPES AND OPTIONS FOR FDDI The following media types are defined for FDDI:

p l -tag -offset indent -width IFM_FDDI_SMF -compact t Dv IFM_FDDI_SMF Single-mode fiber. [Single-mode, SMF] t Dv IFM_FDDI_MMF Multi-mode fiber. [Multi-mode, MMF] t Dv IFM_FDDI_UTP Unshielded twisted pair, RJ45 connector. [UTP, CDDI] .El

p The following media options are defined for FDDI: l -tag -offset indent -width IFM_FDDI_DA t Dv IFM_FDDI_DA Dual-attached station vs. Single-attached station. [dual-attach, das] .El .Sh MEDIA TYPES AND OPTIONS FOR IEEE802.11 WIRELESS LAN The following media modes are defined for IEEE802.11 Wireless LAN:

p l -tag -offset indent -width IFM_IEEE80211_11AC -compact t Dv IFM_IEEE80211_11A 5GHz, OFDM mode. [11a] t Dv IFM_IEEE80211_11B 2GHz, DSSS/CCK mode. [11b] t Dv IFM_IEEE80211_11G 2GHz, DSSS/CCK/OFDM mode. [11g] t Dv IFM_IEEE80211_FH 2GHz, GFSK mode. [fh] t Dv IFM_IEEE80211_11N 2GHz/5GHz, HT mode. [11n] t Dv IFM_IEEE80211_11AC 5GHz, VHT mode. [11ac] .El

p The following media options are defined for IEEE802.11 Wireless LAN:

p l -tag -offset indent -width IFM_IEEE80211_IBSSMASTER -compact t Dv IFM_IEEE80211_ADHOC Ad-hoc mode. [adhoc] t Dv IFM_IEEE80211_HOSTAP Host Access Point mode. [hostap] t Dv IFM_IEEE80211_IBSS IBSS mode. [ibss] t Dv IFM_IEEE80211_IBSSMASTER IBSS master mode. [ibssmaster] t Dv IFM_IEEE80211_MONITOR Monitor mode. [monitor] .El

p All of the above media options are mutually exclusive. If no media option is used, the wireless interface will try to find an access point to connect to. .Cm hostap mode allows the wireless interface to act as an access point for other 802.11 devices. .Cm ibss mode is the standardized method of operating without an access point, with each participating device taking on part of the role of an access point. .Cm adhoc mode, more accurately known as .Em ad-hoc demo mode , is not specified by the IEEE 802.11 standard and only works with .Xr wi 4 devices. Likewise, .Cm ibssmaster mode only works with .Xr wi 4 devices. On standard 802.11 networks the IBSS master role is assigned automatically.

p The channels detailed below are defined for IEEE802.11 Wireless LAN in the 2.4GHz band. The list of available frequencies is dependent on radio regulations specified by regional authorities. Recognized regulatory authorities include the FCC (United States), ETSI (Europe), and Japan. Frequencies in the table are specified in MHz. l -column "Channel " "2412" "ETSI" "Japan" -offset indent t Em Channel Ta Em FCC Ta Em ETSI Ta Em Japan t 1 Ta 2412 Ta 2412 Ta 2412 t 2 Ta 2417 Ta 2417 Ta 2417 t 3 Ta 2422 Ta 2422 Ta 2422 t 4 Ta 2427 Ta 2427 Ta 2427 t 5 Ta 2432 Ta 2432 Ta 2432 t 6 Ta 2437 Ta 2437 Ta 2437 t 7 Ta 2442 Ta 2442 Ta 2442 t 8 Ta 2447 Ta 2447 Ta 2447 t 9 Ta 2452 Ta 2452 Ta 2452 t 10 Ta 2457 Ta 2457 Ta 2457 t 11 Ta 2462 Ta 2462 Ta 2462 t 12 Ta - Ta 2467 Ta 2467 t 13 Ta - Ta 2472 Ta 2472 t 14 Ta - Ta - Ta 2484 .El

p The channels do overlap; the bandwidth required for each channel is about 20MHz. When using multiple channels in close proximity, it is suggested that channels be separated by at least 25MHz. In the US, this means that only channels 1, 6, and 11 may be used simultaneously without interference.

p Channels in the 5GHz band are too numerous to list here. Regulation of their use, particularly outdoors, varies between countries. Users are advised to inform themselves about applicable regulations before configuring wireless LAN devices for use in the 5GHz band.

p The following media types are defined for IEEE802.11 Wireless LAN:

p l -tag -offset indent -width IFM_IEEE80211_FH1 -compact t Dv IFM_IEEE80211_FH1 Frequency Hopping 1Mbps. [FH1] t Dv IFM_IEEE80211_FH2 Frequency Hopping 2Mbps. [FH2] t Dv IFM_IEEE80211_DS1 Direct Sequence 1Mbps. [DS1] t Dv IFM_IEEE80211_DS2 Direct Sequence 2Mbps. [DS2] .El

p The above media types were first introduced in the IEEE 802.11-1997 standard and are used in the 2.4GHz band only. Frequency Hopping Spread Spectrum modulation is incompatible with modern 802.11 networks. Direct Sequence Spread Spectrum modulation (DSSS) frames can still be used if backwards compatibility to 802.11b is enabled.

p l -tag -offset indent -width IFM_IEEE80211_DS22 -compact t Dv IFM_IEEE80211_DS5 Direct Sequence 5.5Mbps. [DS5] t Dv IFM_IEEE80211_DS11 Direct Sequence 11Mbps. [DS11] t Dv IFM_IEEE80211_DS22 Direct Sequence 22Mbps. [DS22] .El

p The above media types were first introduced in the IEEE 802.11b-1999 standard and are used in the 2.4GHz band only. They use Complementary Code Keying (CCK) which, compared to frames sent at 1Mbps or 2Mbps, reduces the possible distance between transmitter and receiver.

p Modern 802.11 networks remain compatible with 802.11b, even though DSSS frames are incompatible with modern 802.11 frames using OFDM. Co-existence with 802.11b requires OFDM transmitters to either risk frame collisions or .Dq reserve the medium with a separate preceding transmission that DSSS receivers are able to decode. This causes additional overhead which some 802.11 deployments avoid by deliberately disabling backwards compatibility with 802.11b.

p l -tag -offset indent -width IFM_IEEE80211_VHT_MCSx -compact t Dv IFM_IEEE80211_OFDM6 OFDM 6Mbps. [OFDM6] t Dv IFM_IEEE80211_OFDM9 OFDM 9Mbps. [OFDM9] t Dv IFM_IEEE80211_OFDM12 OFDM 12Mbps. [OFDM12] t Dv IFM_IEEE80211_OFDM18 OFDM 18Mbps. [OFDM18] t Dv IFM_IEEE80211_OFDM24 OFDM 24Mbps. [OFDM24] t Dv IFM_IEEE80211_OFDM36 OFDM 36Mbps. [OFDM36] t Dv IFM_IEEE80211_OFDM48 OFDM 48Mbps. [OFDM48] t Dv IFM_IEEE80211_OFDM54 OFDM 54Mbps. [OFDM54] t Dv IFM_IEEE80211_OFDM72 OFDM 72Mbps. [OFDM72] .El

p The above media types were first introduced in the IEEE 802.11a-1999 standard for the 5GHz band, and in the IEEE 802.11g-2003 standard for the 2.4GHz band. OFDM with 72Mbps is a proprietary extension and was never standardized by IEEE.

p Orthogonal Frequency Division Multiplexing (OFDM) is the current standard modulation technique for 802.11. Each 20MHz channel used by 802.11a and 802.11g provides space for 48 OFDM sub-carriers for data. The sub-carriers use BPSK, QPSK, 16QAM, or 64QAM modulation, combined with a particular coding rate for error correction at the receiver. The coding rate specifies how many data bits in a frame are transmitted without redundancy. l -column "Modulation" "Coding Rate " "Mbit/s" -offset 6n t Em Modulation Ta Em Coding Rate Ta Em Mbit/s t BPSK Ta 1/2 Ta 6 t BPSK Ta 3/4 Ta 9 t QPSK Ta 1/2 Ta 12 t QPSK Ta 3/4 Ta 18 t 16QAM Ta 1/2 Ta 24 t 16QAM Ta 3/4 Ta 36 t 64QAM Ta 1/2 Ta 48 t 64QAM Ta 3/4 Ta 52 .El

p The IEEE 802.11n-2009 standard for .Dq High Throughput (HT) wireless LAN defines additional sub-carriers, modulations, and coding rates. The channel bandwidth for data frame transmissions was optionally extended to 40MHz, with full backwards compatibility to 802.11a/b/g devices which cannot decode 40MHz transmissions. Several additional features were introduced, most notably MIMO (multiple-input, multiple-output). With MIMO, a data stream is divided across up to 4 .Dq spatial streams , which are transmitted in parallel by a corresponding amount of antennas. Each spatial stream is received with a dedicated antenna, and the spatial streams are de-multiplexed to obtain the original data stream.

p 802.11n assigns a numeric identifier to all possible combinations of modulation, coding rate, and number of spatial streams. This results in 77 distinct modulation and coding schemes, abbreviated as .Dq MCS .

p .Nm ifmedia supports HT_MCS0 up to HT_MCS31:

p l -tag -offset indent -width IFM_IEEE80211_VHT_MCSx -compact t Dv IFM_IEEE80211_HT_MCSx HT OFDM MCS x (where x is in the range 0 - 31, inclusive). [HT-MCSx] .El

p In practice, only MCS-0 to MCS-32 are supported by commonly available devices. The remaining MCS define combinations where distinct spatial streams employ distinct modulations, a feature which was not widely implemented by hardware vendors.

p The IEEE 802.11ac-2013 standard for .Dq Very High Throughput (VHT) wireless LAN operates in the 5GHz band only. The channel bandwidth for data frame transmissions can be up to 160MHz wide. The MCS identifiers were redefined and vastly reduced in number. As a result, only VHT_MCS0 to VHT_MCS9 are defined for 802.11ac:

p l -tag -offset indent -width IFM_IEEE80211_VHT_MCSx -compact t Dv IFM_IEEE80211_VHT_MCSx VHT OFDM MCS x (where x is in the range 0 - 9, inclusive). [VHT-MCSx] .El

p The number of spatial streams is no longer associated with a given VHT MCS identifier and must be specified as a separate .Dq NSS parameter. This parameter is not yet implemented by .Nm ifmedia . .Sh MEDIA TYPES AND OPTIONS FOR TDM The following media types are defined for TDM: l -tag -offset indent -width IFM_TDM_E1_G704_CRC4 t Dv IFM_TDM_E1 E1, 2048kb/s HDB3 encoded, G.703 clearchannel serial line. [e1] t Dv IFM_TDM_E1_AMI E1, 2048kb/s AMI encoded, G.703 clearchannel serial line. [e1-ami] t Dv IFM_TDM_E1_AMI_G704 E1, 2048kb/s AMI encoded, G.704 structured serial line. [e1-ami-g.704] t Dv IFM_TDM_E1_G704 E1, 2048kb/s HDB3 encoded, G.704 structured serial line. [e1-g.704] t Dv IFM_TDM_E1_G704_CRC4 E1, 2048kb/s HDB3 encoded, G.704 structured serial line with CRC4 checksum. [e1-g.704-crc4] t Dv IFM_TDM_E3 E3, 34368kb/s HDB3 encoded, G.703 clearchannel serial line. [e3] t Dv IFM_TDM_E3_G751 E3, 34368kb/s HDB3 encoded, G.751 structured serial line. [e3-g.751] t Dv IFM_TDM_E3_G832 E3, 34368kb/s HDB3 encoded, G.832 structured serial line. [e3-g.832] t Dv IFM_TDM_T1 T1, 1536xkb/s B8ZS encoded, extended super frame (ESF) structured serial line. [t1] t Dv IFM_TDM_T1_AMI T1, 1536kb/s AMI encoded, super frame (SF) structured serial line. [t1-ami] t Dv IFM_TDM_T3 T3, 44736kb/s B3ZS, C-bit structured serial line. [t3] t Dv IFM_TDM_T3_M13 T3, 44736kb/s B3ZS, M13 structured serial line. [t3-m13] .El

p The following media options are defined for TDM: l -tag -offset indent -width IFM_TDM_HDLC_CRC16 t Dv IFM_TDM_HDLC_CRC16 Cisco HDLC with 16-bit CRC checksum encoding. [hdlc-crc16] t Dv IFM_TDM_FR_ANSI ANSI/ITU Framerelay encoding. [framerelay-ansi, framerelay-itu] t Dv IFM_TDM_FR_CISCO Cisco Framerelay encoding. [framerelay-cisco] t Dv IFM_TDM_PPP PPP encoding. [ppp] .El

p By default TDM interfaces will use Cisco HDLC encoding with a 32-bit CRC checksum.

p The following media modes are defined for TDM: l -tag -offset indent -width IFM_TDM_MASTER t Dv IFM_TDM_MASTER Use local clock source as master clock. [master] .El .Sh MEDIA TYPES AND OPTIONS FOR CARP .Xr carp 4 does not support any media types or options. .Sh SEE ALSO .Xr netintro 4 , .Xr ifconfig 8 .Sh HISTORY The .Nm interface first appeared in sx 3.0 . The implementation that appeared in .Nx 1.3 was written by Jonathan Stone and Jason R. Thorpe to be compatible with the BSDI API. It has since gone through several revisions which have extended the API while maintaining backwards compatibility with the original API.

p Support for the .Sy IEEE802.11 Wireless LAN link type was added in .Nx 1.5 .

p .Sy Host AP mode was added in .Ox 3.1 .