This is an old revision of the document!
Table of Contents
The pi as its own access point
Overview
Configuring the pi this way has the benefit of never having to seek out its ip address. Just connect to the pi's network and you have access to the machine. That is the major PRO of this set up, but there are some cons:
- Connecting the PI loses your own internet access unless you bridge the pi to the local network
- FRC robots are not allowed to have hot spots on them
- Multiple PIs in the house will conflict unless you have a system for unique networks
We are going to solve these cons later but lets just get the pi up and running as an access point.
Install Necessary Services
sudo apt-get install dnsmasq sudo apt-get install hostapd
Make sure the new services are not running
sudo systemctl stop dnsmasq sudo systemctl stop hostapd
Configure Static IP with a 24 network
Now we pick a network that the PI will host. I am choosing 192.168.3.x as our network. That way someone may get the address 192.168.3.14 which has the value of pi in it.
Now put the following at the end /etc/dhcpcd.conf
interface wlan0 static ip_address=192.168.3.1/24
Restart dhcpcd
sudo service dhcpcd restart
Configure DHCP
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo emacs /etc/dnsmasq.conf
and add the following
interface=wlan0 # Use the require wireless interface - usually wlan0 dhcp-range=192.168.3.2,192.168.3.50,255.255.255.0,24h
Configure Wireless Access Point
Edit
sudo emacs /etc/hostapd/hostapd.conf
and put
interface=wlan0 driver=nl80211 ssid=raspberry hw_mode=g channel=7 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=robotfun wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Now edit
sudo emacs /etc/default/hostapd
and set DAEMON_CONF=“/etc/hostapd/hostapd.conf”
Start up the Services
sudo systemctl start hostapd sudo systemctl start dnsmasq
Adjust Routing
First uncomment net.ipv4.ip_forward=1 in /etc/sysctl.conf
Doing the below, but I dont like it. Need a solution that does not use rc.local
Add a masquerade and save it
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
add to rc.local
iptables-restore < /etc/iptables.ipv4.nat