This tutorial gives a step by step guide to setting up your Raspberry Pi to work as a wifi hotspot, and to share an internet connection from the Ethernet port of the Raspberry Pi. Check out the first part of my MultiCam tutorial if you just want a standalone Raspberry Pi that gives out its own IP addresses, without connecting to a router via Ethernet.

These instructions are for usb wifi adaptors with the popular Realtek RTL8188 chipset (mine is a cheap “comfast” model, but I believe the popular “Edimax” model also has this. There is a tutorial on the Raspberry Pi wiki, however this does not seem to assign an IP address to any device wanting to connect to the hotspot, and it simply says “Edimax does not work”, which it does, but just requires a little extra work. You can check that your usb wifi adaptor uses the Realtek RTL8188 chipset by using the following command:

lsusb

Hopefully, you’ll see something similar to this: (Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter), listing the WLAN/wifi usb adaptor chipset.

 

Guide:

1. Update, and install a some required software packages

sudo apt-get update

sudo apt-get install bridge-utils

2. Install hostapd using the following commands. This is the custom version for the RTL8188 chipset by Jens Segers. If you have a different chipset, it may work by just installing the standard hostapd (sudo apt-get install hostapd).

wget https://download.andypi.co.uk/v1.1.tar.gz
tar -zxvf v1.1.tar.gz
cd RTL8188-hostapd-1.1/hostapd
sudo make
sudo make install

3. Edit the hostapd configuration file (should have a list of comments already):

sudo nano /etc/default/hostapd

Add the line:

DAEMON_CONF=”/etc/hostapd/hostapd.conf”

4. Edit the hostapd.conf configuration file, but choose your own “ssid”, “wpa_passphrase” (8 – 63 charaters long) and “country_code” (Note: My auto install script originally replaced this file directly, however for some reason this fails on startup of hostapd, so editing the original file seems to be the most reliable method. Not sure why, its a bizarre problem.)

sudo nano /etc/hostapd/hostapd.conf

 

5. Modify your network interfaces file

sudo nano /etc/network/interfaces

Add the lines / change so the file reads:

auto lo
auto br0

iface lo inet loopback
iface br0 inet dhcp

bridge_fd 1
bridge_hello 3
bridge_maxage 10
bridge_stp off
bridge_ports eth0 wlan0

allow-hotplug eth0
iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual

6. Make hostapd start at boot time.

sudo update-rc.d hostapd defaults

7. Restart the networking and hostapd services, and you’re good to go.

sudo service networking restart

sudo service hostapd restart

 

AndyPi sources and info on the same topic:

http://blog.sip2serve.com/post/48420162196/howto-setup-rtl8188cus-on-rpi-as-an-access-point

http://www.raspberrypi.org/forums/viewtopic.php?f=36&t=19120&start=250

http://www.jenssegers.be/

http://follywood.no-ip.org/docs/Raspberry%20Pi/pi_wifi_ap.pdf

http://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software