Raspberry Pi wireless connection

If you are booting your raspberry pi first time and connecting to the boards console through a USB to TTL serial cable, you can configure the wireless interface of your board to connect it to your home wireless router which has a WPA wireless security mode enabled.

$sudo vi /etc/network/interfaces

#Then edit the file as below.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
   wpa-scan-ssid 1
   wpa-ap-scan 1
   wpa-key-mgmt WPA-PSK
   wpa-proto RSN WPA
   wpa-pairwise CCMP TKIP
   wpa-group CCMP TKIP
   wpa-ssid "<YOUR WIRELESS NETWORK SSID>"
   wpa-psk "<YOUR WIRELESS NETWORK PASSWORD>"

iface default inet dhcp

$sudo /etc/init.d/networking restart

After a few seconds your wireless interface will get an IP address from your home network's DHCP server. You can see the IP address with the ifconfig command.

pi@raspberrypi:~$ ifconfig 
eth0      Link encap:Ethernet  HWaddr b8:27:eb:b2:00:d8  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:03:7f:0f:a3:a0  
          inet addr:192.168.0.104  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:637 errors:0 dropped:0 overruns:0 frame:0
          TX packets:115 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:161412 (157.6 KiB)  TX bytes:12238 (11.9 KiB)

pi@raspberrypi:~$ 

Comments

Popular posts from this blog

How to Use container_of in Linux Kernel Development

Notification Chains in Linux Kernel

Build and Flash OpenWrt for Raspberry Pi