HOSTAPD.CONF(5) | File Formats Manual | HOSTAPD.CONF(5) |
hostapd.conf
—
configuration file for the Host Access Point
daemon
hostapd.conf
is the configuration file for
the hostapd(8) daemon.
The hostapd.conf
file is divided into the
following main sections:
The current line can be extended over multiple lines using a backslash (‘\’). Comments can be put anywhere in the file using a hash mark (‘#’), and extend to the end of the current line. Care should be taken when commenting out multi-line text: the comment is effective until the end of the entire block.
Argument names not beginning with a letter, digit, or underscore must be quoted.
Additional configuration files can be included with the
include
keyword, for example:
include "/etc/hostapd.conf.local"
Macros can be defined that will later be expanded in context.
Macro names must start with a letter, digit, or underscore, and may contain
any of those characters. Macro names may not be reserved words (for example,
set
, interface
, or
hostap
). Macros are not expanded inside quotes.
For example:
wlan="ath0" set iapp handle subtype { ! add notify, radiotap } set iapp interface $wlan
Tables are named structures which can hold a collection of link layer addresses, masked address ranges, and link layer to IP address assignments. Lookups against tables in hostapd(8) are relatively fast, making a single rule with tables much more efficient, in terms of processor usage and memory consumption, than a large number of rules which differ only in link layer addresses.
Tables are used for hostapd(8) event rules to match specified IEEE 802.11 link layer addresses and address ranges, and the capability to assign link layer to IP addresses and an option netmask is a requirement for advanced IAPP functionality.
Table options may be presented after the table name declaration. The following options are supported:
const
For example:
cisco="00:40:06:ff:ff:ff & ff:ff:ff:00:00:00" table <black> { $cisco, 00:0d:60:ff:f1:2a } table <myess> const { 00:00:24:c3:40:18 -> 10.195.64.24, 00:00:24:c3:40:19 -> 10.195.64.25, 00:00:24:c3:40:1a -> 10.195.64.26 } table <myclient> const { 00:05:4e:45:d4:b9 -> 172.23.5.1/30 }
The following configuration settings are understood:
set hostap
interface
interface |
{interface0, interface1,
...}set hostap
mode
modeset hostap
hopper interface
interface |
{interface0, interface1,
...}set hostap
hopper delay
numberset iapp
interface
interfaceset
iapp
[address
|
route
] roaming table
<table>set iapp
handle subtype
subtype |
{subtype0, subtype1,
...}not
] add notify
not
] radiotap
not
] [address
| route
] roaming
set iapp
mode
modemulticast
[address
ipv4addr]
[port
number]
[ttl
number]broadcast
[port
number]The default is multicast using the multicast address 224.0.1.178 and port 3517 with a TTL limited to 1 hop. Some access point vendors still use broadcast with the pre-standard IAPP port 2313.
Event rules provide a powerful way to trigger a certain action when receiving specified IEEE 802.11 frames on the hostap interface. The rules are handled in sequential order, from first to last. Rules are handled without a state: each rule is processed independently from the others and from any previous actions. This behaviour is somewhat different to that of packet filter rules specified in pf.conf(5).
All hostapd(8) event rules are
single line statements beginning with the mandatory hostap
handle
keywords and optional rule options, interface, frame matching,
a specified action, a limit, and a minimal rate:
hostap handle
[option] [interface]
[frame] [action]
[limit] [rate]Some rule statements support the optional keyword
not
, also represented by the
!
operator, for inverse matching.
The optional parts are defined below.
The rule option will modify the behaviour of
handling the statement. There are two possible options,
quick
and skip
. If either
the keyword quick
or the keyword
skip
is specified, no further event rules will be
handled for this frame after processing this rule successfully. The keyword
skip
additionally skips any further IAPP processing
of the frame, which is normally done after handling the event rules.
The rule interface specifies the hostap
interface the rule is matched on. The available interface list is specified
by the global set hostap interface
configuration
setting.
on
[not
] interfaceIf not given, the event rule is matched on all available hostap interfaces.
The frame description specifies a mechanism to match IEEE 802.11 frames.
any
frame
[type] [dir]
[from] [to]
[bssid] [radiotap]The type parameter specifies the frame type to match on. The frame type may be specified in the following ways:
type any
type
[not
] data
not
keyword
negates the match and will match all non-data frames.type
[not
] management
[[not
] subtype]not
keyword. See the
Management Frame
Subtypes section below for available subtypes specifications.The dir parameter specifies the direction the frame is being sent. The direction may be specified in the following ways:
dir any
dir
framedirThe radiotap rules allow parsing and
matching of the extra information reported by the radiotap header.
Support for the specified radiotap headers is optional and the specific
parameters depend on the radiotap elements reported by the wireless
interface. Support for the radiotap data link type can be verified with
the tcpdump(8) command. These rules
require hostap mode radiotap
in the global
configuration.
signal
[operator
] percentage
%
freq
[operator
] value
(GHz
|
MHz
)txrate
[operator
] rate
Mb
The radiotap rules support the following operators. If omitted, the specified value will be checked if it is equal or not.
= (equal) != (not equal) < (less than) <= (less than or equal) > (greater than) >= (greater than or equal)
The from, to, and bssid parameters specify the IEEE 802.11 address fields to match on. They can be specified in the following ways:
from
|
to
|
bssid
)
any
from
|
to
|
bssid
)
[not
] <table>from
|
to
|
bssid
)
[not
] lladdrAn optional action is triggered if a received IEEE 802.11 frame matches the frame description. The following actions are supported:
with
frame
type [dir]
from to bssidThe type describes the IEEE 802.11 frame type to send, specified in the frame control header. The following frames types are supported at present:
type data
type management
subtypeThe dir describes the direction the IEEE 802.11 frame will be sent. It has the following syntax:
dir
framedirSee the Frame Directions section below for available direction specifications.
The from, to, and
bssid arguments specify the link layer address
fields used in IEEE 802.11 frames. All address fields are mandatory in
the frame action. The optional fourth address field used by wireless
distribution systems (WDS) is currently not supported. Each argument is
specified by a keyword of the same name (from
,
to
, or bssid
) followed
by one of the following address specifications:
ff:ff:ff:ff:ff:ff
’ is the IEEE
802.11 broadcast address.&
refaddr&from
will use the source link
layer address; &to
the destination link
layer address; and &bssid
the BSSID link
layer address of the previously matched frame.random
with iapp
type
iapp-typeradiotap
.with
log
[verbose
]node
add
|
delete
lladdrresend
It is possible to limit handling of specific rules with the
limit
keyword:
limit
number sec
|
usec
In some cases it is absolutely necessary to use limited matching to protect hostapd(8) against excessive flooding with IEEE 802.11 frames. For example, beacon frames will be normally received every 100 ms.
It is possible to tell
hostapd(8) to trigger the action only
after a specific rate
of matched frames.
rate
number /
number sec
This will help to detect excessive flooding of IEEE 802.11 frames. For example, de-auth flooding is a denial of service (DoS) attack against IEEE 802.11 wireless networks.
The subtype describes the IEEE 802.11 frame
subtype, specified in the frame control header. The choice of subtypes
depends on the used frame type.
hostapd(8) currently only supports
management frame subtypes. Most frame subtypes require an additional
subtype-specific header in the frame body, but currently only the
deauth
and disassoc
reason
codes are supported:
subtype
beacon
subtype
deauth
[reason]subtype
disassoc
[reason]subtype
assoc request
subtype
assoc response
subtype
atim
subtype
auth
[open request
|
response
]subtype
probe request
subtype
probe response
subtype
reassoc request
subtype
reassoc response
The reason defines a descriptive reason for the actual deauthentication or disassociation of a station:
reason
assoc expire
reason
assoc leave
reason
assoc toomany
reason
auth expire
reason
auth leave
reason
ie invalid
reason
mic failure
reason
not authed
reason
assoc not authed
reason
not assoced
reason
rsn required
reason
rsn inconsistent
reason
unspecified
The direction a frame is being transmitted (framedir) can be specified in the following ways:
dir no ds
dir to ds
dir from ds
dir ds to ds
# Log probe requests locally hostap handle type management subtype probe request \ with log # Detect flooding of management frames except beacons. # This will detect some possible denial of service attacks # against the IEEE 802.11 protocol. hostap handle skip type management subtype ! beacon \ with log \ rate 100 / 10 sec # Log rogue access points via IAPP, limited to every second, # and skip further IAPP processing. hostap handle skip type management subtype beacon bssid !<myess> \ with iapp type radiotap limit 1 sec # Send deauthentication frames to stations associated to rogue APs hostap handle type data bssid !<myess> with frame type management \ subtype deauth reason auth expire \ from &bssid to &from bssid &bssid # Send authentication requests from random station addresses to # rogue access points. This is a common way to test the quality of # various hostap implementations. hostap handle skip type management subtype beacon bssid <pentest> \ with frame type management subtype auth \ from random to &bssid bssid &bssid # Re-inject a received IEEE 802.11 frame on the interface ath0 hostap handle on ath0 type management subtype auth with resend # Remove a blacklisted node from the kernel node tree hostap handle type management subtype auth from <blacklist> \ with node delete &from # Log rogue access points with a strong signal quality on # channel 3 (2.422GHz) transmitting frames with 1Mbps. hostap handle type management subtype beacon bssid !<myess> \ signal >= 50% txrate 1Mb freq 2.422GHz \ with log
In a traditional wireless network, multiple access points are members of a single layer 3 broadcast domain. The traffic is bridged between physical collision domains, as with the bridge(4) interface in OpenBSD. This may cause problems in large wireless networks with a heavy load of broadcast traffic, like broadcasted ARP, DHCP or ICMP requests.
hostapd(8) implements IP based roaming to build wireless networks without the requirement of a single broadcast domain. This works as follows:
hostapd.conf
is used to
assign IP subnets to link layer addresses. If a station with the specified
link layer address successfully associates to the access point,
hostapd(8) will configure the
specified IP address and subnet on the wireless interface.For example:
# Assign IP addresses to layer 2 addresses table <clients> { 00:02:6f:42:d0:01 -> 172.23.5.1/30, 00:05:4e:45:d3:b8 -> 172.23.5.4/30, 00:04:2e:12:03:e0 -> 172.23.5.8/30 } # Global options set hostap interface ath0 set hostap mode radiotap set iapp interface sis0 set iapp address roaming table <clients> set iapp handle subtype address roaming set iapp mode multicast ttl 2
The hostapd(8) program was written by Reyk Floeter <reyk@openbsd.org>.
IP Roaming requires statically assigned IP addresses of stations and does not support DHCP at present.
April 23, 2020 | OpenBSD-current |