Sunteți pe pagina 1din 16

Preliminaries

Client and Server: When we connect our RPi to internet through Wifi, our RPi becomes client and the system
(modem/router) becomes the server.

IP( Internet Protocol): It is a set of rules governing the format of data sent over the Internet or other network.

IP Address (Internet Protocol Address): It is numerical label assigned to each device (e.g., computer, printer)
participating in a computer network. Each computer (known as a host) on the Internet has at least one IP
address that uniquely identifies it from all other computers on the Internet. My IP address looks like this:
192.168.0.105
DHCP Server - Dynamic Host Configuration Protocol is a client/server protocol that automatically provides an
Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet
mask and default gateway. Normally, the networks at school and home have DCP servers.In case if it is not
there you will set it up manually.
Preliminaries

Network Interfaces: It is the point of interconnection between a computer and a private or public
network.Network interface is a system's (software and/or hardware) interface between two pieces of
equipment or protocol layers in a computer network.If you can connect to an internet through two different
routers - you have two interfaces.

Gateway: It is the IP address of your router or cable modem.A gateway is a network point that acts as an
entrance to another network. You are connected to the outer world through the router. (so its IP address)

Netmask: A netmask is a 32-bit mask used to divide an IP address into subnets and specify the networks
available hosts. In a netmask, two bits are always automatically assigned. For example, in 255.255.225.0, "0"
is the assigned network address; and in 255.255.255.255, "255" is the assigned broadcast address.
Preliminaries

SSID - A service set identifier (SSID) is a sequence of characters that uniquely names a wireless local area
network (WLAN). It is nothing but name of your Wifi.

Domain Name System: The domain name system (DNS) is the way that Internet domain names are located and
translated into Internet Protocol addresses. A domain name is a meaningful and easy-to-remember "handle"
for an Internet address. It is easy to remember http://aws.amazon.com/ then to remember 72.21.214.144

Domain Name Servers: DNS are the Internet's equivalent of a phone book. They maintain a directory of domain
names and translate them to Internet Protocol (IP) addresses.
Preliminaries

Wi-Fi Protected Access (WPA) and Wi-Fi Protected Access II (WPA2) are two security protocols and security
certification programs developed by the Wi-Fi Alliance to secure wireless computer networks.

WEP is an old security protocol.


Preliminaries

In this example, we can see that


the IP address of the gateway is 192.168.1.1 (Default gateway)

Subnet Mask = Mask (255.255.255.0)


All the other clients on this network have their IP address as 192.168.0.101 , 192.168.0.102 etc
192.168.0.
Preliminaries

In this example, we can see that


the IP address is 192.168.1.100 (one node on the network)
the IP address of router is 192.168.1.1 (Default gateway)

Subnet Mask = Mask (255.255.255.0)


Connecting to the internet with your Raspberry Pi (RPi)
Step 1: Know your Wifi/ethernet network! ( its name (if wifi) (ssid), its password(if wifi)(key), type of
network(802.11n or 802.11a or 802.11g and type of encryption) [ You can get these details by checking
settings of an already connected device]
Connecting to the internet with your Raspberry Pi (RPi)
Step 2(only for wifi): Installing the firmware

Check whether you USB wireless adaptor is compatible with the type of network. If compatible, you need to
see if you have the required firmware for the adaptor. (Firmware is the software that helps you interact
with the USB wireless adatpor)

To know which wifi-firmware to install follow the following steps (knowing the brand of the adaptor is not
sufficient to know the firmware - there are many brands who but very few builds it )

type dmesg | grep ^ usbon command prompt (dmesg - gives you kernel messages)
Connecting to the internet with your Raspberry Pi (RPi)
Step 2(only for wifi): Installing the firmware

The line that reads manufacturer tells us Ralink tells us we need


to install package for Ralink firmware

Search on google firmware ralink debian wheezy and download


the latest package (it will be .deb file) [you have to do this on a
different computer that is connected to internet]

Once you have downloaded the package, transfer it to your Rpi


using a USB pen drive

Copy the package to home/pi/ directory

Replace the package name with the name of the file you
downloaded

sudo apt-get install firmware-ralink_0.36_all.deb

Reboot the Rpi ( sudo reboot)


Step 3: Configuring the network interface

sudo iwlist scan | less: run this command on the terminal to see if the USB wifi adaptor is working . This will show the list
of all the wifi networks there in the vicinity.

If there is an error message at this point, it means that you have installed a wrong firmware

Next step is to configure the network interface. The list of interfaces along with how they are to be configured is present
in a file called interfaces present in etc/network.

sudo nano etc/network/interfaces: run this on the terminal. This will open our nano text editor. The following is the
default view:

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Step 4: Configuring the network interface

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Make the following changes in case of ethernet (manual setting):

auto lo
iface lo inet loopback
iface eth0 inet static
[tab] IP Address
[tab] netmask
[tab] gateway
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Step 4: Configuring the network interface

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Make the following changes in case of wifi:

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa_conf/etc/wpa_.conf The last edited line make a reference to a file called
iface default inet dhcp wpa_conf which is consumed by a tool called
wpasupplicant.

Wpasupplicant provides an easy way to connect to


networks secured with WPA
Step 4: Configuring the network interface (WIFI only)

This step is only for Wifi. Wpasupplicant stores its configuration in a file wpa.conf under /etc directory.

sudo nano /etc/wpa.conf (type this in the console)


Press CTRL + O and CTRL + X to write
and save the wpa.conf
Once the console opens. Type the following things in the file.

NO Encryption WEP Encryption WPA/WPA2 Encryption

network={ network ={ network={


[TAB]ssid=your wifi name [TAB]ssid=your wifi name [TAB]ssid=your wifi name
[TAB]key_mgmt=NONE [TAB]key_mgmt=NONE [TAB]key_mgmt=WPA-PSK
} [TAB]wep_key0=wifi_password [TAB]psk=wifi_password
} }
wpa.conf file for
WPA2
Step 4: Setting up DNS Server (in case of manual)
sudo nano /etc/resolv.conf Now, just enter the following command to
restart the networking interface
>> opens resolv.conf (this file stores list of DNS servers) sudo /etc/init.d/networking restart

Just ensure that it looks like this in the end

nameserver 8.8.8.8

nameserver 8.8.8.4

>> They are googles publicly accessible nameservers (DNS)

>> Ctrl + O and Ctrl + X to save and exit


Step 5: Check if it is working properly
To check the current status of network,
ping -c 1 www.google.com iwconfig (used in wifi network)
ifconfig (used in ethernet)
>> There should not be any error

S-ar putea să vă placă și