Home > How-To Guides, RaspberryPi > RaspberryPi Wireless Access Point

RaspberryPi Wireless Access Point

RPI_APHello there!

Unfortunately I am very busy so I am not able to add a lot of new project but from time to time
I am publishing something new just like this tutorial about

Setting up a RaspberryPi as a Wireless Access Point to provide Wireless connectivity
on another WiFi Network with a different SSID (WiFi Name) and a WiFi USB Dongle (USB WLan Adapter)

Requirements:
– RaspberryPi, I am using a Model B
– SD Card, I am using a 8Gb Sandisk Class 4
– USB WiFi Dongle, I am using a Kraun. Must support the AP Protocol, later explained
– Raspbian OS installed on the SD Card, I am assuming you know how to do that
– RJ45 UTP Cable connected to your Switching HUB / Router and Internet Connection. uh!
– MicroUSB cable for power supply

You can either log in via SSH from another computer or you can do it locally with a keyboard and
a HDMI Cable hooked to a HDMI Screen

1) Boot the RPi (RaspberryPi and “sudo su” to become root or log in as root
2) run
apt-get install rfkill zd1211-firmware hostapd hostap-utils iw dnsmasq
all together or separately to install the above packets
3) run
iw list
To check if dongle supports AP protocol. Seach for “AP” among the results of “iw list” command
4) run
pico /etc/network/interfaces
To open the file and edit so that it looks like
######################
auto lo
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet static
address 192.168.2.1
netmask 255.255.255.0
######################

address 192.168.2.1 (is the new LAN Segment, it cannot be on your other LAN 192.168.1.1 or 192.168 pfiu6ok.0.1 etc
eth0 interface gets IP address from the router’s dhcp while wlan0 interface has a static IP

5) run
ifdown wlan0; ifup wlan0
6) run
pico /etc/hostapd/hostapd.conf
To open the file and edit so that it looks like

######################
interface=wlan0
driver=nl80211
ssid=RPi_WiFi_Name
channel=7
ht_capab=[HT40-][HT40+][SHORT-GI-40][DSSS_CCK-40]
# added for security
hw_mode=g
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=YourWiFiKey
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=TKIP CCMP
#######################
RPi_WiFi_Name is the SSID of this new Wlan
YourWiFiKey is the password or the key

7) run
service hostapd restart
To restart the service

8) run
pico /etc/dnsmasq.conf
To open the file and edit so that it looks like

##########################################################
# Never forward plain names (without a #dot or domain part)
domain-needed

# Only listen for DHCP on wlan0
interface=wlan0

# create a domain if you want, comment #it out otherwise
#domain=google.com

# Create a dhcp range on your /24 wlan0 #network with 12 hour lease time
dhcp-range=192.168.2.2,192.168.2.254, 255.255.255.0,12h

# Send an empty WPAD option. This may be #REQUIRED to get windows 7 to behave.
#dhcp-option=252,”\n”
##########################################################

9) run
hostapd -B /etc/hostapd/hostapd.conf
It will give you something like this:

Configuration file: /etc/hostapd/hostapd.conf
Failed to update rate sets in kernel module
Using interface wlan0 with hwaddr c8:3a:35:ce:4f:ee and ssid ‘RPi_Wifi_Name’

10) run
service dnsmasq restart
To restart the service

11) run
pico /etc/init.d/pipoint
To edit the file so that it looks like

####################################################
#!/bin/sh
# Configure Wifi Access Point.
#
### BEGIN INIT INFO
# Provides: WifiAP
# Required-Start: $remote_fs $syslog
$time
# Required-Stop: $remote_fs $syslog $time
# Should-Start: $network $named slapd autofs ypbind nscd nslcd
# Should-Stop: $network $named slapd autofs ypbind nscd nslcd
# Default-Start: 2
# Default-Stop:
# Short-Description: Wifi Access Point configuration

# Description: Sets forwarding, starts hostap, enables NAT in iptables
### END INIT INFO

# turn on forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

# enable NAT
iptables -t nat -A POSTROUTING -j MASQUERADE

# start the access point
hostapd -B /etc/hostapd/hostapd.conf
#####################################################

12) run
chmod +x /etc/init.d/pipoint
To get pipoint being executable

13) run
update-rc.d pipoint start 99 2

To add the pipont to start as a service at every boot
It should reply like this:

update-rc.d: using dependency based boot sequencing

14) run
reboot
To reboot the RaspberryPi. After that you should see a new Wlan available
name RPi_WiFi_Name with password as “YourWiFiKey” and WPA Security

Try to connect to such Wlan and you’re good to rock and roll

Once in a while you could change the SSID Name and Password and reboot

I have tested this with weekly timer which turns on the RPi during
business hours for my customers and turns it off during non business hours

Let me know if this helps you

Cheers Mates!

Similar Posts:

  1. No comments yet.
  1. No trackbacks yet.