3

After researching many websites I developed an Access Point for use by students in an environment that has no internet access. It turned out to be something like "Internet In A Box" but with a specialized website and Samba sharing.

With the latest Raspbian, December 2018, with hostapd installed, I tested and it works in that the SSID shows on the mobile device. It can not connect since there is nothing to provide an IP number.

After I set up dnsmasq I get the same results when I try to connect.

My hostapd.conf

# This is the name of the WiFi interface
interface=wlan0
# Use the nl80211 driver with the brcmfmac driver
# driver=nl80211
# This is the name of the network
ssid=XXXXXXX
# Use the 2.4GHz band
hw_mode=g
# Use channel 6
channel=6
# Enable 802.11n
ieee80211n=1
# Enable WMM
wmm_enabled=1
# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
# Accept all MAC addresses
macaddr_acl=0
# Use WPA authentication
auth_algs=1
# Require clients to know the network name
ignore_broadcast_ssid=0
# Use WPA2
wpa=2
# Use a pre-shared key
wpa_key_mgmt=WPA-PSK
# The network passphrase
wpa_passphrase=XXXXXXXXX
# Use AES, instead of TKIP
rsn_pairwise=CCMP

dnsmasq.conf

Add this:
#don't use resolv.conf
no-resolv
#don't recheck resolv.conf for changes
no-poll

# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
# no-hosts
# or if you want it to read another file, as well as /etc/hosts, use
# this.
#addn-hosts=/etc/banner_add_hosts

# Interface that serves ip-addresses
# Use the require wireless interface - usually wlan0
interface=wlan0     
# Explicitly specify the address to listen on
listen-address=10.10.0.1
# Forward DNS requests to Google DNS
server=8.8.8.8
# Don't forward short names
domain-needed
# Never forward addresses in the non-routed address spaces. 
bogus-priv

dhcp-range=10.10.0.50,10.10.0.150,255.255.255.0,24h

dhcp-leasefile=/tmp/lease.file

This worked great when I set it up about a year ago with an older version of Raspbian. I have tried it both with and without the driver= line. Any help would be appreciated.

1

The latest update to Raspbian (2019-03-09) has changed hostapd "wpa (2:2.6-10)". You should run sudo systemctl unmask hostapd and sudo systemctl enable hostapd to ensure it runs on boot.

There have been a number of other changes - just depends how far back in time you want to go.

The Foundation tutorial Setting up a Raspberry Pi as an access point in a standalone network (NAT) and my own Raspberry Pi as an Access Point OR WiFi client describe the steps to setup an Access Point, although there are many more.

You have not mentioned in your question, but you seem to no step to define the static IP address. This is now done in /etc/dhcpcd.conf , although it is possible to set in interfaces. It may be possible to set in /etc/default/hostapd (I have never tried this), but if you want to do this you would need to disable dhcpcd.

Your /etc/hostapd/hostapd.conf file does not specify a driver, and you specify ieee80211n=1 which is pointless with the Pi, as neither the on-board WiFi nor dongles support multiple antennas.

You need to specify a wireless regulatory domain which can be set through raspi-config or by setting country= to an appropriate ISO 3166 alpha2 country code in /etc/wpa_supplicant/wpa_supplicant.conf - it can even be set in /etc/hostapd/hostapd.conf.

  • Thank you Milliways, that is a lot of good info. I have looked at a lot of tutorials over the last two years and that is how I arrived at my working server. Of course it is running an old version of Raspbian and works with the settings I have described. – Lee Partridge Apr 7 at 17:35
  • Now that I have your answer I will do some more research into the tutorials you mentioned and the items such as dhcpcd you pointed out. Thanks again for your quick response and info. – Lee Partridge Apr 7 at 17:41
1

Thanks again Milliways. Sorry for not getting back sooner but I had a major operation and am just getting back to it. I did some more research and even played with raspAP, studying the files that it produced.

Thanks to Milliways I unmask hostapd with systemctl unmask hostapd and enabled hostapd with systemctl enable hostapd and grabbed the latest version of Raspbian.

Well it works and here are the files I came up with:

/etc/hostap/hostap.conf
# This is the name of the WiFi interface
interface=wlan0
# Use the nl80211 driver with the brcmfmac driver
driver=nl80211
country_code=US
# This is the name of the network
ssid={network}
# Use the 2.4GHz band
hw_mode=g
# Use channel 6
channel=6
# Enable 802.11n
# ieee80211n=1
# Enable WMM
wmm_enabled=1
# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
# Accept all MAC addresses
macaddr_acl=0
# Use WPA authentication
auth_algs=1
# Require clients to know the network name
ignore_broadcast_ssid=0
# Use WPA2
wpa=2
# Use a pre-shared key
wpa_key_mgmt=WPA-PSK
# The network passphrase
wpa_passphrase={passphrase}
# Use AES, instead of TKIP
rsn_pairwise=CCMP

/etc/dnsmasq.conf
# If you don't want dnsmasq to read /etc/hosts, uncomment the following line.
no-hosts
# or if you want it to read another file, as well as /etc/hosts, use this.
#addn-hosts=/etc/banner_add_hosts

# Interface that serves ip-addresses
# Use the require wireless interface - usually wlan0
interface=wlan0     

# Explicitly specify the address to listen on
listen-address=10.10.0.1

# Forward DNS requests to Google DNS
server=8.8.8.8
# Don't forward short names
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv

dhcp-range=10.10.0.50,10.10.0.150,255.255.255.0,24h

dhcp-leasefile=/tmp/lease.file

/etc/default/hostapd
changed
# DAEMON_CONF=""
to
DAEMON_CONF="/etc/hostapd/hostapd.conf"
and
#DAEMON_OPTS=""
to
DAEMON_OPTS="-dK"

/etc/dhcpcd.conf
interface wlan0
static ip_address=10.10.0.1/24
static routers=10.10.0.0
static domain_name_servers=10.10.0.0

Thanks to all who have posted instructions that have helped me get this serving again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.