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:
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.
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).
tar -zxvf v1.1.tar.gz
sudo make install
3. Edit the hostapd configuration file (should have a list of comments already):
sudo nano /etc/default/hostapd
Add the line:
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:
iface lo inet loopback
iface br0 inet dhcp
bridge_ports eth0 wlan0
iface eth0 inet manual
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: