Sunday, June 4, 2017

Configuring my wifi dongle on the Raspberry Pi to connect to my network router.

Configuring my wifi dongle on the Raspberry Pi to connect to my network router.

Generic Wifi dongle used on my Raspberry Pi


I had to get my router details and had to configure the following configuration files.
I wanted to give my Raspberry Pi a spear static IP so I always know what it is on my network.

I edited the following files.

/etc/wpa_supplicant/wpa_supplicant.conf

I added the following at the end. I was using WEB encryption and shared key on my router.
Change the details in yellow for your router if you use web encryption with shared key.
use your favorite editor
sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

#Configeration of the file /etc/wpa_supplicant/wpa_supplicant.conf
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
        ssid="MyRouter"  # your router ID
        key_mgmt=NONE
        wep_key0="0123456789123"  # or 13 characters, or a hexkey starting with 0x your key
        wep_tx_keyidx=0
        auth_alg=OPEN
}

Save and exit
And the change the following file

Edit the file as follows in the section configuring wlan0
I gave my Raspberry pi a spear static Ip on my network so always now what the ip is and don't use DHCP so I will not know what the Ip will be 
use your favorite editor

sudo vi /etc/network/interfaces
auto wlan0
allow-hotplug wlan0
#iface wlan0 inet dhcp
iface wlan0 inet static
address 192.168.1.205  #Static Ip
netmask 255.255.255.0 # Ip mask of network
gateway 192.168.1.254 # IP gateway of router
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Save

And reboot Raspberry Pi  sudo shutdown -r 0

ping your new Ip on Wifi network

ping 192.168.1.205

And it should now work.





No comments:

Post a Comment