Hostapd hotspot settings

Source: Internet
Author: User

1. Services to be installed: hostapd

DHCP (ISC-DHCP-server)

DNS (neither dnsmasq nor bind9 is installed)

2. Create the hostapd. conf file, sudo Vim/etc/hostapd. conf (random location)

Interface = wlan0

Driver = nl80211

SSID = xxxxxx

Hw_mode = G

Channel = 10

Macaddr_acl = 0

Auth_algs = 3

WPA = 2 # Remove the following three lines and there will be no password

Wpa_passphrase = xxxxxx # XXXX is the password

Wpa_key_mgmt = WPA-PSK

 

3. Configure DHCP

subnet  192.168.0.0  netmask   255.255.255.0
{
range   192.168.0.2    192.168.0.10;             #设置范围  可以更大192.168.0.0-192.168.10.0
option   routers   192.168.0.1;
option   domain-name-servers   192.168.0.1#(如果设置成8.8.8.8等 就不需要配置dns服务器(dnsmasq、bind9)  用wlan0 ip需要配置dns服务器); 
}

四、设置开机启动脚本内容 ap.sh
sudo   ifconfig    wlan0   172.16.0.1       netmask     255.255.252.0    #   wlan0ip   也可以手动设置static   

sudo service bind9 restart #安装bind9时 wlan0需要设置在bin9启动前 所以这里重启一下bin9,如果是安装dmsmasq就不需要这一步 或者
sudo   dhcpd      wlan0     -pf        /var/run/dhcp-server/dhcpd.pid  #开启dhcp
sudo bash -c "echo 1 >/proc/sys/net/ipv4/ip_forward"                     #打开IP转发  同样可以设置永久为1
sudo   iptables    -t      nat    -A    POSTROUTING     -o   eth0     -j   MASQUERADE         #设置NAT

Sudo hostapd-B/etc/hostapd. conf # open a hotspot

 

5. Set AP. Sh to start

Reference

 



 

Hostapd hotspot settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.