One of the first things you will want to do with your Raspberry Pi is to connect it to a network so that you can gain access to the internet. You will need an IP address to gain access so that any information destined for your Raspberry Pi actually gets there. This is much like a house address. If someone is sending you a letter then they would need to know your address for you to receive it.
IP addresses take the form of something like this
Each device that has access to a network requires a unique IP address otherwise if two addresses are the same, the information will not know which device to deliver the information to.
Most networks and out of the box routers automatically supply your Raspberry pi with an IP address. This saves you a lot of the work when setting it up. To connect your Raspberry Pi to the internet just plug in a network Ethernet cable. (See Week 1 – Day 4 (Connecting it up)).
To confirm that you have an internet connection following these instructions
Open a terminal window
$ ping 184.108.40.206 -c 5
This will ask a device on the internet for a reply.
PING 220.127.116.11 (18.104.22.168) 56(84) bytes of data.
64 bytes from 22.214.171.124: icmp_req=1 ttl=64 time=0.342 ms
64 bytes from 126.96.36.199: icmp_req=2 ttl=64 time=0.349 ms
64 bytes from 188.8.131.52: icmp_req=3 ttl=64 time=0.381 ms
64 bytes from 184.108.40.206: icmp_req=4 ttl=64 time=0.355 ms
64 bytes from 220.127.116.11: icmp_req=5 ttl=64 time=0.411 ms
For this automatic connection to happen it uses DHCP which stands for Dynamic Host Configuration Protocol.
Enter the following
$ sudo cat /etc/network/interfaces
The line that makes this happen is
iface eth0 inet dhcp
iface refers to interface, which is the eth0 or the port that you connected your network cable to. The type of connection required is dhcp which configures the Raspberry pi to use DHCP or automatic IP addressing.
The information on this site has been created by volunteers in their own time because they have a passion to learn and to teach others. If you find this information useful please consider contributing something so that they know their efforts are appreciated.
Next Raspberry Pi Week 2 – Day 5.0 >>