Building a PI Wireless repeater

This is Tim’s definitive set of notes that tells you how to make a wireless repeater from a pi

Based largely on
https://seravo.fi/2014/create-wireless-access-point-hostapd

we have to have hostapd installed
we also have to have dnsmasq installed

utils for checking what the state of the pi is

iw wlan0 info
ifquery wlan0
ifconfig -a
lsusb

#######################################
# this is the /etc/network/interfaces file
#######################################

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet static
 address 192.168.0.198
 netmask 255.255.255.0
 gateway 192.168.0.1
wpa-ssid aaaaaaaaaa
wpa-psk bbbbbbbbb

auto wlan1
iface wlan1 inet static
hostapd /etc/hostapd/hostapd.conf
 address 192.168.2.2
 netmask 255.255.255.0

###########################
# this is the /etc/hostapd/hostapd.conf file
#######################################

interface=wlan1
ssid=anewhope
hw_mode=g
channel=1
wpa=2
wpa_passphrase=r3becca3ll
wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256

#######################################
# other bits
#######################################
uncomment in /etc/sysctl.conf

net.ipv4.ip_forward=1

in /etc/dnsmasq.conf we need

interface lo,wlan0,wlan1
no-dhcp-interface=lo,wlan0
dhcp-range=192.168.2.50,192.168.2.254,255.255.255.0,6h
sysctl status dnsmasq
sysctl start|stop dnsmasq

#######################################
# finally some forwarding
#######################################
in rc.local, before the exit line we put the following iptables line

iptables -t nat -A POSTROUTING -s 192.168.2.0/24 ! -d 192.168.2.0/24 -j MASQUERADE
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s