david reeves
Posts: 11
Joined: Thu Nov 26, 2015 10:58 pm

RPI3 Jessie Access Point/Hostapd Network Issues

Sat Jan 07, 2017 7:02 pm

RPI3 Jessie Access Point / hostapd Network Issue

I am having networking issues with Jessie-RPI3 as an Access Point. I had this all working fine under Wheezy-RPI2
and https://learn.adafruit.com/setting-up-a ... w?view=all to use the RPI as an Access Point. The complete
application is much more involved but this part WAS text book. I think I understand that pretty well.
I then migrated it all to Jessie-RPI3 and networking didn't work any more. More specifically, the RPI3
integrated wlan0 didn't broadcast the SSID. DNS also did not work correctly but the eth0 seemed fine. So, I found the following link and modified
the configuration to it https://frillip.com/using-your-raspberr ... h-hostapd/
however this didn't work any better. In the first example we used isc-dhcp while in the second example we use dhcpcpd5 SO I also removed isc-dhcp.
After the second example did not work, I researched and found lots of discussion suggesting to use dhcpcd exclusively instead of interfaces file so
that is the way it is now as listed below. I also saw lots of discussion around how the networking services are started and implemented the shell
script /etc/rc.local in order to be able to better see the log and control the start up. There seems to be quite a bit of confusion and discussion
regarding the networking changes between Wheezy and Jessie and that is what I've been focusing on but I've also looked into the integrated wifi
but I'm just not seeing it. Is there actually a source that explains the changes or differences in Wheezy to Jessie networking?
I'd really appreciate any suggestions or another pair of eyes on this. It appears that the driver=nl80211 line in the hostapd.conf is a problem
and others have said it is not required but it also throws an error when it is commented. Any thoughts and suggestions would be greatly appreciated.


sudo nano /etc/dhcpcd.conf
--------------------------

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# A hook script is provided to lookup the hostname if not set by the DHCP
#option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname

#denyinterfaces wlan0

interface eth0
static ip_address=192.168.137.3
static routers=192.168.137.1
static domain_name_servers= 8.8.8.8 4.2.2.1

interface wlan0
static ip_address=192.168.42.1/24
static routers=192.168.42.1
static domain_name_servers= 8.8.8.8 4.2.2.1




sudo service dhcpcd restart
---------------------------------
[....] Not running dhcpcd because there is aleady an interface specific instance[FAI failed!
[FAIL] /var/run/dhcpcd-eth0.pid ... failed!



sudo nano /etc/network/interfaces
---------------------------------

auto lo

iface lo inet loopback

allow-hotplug eth0

iface eth0 inet dhcp

allow-hotplug wlan0

iface wlan0 inet dhcp

#iface wlan0 inet static
# address 192.168.42.1
# netmask 255.255.255.0
# network 192.168.42.0
# broadcast 192.168.42.255
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#up iptables-restore</etc/iptables.ipv4.nat

#iface wlan1 inet manual

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp


sudo nano /etc/hostapd/hostapd.conf
-----------------------------------

# This is the name of the WiFi interface we configured above
interface=wlan0

# Use the nl80211 driver with the brcmfmac driver
#driver=nl80211

# This is the name of the network
ssid=SSIDNAME

# Use the 2.4GHz band
hw_mode=g

# Use channel 6
channel=6

# Enable 802.11n
ieee80211n=1

# Enable WMM
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=PASSWORD

# Use AES, instead of TKIP
rsn_pairwise=CCMP


sudo hostapd -d /etc/hostapd/hostapd.conf (with driver=nl80211)
-----------------------------------------

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
Line 5: invalid/unknown driver 'nl80211'
1 errors found in configuration file '/etc/hostapd/hostapd.conf'

sudo hostapd -d /etc/hostapd/hostapd.conf ( NO driver=nl80211)
-----------------------------------------

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=3
l2_sock_recv==l2_sock_xmit=0x0xcf2638
ioctl[SIOCSIWMODE]: Invalid argument
Could not set interface to mode(3)!
Could not set interface to master mode!
rtl871xdrv driver initialization failed.


sudo nano /etc/dnsmasq.conf
-----------------------------------------


interface=wlan0 # Use interface wlan0
listen-address= 192.168.42.1 # Explicitly specify the address to listen on
bind-interfaces # Bind to the interface to make sure we aren't sending thi$
server=8.8.8.8 # Forward DNS requests to Google DNS
domain-needed # Don't forward short names
bogus-priv # Never forward addresses in the non-routed address spaces$
dhcp-range=192.168.42.50,192.168.42.150,12h # Assign IP addresses between 172.2$

sudo dnsmasq -d
-----------------------------------------
dnsmasq: failed to create listening socket for 192.168.42.1: Cannot assign requested address



sudo nano /etc/rc.local
-----------------------------------------

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/etc/init.d/cron start

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi

#iptables-restore < /etc/iptables.ipv4.nat

# start the Repeater packages here so everything will start in order
printf "*****************************************Reloading iptables
"
iptables-restore < /etc/iptables.ipv4.nat
#iptables-restore < /etc/iptables/rules.v4
sleep 10
printf "*****************************************Starting hostapd
"
#service hostapd start
sudo hostapd -d /etc/hostapd/hostapd.conf
sleep 10
printf "*****************************************Starting the DHCP server
"
sudo service dhcpcd restart
sleep 10
printf "*****************************************Starting the DNSMASQ server
"
dnsmasq -d


exit 0


sudo /etc/rc.local
-----------------------------------------
[ ok ] Starting periodic command scheduler: cron.
My IP address is 192.168.137.3
*****************************************Reloading iptables
*****************************************Starting hostapd
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=3
l2_sock_recv==l2_sock_xmit=0x0x1bd4638
ioctl[SIOCSIWMODE]: Invalid argument
Could not set interface to mode(3)!
Could not set interface to master mode!
rtl871xdrv driver initialization failed.

Return to “Networking and servers”