It could be useful to have the dash buttons working with the raspberry pi in a place where there is no wifi or internet coverage. The raspberry pi can be setup as a wifi hotspot and the dash buttons configured to join this network. Taking things a bit further, the raspberry pi could be set up to route requests received via the wifi subnet through the cabled network, to the internet router/home network and to the internet.
Yesterday I managed to do this successfully, following this tutorial. Fun times 🙂
The important files for this are:
/etc/network/interfaces
/etc/dhcpcd.conf
/etc/hostapd/hostapd.conf
/etc/default/hostapd
/etc/dnsmasq.conf
recipe of steps I followed
- sudo apt-get update
- sudo apt-get install hostapd isc-dhcp-server
- sudo apt-get install iptables-persistent
- sudo vi /etc/dhcp/dhcpd.conf
- comment the lines
- #option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;
- #option domain-name “example.org”;
- uncomment the line
- authoritative;
- Add the following lines at the end
- subnet 192.168.43.0 netmask 255.255.255.0 {
range 192.168.43.10 192.168.43.50;
option broadcast-address 192.168.43.255;
option routers 192.168.43.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name “local”;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
- subnet 192.168.43.0 netmask 255.255.255.0 {
- comment the lines
- sudo vi /etc/default/isc-dhcp-server
- add wlan0 to the INTERFACES variable
- INTERFACES=”wlan0″
- add wlan0 to the INTERFACES variable
- sudo ifdown wlan0
- sudo vi /etc/network/interfaces
- allow-hotplug wlan0
iface wlan0 inet static
address 192.168.43.1
netmask 255.255.255.0
- allow-hotplug wlan0
- sudo ifconfig wlan0 192.168.43.1
- sudo vi /etc/hostapd/hostapd.conf
- interface=wlan0
driver=nl80211
ssid=jarvis
country_code=US
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=Raspberry
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_group_rekey=86400
ieee80211n=1
wme_enabled=1
- interface=wlan0
- sudo vi /etc/default/hostapd
- DAEMON_CONF=”/etc/hostapd/hostapd.conf”
- sudo vi /etc/sysctl.conf
- net.ipv4.ip_forward=1
- sudo sh -c “echo 1 > /proc/sys/net/ipv4/ip_forward“
- create NAT rules with iptables
- sudo iptables –t nat –A POSTROUTING –o eth0 –j MASQUERADE
- sudo iptables –A FORWARD –i eth0 –o wlan0 –m state —state RELATED,ESTABLISHED –j ACCEPT
- sudo iptables –A FORWARD –i wlan0 –o eth0 –j ACCEPT
- sudo sh -c “iptables-save > /etc/iptables/rules.v4”
- sudo service hostapd start
- sudo service isc-dhcp-server start
- sudo service hostapd status
- sudo service isc-dhcp-server status
- sudo update-rc.d hostapd enable
- sudo update-rc.d isc-dhcp-server enable
- sudo reboot
- tail -f /var/log/syslog
One thought on “Creating a wifi subnet for the dash buttons”