Networking administration

In this section, we will go through some basic Linux commands that will help determine future problems. Feel free to come back here and read this again. There are many commands that we can execute in a terminal to debug our project or the Raspberry Pi Zero W communication setup that we have made.

At first, the most basic command is ifconfig. The ifconfig command outputs some interfaces and plenty of information about them. For example, you can easily find what is the IP of your Raspberry Pi Zero W device is by simply typing:

Ifconfig

As shown in the following screenshot, the IP address can easily be found. If you see no IP address, it means that your Raspberry Pi Zero W device is connected to the internet:

The next command that helps when we have networking issues is ping. With ping, we can determine whether a server is down or up. In other words, by pinging at a server which is up we can determine whether you are connected to the internet or not. In the following example, we will ping www.google.com and see whether we get a response or not. Type the following command:

ping -c 3 www.google.com

If everything is okay, you should have a result similar to the following, where we can see that there are two responses with 64 bytes each:

The -c 3 argument that we gave means that we request only three pings and then stop the command.

Now we will start a simple server in our Raspberry Pi so we can verify that everything is OK and we have access to our Pi from all over the world. To do that, we use the Python language and we will start a daemon that Python allows us. If you do not have Python installed, type the following command:

sudo apt-get install python

Then type the following:

python

Verify that everything is OK. The next step is to start the server. To do that, we need to type the following:

python -m SimpleHTTPServer 8000

If everything went well, we will have a result similar to the following, where we can see that the server is up and running at port 8000:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.247.31