Raspberry Pi as a Hotspot

From KlavoWiki
Revision as of 06:47, 1 December 2014 by David (Sọ̀rọ̀ | contribs) (→‎NAT)
Jump to navigationJump to search

configure wlan

Assign an IP address to NIC

vi /etc/network/interfaces

add

auto wlan0

Remark the following lines so the wlan never acts as a client

#allow-hotplug wlan0
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet manual

Assin an IP address to wlan0

iface wlan0 inet static
address 10.11.12.1
netmask 255.255.255.0
wireless-mode Master

dhcp

Setup DHCP Scope

apt-get install isc-dhcp-server

The following is based on your requirements.

# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
subnet 10.11.12.0 netmask 255.255.255.0 {
    range 10.11.12.101 10.11.12.120;
    option broadcast-address 10.11.12.255;
}


vi /etc/dhcp/dhcpd.conf 

Bind DHCP to wlan interface

vi /etc/default/isc-dhcp-server

Change

INTERFACES=""

to

INTERFACES="wlan0"


hostapd

As I have the RTL8188CUS wireless chipset I needed to download a specific version of the hostapd application. Other wireless network cards you could try using the distro package

apt-get install hostapd 

otherwise

cd /usr/src
wget https://github.com/jenssegers/RTL8188-hostapd/archive/master.zip
unzip master.zip
cd RTL8188-hostapd-master/hostapd/
make
make install
vi /etc/hostapd/hostapd.conf

Configure the following paramaters as required

ssid=
channel=
wpa_passphrase=

NAT

In my config I have not configured port forwarding and NAT. For my application here I am using the Raspberry Pi with SMB shares so the kids can access TV shows and movies from their android tables in the car so NAT is not required. This also why I have not configure a gateway or name servers in the DHCP server. I may add the NAT details at a later time.