Friday, March 15, 2013

Setting up wifi on Raspberry Pi

I recently bought a "NETGEAR wifi dongle" fo my Raspberry Pi so free it from the wired ethernet connections. The details of the wifi dongle is as follows:
$lsusb
Bus 001 Device 004: ID 0846:9041 NetGear, Inc. WNA1000M 802.11bgn [Realtek RTL8188CUS]

To configure it to the local wifi network:

modify /etc/network/interfaces as follows
For example if my wifi network's name is "~Jaguar~" and password is "Password123"
auto lo

iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
        wpa-ssid "~Jaguar~"
        wpa-psk "Password123"

Softreboot the system and wifi should be working.
$ sudo shutdown "now" -r

To re-confirm
pi@raspberrypi ~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:ae:b2:aa  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:95 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9356 (9.1 KiB)  TX bytes:13962 (13.6 KiB)

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:6402 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6402 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:19282157 (18.3 MiB)  TX bytes:19282157 (18.3 MiB)

wlan0     Link encap:Ethernet  HWaddr 84:1b:5e:92:bf:e8  
          inet addr:192.168.1.8  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2182 errors:0 dropped:2359 overruns:0 frame:0
          TX packets:2001 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:289214 (282.4 KiB)  TX bytes:1055742 (1.0 MiB)
and
 pi@raspberrypi ~ $ iwconfig  
lo        no wireless extensions. 
 
wlan0     IEEE 802.11bg  ESSID:"~Jaguar~"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 80:A1:D7:8D:A3:24   
          Bit Rate:54 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0  
 
eth0      no wireless extensions.  
For Internet to work: use
$ sudo /sbin/route add -net 0.0.0.0 -gw 192.168.1.1 wlan0
where 192.168.1.1 is gateway of my router.

Hope this post helps. :-)

5 comments:

  1. For a static ip on local wifi network change the /etc/network/interfaces to

    pi@raspberrypi ~ $ cat /etc/network/interfaces
    auto lo

    iface lo inet loopback
    iface eth0 inet dhcp

    allow-hotplug wlan0

    auto wlan0

    iface wlan0 inet static
    address 192.168.1.201
    netmask 255.255.255.0
    gateway 192.168.1.1
    wpa-ssid "~Jaguar~"
    wpa-psk "Password123"

    ReplyDelete
  2. Hi, we are trying to get up this adapter on RPI with Volumio ( http://volumio.org/forum/wifi-and-netgear-n150-t112-20.html ). Could you send me output of lsmod command? :)

    ReplyDelete
  3. Thanks you, this is perfect Solutions....!!!!, Really very impressed reading by your article!! Thanks Again!!!!! keep it up!!!!
    Netgear Router Tehnical Support

    ReplyDelete
  4. I am really happy for this informative blog was found. I got lots of information about netgear. For any technical issue resolution dial 0800-090-3220 or visit our website Netgear Contact Number UK

    ReplyDelete