用hostapd配置wifi,isc-dhcp-server

hostapd的配置如下:
(1)首先sudo apt-get install  hostapd
(2)然后在etc/hostapd路径下添加hostapd.conf文件
(3)内容如下:
interface=wlan0 
driver=nl80211
ssid=YOUR_SSID
channel=9
hw_mode=g
ignore_broadcast_ssid=0
auth_algs=1
wpa=3
YOUR_PASS_PHRASE
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
注意修改interface 对应的接口

sudo apt-get install isc-dhcp-server

然后就配置编辑文件/etc/default/isc-dhcp-server文件 其中修改interface=“wlan1”
/etc/dhcp/dhcpd.conf
然后
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.2.255;
option routers 192.168.2.254;
option domain-name-servers 192.168.2.1, 192.168.2.2;

subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.10 192.168.2.100;
range 192.168.2.150 192.168.2.200;
}
注释给出的例子
subnet 10.5.5.0 netmask 255.255.255.224 {
  range 10.5.5.26 10.5.5.30;
  option domain-name-servers ns1.internal.example.org;
  option domain-name "internal.example.org";
  option routers 10.5.5.1;
  option broadcast-address 10.5.5.31;
  default-lease-time 600;
  max-lease-time 7200;
}


启动是:
 sudo service isc-dhcp-server restart
 sudo service isc-dhcp-server start
 sudo service isc-dhcp-server stop 
hostapd启动是:

sudo hostapd /etc/hostapd/hostapd.conf

遇到问题以后

hostapd error “nl80211: Could not configure driver mode”

可以用下面的命令行:
sudo nmcli nm wifi off
sudo rfkill unblock wlan

sudo ifconfig wlan0 10.15.0.1/24 up
sleep 1
sudo service isc-dhcp-server restart
sudo service hostapd restart


Configuration

The error message the installation ends with might be a little confusing, but the following steps will help you configure the service:

Most commonly, what you want to do is assign an IP address randomly. This can be done with settings as follows:

nano -w /etc/dhcp/dhcpd.conf

# Sample /etc/dhcpd.conf
# (add your comments here) 
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example";

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
range 192.168.1.150 192.168.1.200;
} 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值