-
Notifications
You must be signed in to change notification settings - Fork 17
Wi Fi
Prerequisites: a wi-fi adapter supporting "AP" (access point, or master) mode, such as Ralink RT5370.
In case you are using a Realtek 8188 or 8192 based adapter, follow these instructions for Realtek 8188 Wi-Fi adapter.
Execute:
sudo apt-get install hostapd
edit the file:
sudo nano /etc/network/interfaces
as follows:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
#allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0
edit the file:
sudo nano /etc/hostapd/hostapd.conf
as follows:
interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=coderbot
hw_mode=g
channel=8
wpa=2
wpa_passphrase=coderbot
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP
beacon_int=100
auth_algs=3
wmm_enabled=1
edit the file:
sudo nano /etc/default/hostapd
as follows:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Execute:
sudo apt-get install dnsmasq
Edit the file:
sudo nano /etc/dnsmasq.conf
as follow:
interface=wlan0 # To get dnsmasq to listen only on wlan0.
dhcp-range=10.0.0.2,10.0.0.10,255.255.255.0,12h # This sets the available range from 10.0.0.2 to 10.0.0.5
dhcp-authoritative
dhcp-option=252,"\n"
no-resolv
no-poll
After a reboot a "coderbot" wifi network should be available (password: "coderbot")
Avahi daemon implements the mDNS (multicast DNS) which allows the raspberry to be located as coderbot.local when connected to a private WiFi (WiFi mode "Client").
sudo apt-get install avahi-daemon
To change the hostname from "raspberrypi" to "coderbot" edit the file:
sudo vi /etc/hosts
and modify the line:
127.0.1.1 raspberrypi
to
127.0.1.1 coderbot
Modify the file:
sudo vi /etc/hostname
from this
raspberrypi
to this
coderbot
then reboot, the raspberry will be discovered as coderbot.local