Tag Archives: Pi

Raspberry Pi as WiFi Hotspot

MINImal raspBIAN image for Raspberry Pi (Minibian)

What you need

  • Minibian (Debian Jessie 8) 2016-03-12
  • Dnsmasq as DNS and DHCP server (already running in my network)
  • Raspberry Pi Model B (Rev 1.0, 256Mb)
  • 5V 2A microUSB power adapter
  • 8GB microSD card
  • Ethernet cable
  • Edimax EW-7811Un N150 Wireless USB Adapter Nano (RTL8192CU chipset)

Download and copy Minibian

wget http://downloads.sourceforge.net/project/minibian/2016-03-12-jessie-minibian.tar.gz
tar -zxvf 2016-03-12-jessie-minibian.tar.gz
dd bs=4M status=progress if=2015-11-12-jessie-minibian.img of=/dev/sdd

Start Raspberry Pi and login via SSH
ssh root@faix-pi
Login: root
Password: raspberry

Identify Raspberry Pi
cat /proc/cpuinfo

Install system core tools
apt-get install raspi-config apt-utils logwatch hwinfo ncdu logrotate lsof postfix vim htop iotop iftop screen mc curl usbutils

Change locales to en_US.UTF-8

dpkg-reconfigure locales
locale-gen

Set hostname
hostnamectl set-hostname faix-pi

Select timezone Europe/Prague
dpkg-reconfigure tzdata

Set NTP server
/etc/ntp.conf

server home-server
systemctl ntp restart

Logwatch
mkdir /var/cache/logwatch
/usr/share/logwatch/default.conf/logwatch.conf
Detail = High

Software Configuration Tool
raspi-config
Change User Password
Expand Filesystem

Update the package lists and upgrade
apt-get update; apt-get -y dist-upgrade; apt-get -y autoremove

Install bridge-utils, hostapd and rng-tools
apt-get install bridge-utils hostapd rng-tools

Bridge the Network Connections
/etc/network/interfaces

#loopback adapter
auto lo
iface lo inet loopback
#wired adapter
iface eth0 inet dhcp
#bridge
auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0

Configure Hostapd
/etc/hostapd/hostapd.conf

interface=wlan0
driver=nl80211
bridge=br0
ssid=Zeus
channel=3
hw_mode=g
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=changeme
auth_algs=1
wpa_group_rekey=600
wpa_ptk_rekey=600
wpa_gmk_rekey=86400
country_code=CZ
ieee80211d=1
macaddr_acl=0
wmm_enabled=0

Enable and start random number generator

systemctl enable rng-tools
systemctl start rng-tools

Reboot Raspberry Pi
reboot

Test your configuration
hostapd -dd /etc/hostapd/hostapd.conf

Enable and start hostapd daemon
/etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"

systemctl enable hostapd
systemctl restart hostapd

Edimax EW-7811Un N150 Wireless USB Adapter Nano (RTL8192CU chipset)
hwinfo --wlan

02: USB 00.0: 0282 WLAN controller
[Created at usb.122]
Unique ID: BobO.Lnd5h7NE8EA
Parent ID: ADDn.GVovileGj8F
SysFS ID: /devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2:1.0
SysFS BusID: 1-1.2:1.0
Hardware Class: network
Model: "Realtek 802.11n WLAN Adapter"
Hotplug: USB
Vendor: usb 0x7392 "Realtek"
Device: usb 0x7811 "802.11n WLAN Adapter"
Revision: "2.00"
Serial ID: "00e04c000001"
Driver: "rtl8192cu"
Driver Modules: "8192cu"
Device File: wlan0
Features: WLAN
Speed: 480 Mbps
HW Address: 74:da:38:8c:3d:04
Link detected: yes
WLAN channels: 1 2 3 4 5 6 7 8 9 10 11 12 13
WLAN frequencies: 2.412 2.417 2.422 2.427 2.432 2.437 2.442 2.447 2.452 2.457 2.462 2.467 2.472
WLAN bitrates: 1 2 5.5 11
WLAN encryption modes: TKIP CCMP
WLAN authentication modes: open wpa-psk wpa-eap
Module Alias: "usb:v7392p7811d0200dc00dsc00dp00icFFiscFFipFFin00"
Driver Info #0:
Driver Status: 8192cu is active
Driver Activation Cmd: "modprobe 8192cu"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #4 (Hub)