From charlesreid1

Line 104: Line 104:
sudo systemctl status dnsmasq
sudo systemctl status dnsmasq
</pre>
</pre>
==Troubleshooting==
If something fails it will probably be on the start step:
<pre>
$ sudo systemctl start hostapd
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
</pre>
===Link is not ready/Driver initialization failed===
Here is the problem I encountered at first:
https://askubuntu.com/questions/472794/hostapd-error-nl80211-could-not-configure-driver-mode/743127#743127
<!--
<pre>
-- Logs begin at Thu 2019-02-14 10:12:02 UTC, end at Sun 2019-11-24 09:30:31 UTC. --
Nov 24 09:27:18 CHROMECAST-TV-2 hostapd[1225]: nl80211: deinit ifname=wlan1 disabled_11b_rates=0
Nov 24 09:27:18 CHROMECAST-TV-2 NetworkManager[154]: <info>  [1574587638.4191] device (wlan1): supplicant interface state: inactive -> disabled
Nov 24 09:27:18 CHROMECAST-TV-2 kernel: IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
Nov 24 09:27:18 CHROMECAST-TV-2 NetworkManager[154]: <info>  [1574587638.8258] device (wlan1): supplicant interface state: disabled -> inactive
Nov 24 09:27:18 CHROMECAST-TV-2 hostapd[1225]: nl80211 driver initialization failed.
Nov 24 09:27:18 CHROMECAST-TV-2 hostapd[1225]: wlan1: interface state UNINITIALIZED->DISABLED
Nov 24 09:27:18 CHROMECAST-TV-2 hostapd[1225]: wlan1: AP-DISABLED
Nov 24 09:27:18 CHROMECAST-TV-2 hostapd[1225]: wlan1: CTRL-EVENT-TERMINATING
Nov 24 09:27:18 CHROMECAST-TV-2 hostapd[1225]: hostapd_free_hapd_data: Interface wlan1 wasn't started
Nov 24 09:27:18 CHROMECAST-TV-2 systemd[1]: hostapd.service: Control process exited, code=exited, status=1/FAILURE
</pre>
-->
<pre>
#!/bin/sh
IFACE="wlan1"
echo "Starting hostapd with interface $INAME"
/bin/sleep 5
echo "Go time"
/usr/sbin/service hostapd stop
/usr/sbin/ifconfig $IFACE down
/usr/sbin/rfkill unblock wlan
echo "Stopping/starting hostapd service"
/usr/sbin/service hostapd stop
/bin/sleep 2
/usr/sbin/service hostapd start

Revision as of 09:41, 24 November 2019

Making a Raspberry Pi a hotspot

See https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

Installing Stuff

sudo apt install dnsmasq hostapd dhcpcd5

Edit dhcpcd config file

Edit /etc/dhcpcd.conf and modify it to contain this:

interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant

replace wlan0 with whatever interface you want to use.

Restart dhcpcd service

sudo service dhcpcd restart

Edit dnsmmasq config file

Edit the dnsmasq config file /etc/dnsmasq.conf, which determines what range of ip addresses will be handed out and for how long. Modify it to contain this:

interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h

This will hand out IPs starting at 192.168.4.2 and ending at 192.168.4.20, lasting for 24 hours lease time.

Modify wlan0 to whatever interface you are using to provide the wifi network.

Restart dnsmasq service

If you are installing dnsmasq fresh, enable then start the service:

sudo systemctl enable dnsmasq
sudo systemctl start dnsmasq

or reload/restart the service:

sudo systemctl reload dnsmasq

Edit hostapd config file

Now modify the file /etc/hostapd/hostapd.conf to configure hostapd. Modify the contents to the following:

interface=wlan0
driver=nl80211
ssid=MyLittlePony
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=AardvarkBadgerHedgehog
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Note values for hw_mode are:

  • a = IEEE 802.11a (5 GHz)
  • b = IEEE 802.11b (2.4 GHz)
  • g = IEEE 802.11g (2.4 GHz)

Specify location of hostapd file

Modify the file /etc/default/hostapd to read:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Restart hostapd

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

Check status and ensure running ok:

sudo systemctl status hostapd
sudo systemctl status dnsmasq

Troubleshooting

If something fails it will probably be on the start step:

$ sudo systemctl start hostapd
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.

Link is not ready/Driver initialization failed

Here is the problem I encountered at first:

https://askubuntu.com/questions/472794/hostapd-error-nl80211-could-not-configure-driver-mode/743127#743127


#!/bin/sh

IFACE="wlan1"
echo "Starting hostapd with interface $INAME"
/bin/sleep 5
echo "Go time"
/usr/sbin/service hostapd stop
/usr/sbin/ifconfig $IFACE down
/usr/sbin/rfkill unblock wlan
echo "Stopping/starting hostapd service"
/usr/sbin/service hostapd stop
/bin/sleep 2
/usr/sbin/service hostapd start