Showing posts with label configuartion. Show all posts
Showing posts with label configuartion. Show all posts

Wifi and IP configuration

In most of my projects I will use the raspberry board as a server device. This means that it hosts features or services which are shared on the network and can be used by all other devices on my home network. In this case best practice is to use a fixed IP (static IP). When you use the default DHCP configuration your IP might change from time to time. The raspberry board will no longer send an IP DHCP request, it will just use the IP set in our configuration file. On all other devices connected to my home network we can than use this static IP to connect or use the services hosted on the raspberry board. Another tutorial can be found via this link

In the command line type "sudo nano /etc/dhcpcd.conf" (without quotes) and press enter.
Go to the bottom of the file and insert the follwing text in order to set a fixed ip for the lan (ethernet) connection. 

     interface eth0

     static ip_address=192.168.0.10/24
     static routers=192.168.0.1
     static domain_name_servers=192.168.0.1

If you are using the wlan connection then insert this text.

     interface wlan0

     static ip_address=192.168.0.11/24
     static routers=192.168.0.1
     static domain_name_servers=x.x.x.x


press ctrl-x and type "y" to save and exit the configuration file.

static ip_address = the ip to use on the raspberry board. Do not use the same IP at the same time on lan and wlan interface.
static routers= the ip of your home router device, if you don't know this then start a command prompt on your windows laptop/pc and type "ipconfig /all" (without quotest) and then look for the default gateway
static domain_name_server= can be left empty, execpt when your services on your raspberry board need internet. If you don't know this then start a command prompt on your windows laptop/pc and type "ipconfig /all" (without quotest) and then look for the DNS Servers


Now we will configure the raspberry pi 3 wifi module by setting the wpa-supplicant configuration file. Type the following in the command line to the configuration file: "sudo nano /etc/wpa_supplicant/wpa_supplicant.conf" (without quotes). Go to the bottom of the file and add the following Wi-Fi setting, adding your setting in the quotation marks.
   network={
       ssid="The_ESSID_from_your_home_network"
       psk="Your_wifi_password"
   }

press ctrl-x and type "y" to save and exit the configuration file.


Another wifi tutorial can be found via this link




now restart your raspberry pi 3 board by typing "sudo reboot" (without quotes) and press enter.
As from now you need to use the static ip_address that you configured to connect to the raspberry via putty.