> /etc/default/hostapd 4、修改配置文件 vi /etc/hostapd/hostapd.conf 此配置来源于:PVE系列教程中,PVE(Debian)开热点。绑定Linux下的无线网卡wlp2s0,进行分享热点AP。管理vmbr1网桥上机器的用途。 具体配置如下(按照您的要求修改部分内容): interface=wlp2s0 bridge=vmbr1 # SSID to be used in IEEE 802.11 management frames ssid=YourWiFiName # Driver interface type (hostap/wired/none/nl80211/bsd) driver=nl80211 # Country code (ISO/IEC 3166-1) country_code=CN # Operation mode (a = IEEE 802.11a (5 GHz), b = IEEE 802.11b (2.4 GHz) hw_mode=g # Channel number channel=1 # Maximum number of stations allowed max_num_sta=10 # Bit field: bit0 = WPA, bit1 = WPA2 wpa=2 # Bit field: 1=wpa, 2=wep, 3=both auth_algs=1 # Set of accepted cipher suites; disabling insecure TKIP wpa_pairwise=CCMP # Set of accepted key management algorithms wpa_key_mgmt=WPA-PSK wpa_passphrase=YourWiFiPassWord # hostapd event logger configuration logger_stdout=-1 logger_stdout_level=2 # Uncomment and modify the following section if your device supports 802.11n">
CXT - Enjoy Life | 生活、技术、交友、分享 CXT - Enjoy Life | 生活、技术、交友、分享
  • 首页
  • 特色专题
    • 一键网络重装系统 - 魔改版(适用于Linux / Windows)
    • 精英IDC计划 - 千万IDC计划(从入门到跑路)
    • CXT裸机系统部署平台(自定义安装任意系统)
    • OpenWRT-Virtualization-Servers
  • 分类目录
    • 站点公告
    • 技术分享
    • 生活感悟
  • 更多(More)
    • 浏览记录(Historical-Record)
    • 支付捐赠(Payment-Donation)
    • 隐私政策(Privacy-Policy)
    • 服务状态(Server-Status)
    • 友情链接(Link)
    • 联系我们(Contact-US)
    • 关于我们(About-Me)
Home › 技术分享 › Linux系统使用hostapd创建无线AP热点,热点配置文件分享,踩坑错误解决
  • 0

Linux系统使用hostapd创建无线AP热点,热点配置文件分享,踩坑错误解决

CXT
November 3, 2020

简介

Linux开热点,常用hostapd工具配置。这里简要介绍安装和配置方法。

PVE软路由AP组网也可能用到,就出一个系列文章了。

主要是分享一下hostapd热点的配置文件,和踩坑预警。

Linux系统使用hostapd创建无线AP热点,热点配置文件分享,踩坑错误解决-CXT - Enjoy Life | 生活、技术、交友、分享
Linux Hostapd AP热点

安装

1、检查Linux下硬件和驱动是否支持

通常都支持,至少支持2.4Ghz 1-13信道,详细看下面文章。

文章《待更新》

2、安装

Debian系、Ubuntu系(包括Proxmox-VE等)

apt install hostapd -y

CentOS系、RHEL系

yum install hostapd -y

3、重定向默认配置文件路径

echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"' >> /etc/default/hostapd

4、修改配置文件

vi /etc/hostapd/hostapd.conf

此配置来源于:PVE系列教程中,PVE(Debian)开热点。绑定Linux下的无线网卡wlp2s0,进行分享热点AP。管理vmbr1网桥上机器的用途。

具体配置如下(按照您的要求修改部分内容):

interface=wlp2s0
bridge=vmbr1

# SSID to be used in IEEE 802.11 management frames
ssid=YourWiFiName
# Driver interface type (hostap/wired/none/nl80211/bsd)
driver=nl80211
# Country code (ISO/IEC 3166-1)
country_code=CN

# Operation mode (a = IEEE 802.11a (5 GHz), b = IEEE 802.11b (2.4 GHz)
hw_mode=g
# Channel number
channel=1
# Maximum number of stations allowed
max_num_sta=10

# Bit field: bit0 = WPA, bit1 = WPA2
wpa=2
# Bit field: 1=wpa, 2=wep, 3=both
auth_algs=1

# Set of accepted cipher suites; disabling insecure TKIP
wpa_pairwise=CCMP
# Set of accepted key management algorithms
wpa_key_mgmt=WPA-PSK
wpa_passphrase=YourWiFiPassWord

# hostapd event logger configuration
logger_stdout=-1
logger_stdout_level=2

# Uncomment and modify the following section if your device supports 802.11n
## Enable 802.11n support
ieee80211n=1
## QoS support
wmm_enabled=1
## Use "iw list" to show device capabilities and modify ht_capab accordingly
ht_capab=[HT40+][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40]

5、重启hostapd热点服务

/etc/init.d/hostapd restart

此时,您就可以搜到Linux主机下,您的无线网卡开出的WIFI了。

或重启计算机reboot也行

错误预警和解决方案

您可能会遇到以下问题,可通过此方案解决。

1、hostapd异常unmask报错

sudo systemctl unmask hostapd 
sudo systemctl enable hostapd 
sudo systemctl start hostapd

systemctl unmask hostapd即可,然后重启hostapd服务。

2、热点设置为b模式,不能启用n模式的设置。

需要改为g模式,然后重启hostapd服务即可解决此类报错。

hostapd官方文档写着:# Operation mode (a = IEEE 802.11a (5 GHz), b = IEEE 802.11b (2.4 GHz)

因此,我的Intel网卡在Linux下驱动不支持开5GhzWiFi,因此就按照文档配置为b模式,这时n模式的设置ht_capab选项导致hopstapd热点服务启动失败,改成g模式一切正常。这是官方文档没有写的坑之一。

恭喜您完成了Linux下无线AP热点配置

赶快使用您的手机等设备,输入您设置的SSID和密码,连接到您的WIFI热点吧!

交流讨论(频道、组群、论坛)

了解【联系我们(Contact-US)https://www.cxthhhhh.com/contact-us】页面获得更多信息

写在最后

享受当下的美好!

如果本文对您有帮助,请通过以下【赞赏】按钮捐赠,这将帮助我们更好的创作和发展。

AP热点 CentOS Debian Hostapd Linux PVE 无线AP
0
The article is originally written by @CXT posted on CXT - Enjoy Life | 生活、技术、交友、分享. All rights reserved.
【网络拓扑系列-2】PVE网卡设置 vmbr0 vmbr1 单网口服务器主机 文件备份 模板1
Previous
CentOS (RHEL) 7/8 安装配置 SSH Server 实现root远程ssh访问 (OpenSSH-Server)
Next

文章目录

Recent Posts

  • 我的减重之路:揭秘饮食、运动、休息与能量管理的协同作用
  • PVE7升级PVE8教程(全过程带图片)
  • RHEL系列 8/9重置root密码方式(root密码忘记)
  • 深渊回响,心之抉择:从《璃火》月寒的爱恨棋局,映照你我成长的光与影
  • 迷失在坐标之间:地图、智驾、卫星与数字时代的位置安全和战略博弈

Related posts

Linux 9安装Docker(适用于RHEL9/Rocky9/Alma9/Oracle9/CentOS9)

Linux 9安装Docker(适用于RHEL9/Rocky9/Alma9/Oracle9/CentOS9)

December 30, 2024
1,577 2
【系统镜像】Debian 10 LXC/OVZ 最新模板 v1.3(开启SSH、时区、优化)

【系统镜像】Debian 10 LXC/OVZ 最新模板 v1.3(开启SSH、时区、优化)

November 7, 2020
639,885 1
This different contains a change in line endings from' lf' to' crlf'.

This different contains a change in line endings from' lf' to' crlf'.

March 9, 2025
633 0
Debian系列(包含Ubuntu系列) 10/9/20.04/18.04  安装配置 SSH Server 实现root远程ssh访问 (OpenSSH-Server)

Debian系列(包含Ubuntu系列) 10/9/20.04/18.04 安装配置 SSH Server 实现root远程ssh访问 (OpenSSH-Server)

November 5, 2020
96,092 0

简介 CXT - Enjoy Life

CXT - Enjoy Life | 生活、技术、交友、分享 - 自天佑之,吉无不利

网站导航

首页 特色专题 一键网络重装系统 - 魔改版(适用于Linux / Windows) 精英IDC计划 - 千万IDC计划(从入门到跑路) CXT裸机系统部署平台(自定义安装任意系统) OpenWRT-Virtualization-Servers 分类目录 站点公告 技术分享 生活感悟 更多(More) 浏览记录(Historical-Record) 支付捐赠(Payment-Donation) 隐私政策(Privacy-Policy) 服务状态(Server-Status) 友情链接(Link) 联系我们(Contact-US) 关于我们(About-Me)

友情链接

CXT | 自天佑之 吉无不利 润隍科技
Copyright © 2025 CXT - Enjoy Life | 生活、技术、交友、分享. Designed by nicetheme.
  • 首页
  • 特色专题
    • 一键网络重装系统 - 魔改版(适用于Linux / Windows)
    • 精英IDC计划 - 千万IDC计划(从入门到跑路)
    • CXT裸机系统部署平台(自定义安装任意系统)
    • OpenWRT-Virtualization-Servers
  • 分类目录
    • 站点公告
    • 技术分享
    • 生活感悟
  • 更多(More)
    • 浏览记录(Historical-Record)
    • 支付捐赠(Payment-Donation)
    • 隐私政策(Privacy-Policy)
    • 服务状态(Server-Status)
    • 友情链接(Link)
    • 联系我们(Contact-US)
    • 关于我们(About-Me)
  • Linux
  • PVE
  • Proxmox
  • Proxmox-VE
  • Server
  • Windows
  • 系统镜像
  • ISO
  • DD
  • CentOS

CXT

Administrator
62
Posts
0
Comments
76
Likes