Sunday, 3 February 2019

Make Static IP and Add WiFi Details to Raspberry Pi


Basic Setting after installing Software:

How to give your Raspberry Pi a Static IP Address:
Command: 
        sudo nano /etc/dhcpcd.conf

Copy this code on the editor:

interface eth0

static ip_address=192.168.0.10
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0

static ip_address=192.168.0.200
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

To exit the editor, press
ctrl+x

To save your changes press the letter
 “Y”
then hit
enter

Checking the IP address:
Command:  ifconfig


     1)Adding the WIFI network details to the Raspberry Pi:

Command: 
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Copy this code on the editor:

network={
    ssid="username"
    psk="Password"
}
To exit the editor, press
ctrl+x

To save your changes press the letter
 “Y”
then hit
enter

     2)Adding the Unsecured WIFI network details to the Raspberry Pi:
Command: 
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Copy this code on the editor:

network={
ssid="username"
 key_mgmt=NONE
}
To exit the editor, press
ctrl+x

To save your changes press the letter
 “Y”
then hit
enter

    3)Adding multiple wireless network details to the Raspberry Pi:

On recent versions of Raspbian, it is possible to set up multiple configurations for wireless networking.

    a) you could set up one for home and one for office.
Command: 
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Copy this code on the editor:

network={
    ssid="SchoolNetworkSSID"
    psk="passwordSchool"
    id_str="school"
}

network={
    ssid="HomeNetworkSSID"
    psk="passwordHome"
    id_str="office"
}

To exit the editor, press
ctrl+x

To save your changes press the letter
 “Y”
then hit
enter

    b) If you have two networks in range, you can add the priority option to choose between them. The network in range, with the highest priority, will be the one that is connected.
Command: 
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Copy this code on the editor:

network={
    ssid="Firstusername"
    psk="passwordOne"
    priority=1
    id_str="officeOne"
}

network={
    ssid="Secondusername"
    psk="passwordTwo"
    priority=2
    id_str="officeTwo"
}
To exit the editor, press
ctrl+x

To save your changes press the letter
 “Y”
then hit
enter

0 comments:

Post a Comment

if you have any doubt please let me know