Connecting to the Internet through a proxy server

Some networks, such as workplaces or schools, often require you to connect to the Internet through a proxy server.

Getting ready

You will need the address of the proxy server you are trying to connect to, including the username and password if one is required.

You should confirm that the Raspberry Pi is already connected to the network and that you can access the proxy server.

Use the ping command to check this as follows:

ping proxy.address.com -c 4

If this fails (you get no responses), you will need to ensure your network settings are correct before continuing.

How to do it…

Create a new file using nano as follows (if there is already some content in the file, you can add the code at the end):

sudo ...

Get Raspberry Pi for Python Programmers Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.