34.4. 在有线网络中将 hostapd 配置为验证器
主机访问点守护进程(hostapd)服务可在有线网络中充当验证器,来提供 802.1X 身份验证。为此,hostapd 服务需要一个用来验证客户端的 RADIUS 服务器。
hostapd 服务提供集成的 RADIUS 服务器。但是,使用集成的 RADIUS 服务器只用于测试目的。对于生产环境,请使用 FreeRADIUS 服务器,它支持其他特性,如不同的身份验证方法和访问控制。
hostapd 服务不与流量平面交互。该服务仅充当身份验证器。例如,使用脚本或服务,该脚本或服务使用 hostapd 控制接口、根据身份验证事件的结果来允许或拒绝流量。
先决条件
-
hostapd软件包已安装。 - FreeRADIUS 服务器已配置,它已准备好对客户端进行身份验证。
流程
使用以下内容创建
/etc/hostapd/hostapd.conf文件:# General settings of hostapd # =========================== # Control interface settings ctrl_interface=/var/run/hostapd ctrl_interface_group=wheel # Enable logging for all modules logger_syslog=-1 logger_stdout=-1 # Log level logger_syslog_level=2 logger_stdout_level=2 # Wired 802.1X authentication # =========================== # Driver interface type driver=wired # Enable IEEE 802.1X authorization ieee8021x=1 # Use port access entry (PAE) group address # (01:80:c2:00:00:03) when sending EAPOL frames use_pae_group_addr=1 # Network interface for authentication requests interface=br0 # RADIUS client configuration # =========================== # Local IP address used as NAS-IP-Address own_ip_addr=192.0.2.2 # Unique NAS-Identifier within scope of RADIUS server nas_identifier=hostapd.example.org # RADIUS authentication server auth_server_addr=192.0.2.1 auth_server_port=1812 auth_server_shared_secret=hostapd_client_password # RADIUS accounting server acct_server_addr=192.0.2.1 acct_server_port=1813 acct_server_shared_secret=hostapd_client_password有关此配置中使用的参数的详情,请查看
/usr/share/doc/hostapd/hostapd/hostapd.conf示例配置文件中的描述。启用并启动
hostapd服务:# systemctl enable --now hostapd
故障排除
如果
hostapd服务无法启动,请验证您在/etc/hostapd/hostapd.conf文件中使用的网桥接口是否在系统上存在:# ip link show br0对于其他问题,请在 debug 模式下运行
hostapd:停止
hostapd服务:# systemctl stop hostapd以 debug 模式启动该服务:
# hostapd -d /etc/hostapd/hostapd.conf-
在 FreeRADIUS 主机上执行验证测试,如
验证部分中所述。