本文主要是介绍fedora下搭建hostapd+dhcpd建立Wifi热点,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、安装hostapd,源码编译或者直接命令安装
下载源码包
进入hostapd目录下
$ cp defconfig .config
$ make && make install
注意:
需先安装libnl1.1.4和openssl,并在.config中指明路径
# libnl
NL_INC_PATH=/usr/local/include/
NL_LIB_PATH=/usr/local/lib
CFLAGS += -I$(NL_INC_PATH)
LIBS += -L$(NL_LIB_PATH)
LIBS_p += -L$(NL_LIB_PATH)
# openssl
SSL_INC_PATH=/usr/include/openssl
SSL_LIB_PATH=/usr/lib
CFLAGS += -I$(SSL_INC_PATH)
LIBS += -L$(SSL_LIB_PATH)
LIBS_p += -L$(SSL_LIB_PATH)
或者简单处理,
命令安装
$ sudo dnf install hostapd
$ sudo dnf install dhcp dhcp-devel
3、编辑配置文件
#编辑 /etc/hostapd/hostapd.conf
#设置如下
interface=wlo1
hw_mode=g
channel=1
ssid=qiaojx_hostapd
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_passphrase=12345678
#编辑 /etc/dhcp/dhcpd.conf
#设置如下
subnet 10.5.5.0 netmask 255.255.255.224 {range 10.5.5.26 10.5.5.30;option domain-name-servers qiaojx.cs.pax.org;option routers 10.5.5.1;option broadcast-address 10.5.5.31;default-lease-time 600;max-lease-time 7200;
}
4、启动
$ nmcli radio wifi off
$ rfkill unblock wlan
$ sudo ifconfig wlo1 10.5.5.1/24 up
$ sudo dhcpd
$ sudo hostapd /etc/hostapd/hostapd.conf
这篇关于fedora下搭建hostapd+dhcpd建立Wifi热点的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!