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

Raspberry Pi 3 Cookbook for Python Programmers
By :

Some networks, such as ones within workplaces or schools, often require you to connect to the internet through a proxy server.
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 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.
sudo nano -c ~/.bash_profile
function proxyenable { # Define proxy settings PROXY_ADDR="proxy.address.com:port" # Login name (leave blank if not required): LOGIN_USER="login_name" # Login Password (leave blank to prompt): LOGIN_PWD= #If login specified - check for password if [[ -z $LOGIN_USER ]]; then #No login for proxy PROXY_FULL=$PROXY_ADDR else #Login needed for proxy Prompt for password -s option hides input if [[ -z $LOGIN_PWD ]]; then read -s -p "Provide proxy password (then Enter):" LOGIN_PWD echo fi PROXY_FULL=$LOGIN_USER:$LOGIN_PWD@$PROXY_ADDR fi #Web Proxy Enable: http_proxy or HTTP_PROXY environment variables export http_proxy="http://$PROXY_FULL/" export HTTP_PROXY=$http_proxy export https_proxy="https://$PROXY_FULL/" export HTTPS_PROXY=$https_proxy export ftp_proxy="ftp://$PROXY_FULL/" export FTP_PROXY=$ftp_proxy #Set proxy for apt-get sudo cat <<EOF | sudo tee /etc/apt/apt.conf.d/80proxy > /dev/null Acquire::http::proxy "http://$PROXY_FULL/"; Acquire::ftp::proxy "ftp://$PROXY_FULL/"; Acquire::https::proxy "https://$PROXY_FULL/"; EOF #Remove info no longer needed from environment unset LOGIN_USER LOGIN_PWD PROXY_ADDR PROXY_FULL echo Proxy Enabled } function proxydisable { #Disable proxy values, apt-get and git settings unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY unset ftp_proxy FTP_PROXY sudo rm /etc/apt/apt.conf.d/80proxy echo Proxy Disabled }
Many programs that make use of the internet will check for the http_proxy or HTTP_PROXY environment variables before connecting. If they are present, they will use the proxy settings to connect through. Some programs may also use the HTTPS and FTP protocols, so we can set the proxy setting for them here too.
The last part allows any programs that execute using the sudo command to use the proxy
environment variables while acting as the super user (most programs will try accessing
the network using normal privileges first, even if running as a super user, so it isn't
always needed).
We also need to allow the proxy settings to be used by some programs, which use superuser permissions while accessing the network (this will depend on the program; most don't need this). We need to add the commands into a file stored in /etc/sudoers.d/ by performing the following steps:
sudo visudo -f /etc/sudoers.d/proxy
Defaults env_keep += "http_proxy HTTP_PROXY https_proxy HTTPS_PROXY ftp_proxy FTP_PROXY"
proxyenable proxydisable
Change the font size
Change margin width
Change background colour