35.4. 在有线网络中将 hostapd 配置为认证方


主机访问点守护进程(hostapd)服务可在有线网络中充当验证器,来提供 802.1X 身份验证。为此,hostapd 服务需要一个用来验证客户端的 RADIUS 服务器。

hostapd 服务提供集成的 RADIUS 服务器。但是,使用集成的 RADIUS 服务器只用于测试目的。对于生产环境,请使用 FreeRADIUS 服务器,它支持其他特性,如不同的身份验证方法和访问控制。

重要

hostapd 服务不与流量平面交互。该服务仅充当身份验证器。例如,使用脚本或服务,该脚本或服务使用 hostapd 控制接口、根据身份验证事件的结果来允许或拒绝流量。

先决条件

  • hostapd 软件包已安装。
  • FreeRADIUS 服务器已配置,它已准备好对客户端进行身份验证。

流程

  1. 使用以下内容创建 /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 示例配置文件中的描述。

  2. 启用并启动 hostapd 服务:

    # systemctl enable --now hostapd

故障排除

  • 如果 hostapd 服务无法启动,请验证您在 /etc/hostapd/hostapd.conf 文件中使用的网桥接口是否在系统上存在:

    # ip link show br0
  • 对于其他问题,请在 debug 模式下运行 hostapd:

    1. 停止 hostapd 服务:

      # systemctl stop hostapd
    2. 以 debug 模式启动该服务:

      # hostapd -d /etc/hostapd/hostapd.conf
    3. 在 FreeRADIUS 主机上执行验证测试,如 验证 部分中所述。

其他资源

  • 您系统上的 hostapd.conf (5) 手册页
  • /usr/share/doc/hostapd/hostapd.conf 文件
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.