IFMEDIA(4) | Device Drivers Manual | IFMEDIA(4) |
ifmedia
— network
interface media settings
#include
<sys/socket.h>
#include <net/if.h>
#include <net/if_media.h>
The ifmedia
interface provides a
consistent method for querying and setting network interface media and media
options. The media is typically set using the
ifconfig(8) command.
Currently these link types are supported by
ifmedia
:
IFM_ETHER
IFM_FDDI
IFM_IEEE80211
IFM_TDM
IFM_CARP
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.
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.
The following media types are shared by all link types:
IFM_AUTO
IFM_MANUAL
IFM_NONE
The following media options are shared by all link types:
IFM_FDX
IFM_HDX
IFM_FLOW
IFM_FLAG0
IFM_FLAG1
IFM_FLAG2
IFM_LOOP
The following media types are defined for Ethernet:
IFM_10_T
IFM_10_2
IFM_10_5
IFM_10_STP
IFM_10_FL
IFM_100_TX
IFM_100_FX
IFM_100_T4
IFM_100_T2
IFM_100_VG
IFM_1000_SX
IFM_1000_LX
IFM_1000_CX
IFM_1000_T
IFM_1000_TX
IFM_2500_SX
IFM_10G_CX4
IFM_10G_LR
IFM_10G_SFP_CU
IFM_10G_SR
IFM_10G_T
IFM_HPNA_1
The following media options are defined for Ethernet:
IFM_ETH_MASTER
IFM_ETH_RXPAUSE
IFM_ETH_TXPAUSE
The following media types are defined for FDDI:
IFM_FDDI_SMF
IFM_FDDI_MMF
IFM_FDDI_UTP
The following media options are defined for FDDI:
IFM_FDDI_DA
The following media modes are defined for IEEE802.11 Wireless LAN:
IFM_IEEE80211_11A
IFM_IEEE80211_11B
IFM_IEEE80211_11G
IFM_IEEE80211_FH
IFM_IEEE80211_11N
IFM_IEEE80211_11AC
The following media options are defined for IEEE802.11 Wireless LAN:
IFM_IEEE80211_ADHOC
IFM_IEEE80211_HOSTAP
IFM_IEEE80211_IBSS
IFM_IEEE80211_IBSSMASTER
IFM_IEEE80211_MONITOR
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. hostap
mode allows the
wireless interface to act as an access point for other 802.11 devices.
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. adhoc
mode, more
accurately known as ad-hoc
demo mode, is not specified by the IEEE 802.11 standard and only
works with wi(4) devices.
Likewise, ibssmaster
mode only works with
wi(4) devices. On standard 802.11
networks the IBSS master role is assigned automatically.
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.
Channel | FCC | ETSI | Japan |
1 | 2412 | 2412 | 2412 |
2 | 2417 | 2417 | 2417 |
3 | 2422 | 2422 | 2422 |
4 | 2427 | 2427 | 2427 |
5 | 2432 | 2432 | 2432 |
6 | 2437 | 2437 | 2437 |
7 | 2442 | 2442 | 2442 |
8 | 2447 | 2447 | 2447 |
9 | 2452 | 2452 | 2452 |
10 | 2457 | 2457 | 2457 |
11 | 2462 | 2462 | 2462 |
12 | - | 2467 | 2467 |
13 | - | 2472 | 2472 |
14 | - | - | 2484 |
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.
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.
The following media types are defined for IEEE802.11 Wireless LAN:
IFM_IEEE80211_FH1
IFM_IEEE80211_FH2
IFM_IEEE80211_DS1
IFM_IEEE80211_DS2
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.
IFM_IEEE80211_DS5
IFM_IEEE80211_DS11
IFM_IEEE80211_DS22
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.
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 “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.
IFM_IEEE80211_OFDM6
IFM_IEEE80211_OFDM9
IFM_IEEE80211_OFDM12
IFM_IEEE80211_OFDM18
IFM_IEEE80211_OFDM24
IFM_IEEE80211_OFDM36
IFM_IEEE80211_OFDM48
IFM_IEEE80211_OFDM54
IFM_IEEE80211_OFDM72
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.
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.
Modulation | Coding Rate | Mbit/s |
BPSK | 1/2 | 6 |
BPSK | 3/4 | 9 |
QPSK | 1/2 | 12 |
QPSK | 3/4 | 18 |
16QAM | 1/2 | 24 |
16QAM | 3/4 | 36 |
64QAM | 1/2 | 48 |
64QAM | 3/4 | 52 |
The IEEE 802.11n-2009 standard for “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 “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.
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 “MCS”.
ifmedia
supports HT_MCS0 up to
HT_MCS31:
IFM_IEEE80211_HT_MCSx
In practice, only MCS-0 to MCS-32 are supported by commonly available devices. The remaining MCS define combinations where distinct spacial streams employ distinct modulations, a feature which was not widely implemented by hardware vendors.
The IEEE 802.11ac-2013 standard for “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:
IFM_IEEE80211_VHT_MCSx
The number of spatial streams is no longer associated with a given
VHT MCS identifier and must be specified as a separate “NSS”
parameter. This parameter is not yet implemented by
ifmedia
.
The following media types are defined for TDM:
IFM_TDM_E1
IFM_TDM_E1_AMI
IFM_TDM_E1_AMI_G704
IFM_TDM_E1_G704
IFM_TDM_E1_G704_CRC4
IFM_TDM_E3
IFM_TDM_E3_G751
IFM_TDM_E3_G832
IFM_TDM_T1
IFM_TDM_T1_AMI
IFM_TDM_T3
IFM_TDM_T3_M13
The following media options are defined for TDM:
IFM_TDM_HDLC_CRC16
IFM_TDM_FR_ANSI
IFM_TDM_FR_CISCO
IFM_TDM_PPP
By default TDM interfaces will use Cisco HDLC encoding with a 32-bit CRC checksum.
The following media modes are defined for TDM:
IFM_TDM_MASTER
carp(4) does not support any media types or options.
The ifmedia
interface first appeared in
BSD/OS 3.0. The implementation that appeared in
NetBSD 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.
Support for the IEEE802.11 Wireless LAN link type was added in NetBSD 1.5.
Host AP mode was added in OpenBSD 3.1.
May 16, 2020 | OpenBSD-6.8 |