BaReinhard's Tech Blog

A blog of various technologies, largely based around the Raspberry Pi.

Follow me on GitHub Follow me on Instagram

Setup Car Wifi w/ Raspberry Pi Zero, 1, and 2 AP (No Internet, iOS only)

Happy Thursday Everyone, here we are back again talking about the Raspberry Pi Zero,1,2. Today I will be walking you through setting up an AP with the Raspberry Pi Zero,1,2. Please note the following only works with the Raspberry Pi Zero, 1, and 2.

What will we need?

  • Raspberry Pi Zero,1,2 with tp link usb dongle
  • microSD
  • keyboard, monitor for inital setup atleast to connect to wifi, or use ethernet and ssh in

What are we planning to do?

We are planning to setup the Raspberry Pi as an Access point without any internet connection. It will be a wifi network with no internet access.

What the hell!? Why would we want that?

Simply put, so that we can stream audio from our iOS device to our Raspberry Pi in reliable manner with better quality than A2DP Bluetooth. Even though we are “connected” to the network, it will not show at the top left of our device as it normally does. However, the Raspberry Pi still gives your iOS device an IP address and you are able to stream music via AirPlay.

The Computer Stuff

First setup your interfaces file:

sudo nano /etc/network/interfaces

Within the file setup a static ip and comment out the existing iface lines

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0

iface wlan0 inet static
    address 10.0.0.1
    netmask 255.255.255.0
sudo apt-get update
sudo apt-get autoremove hostapd
sudo wget https://github.com/jenssegers/RTL8188-hostapd/archive/v2.0.tar.gz
sudo tar -zxvf v2.0.tar.gz
cd RTL8188-hostapd-2.0/hostapd
sudo make
sudo make install
sudo nano ~/hostapd-test.conf

add the following lines:

#change wlan0 to your wireless device
interface=wlan0
driver=rtl871xdrv
ssid=test
channel=1

Then test to ensure hostapd works:

sudo hostapd ~/hostapd-test.conf

Now that everything is working create the actual hostapd conf file:

sudo nano /etc/hostapd/hostapd.conf
interface=wlan0
driver=rtl871xdrv
ssid=BaReinhards_G8_Wifi
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=4doorgto
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Then change default for hostapd and add the daemon config file path after DAEMON_CONF=””

sudo nano /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"

sudo nano /etc/init.d/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"

Now we need to setup the dhcp server

sudo apt-get install isc-dhcp-server
sudo nano /etc/dhcp/dhcpd.conf

Add the following lines into your file:

ddns-update-style none;
ignore client-updates;
authoritative;
option local-wpad code 252 = text;
 
subnet
10.0.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers
10.0.0.1;
# --- Netmask
option subnet-mask
255.255.255.0;
# --- Broadcast Address
option broadcast-address
10.0.0.255;
# --- Domain name servers, tells the clients which DNS servers to use.
option domain-name-servers
10.0.0.1, 8.8.8.8, 8.8.4.4;
option time-offset
0;
range 10.0.0.3 10.0.0.13;
default-lease-time 1209600;
max-lease-time 1814400;
}

Then

sudo nano /etc/defaul/isc-dhcp-server

INTERFACES="wlan0"

Then of course install shairport-sync and enable it through systemctl Setup Sound Cards