I have using my Raspberry Pi 3 Model B running Raspbian as a torrent box and monitoring latest movies, tv shows for downloading. That’s why it’s not so good to connect without a protection. Also I have in hands a proxy that is transparency, so why not I let the Pi connect to the Internet through that proxy. So today I’ll add proxy Raspberry Pi.

Log in to SSH using pi:raspberry

Type in: curl -sb -H ipinfo.io/ip , and note down my current IP address.

Add Proxy Raspberry Pi

There is 3 places that I need to make changes:
1. /etc/environment (if this file doesn’t exist then create ones)

Copy and paste this, change the content with my proxy details: export http_proxy=”http://username:password@proxy_server_address:port/”export https_proxy=”http://username:password@proxy_server_address:port/”

Save the file.

2. /etc/apt/apt.conf.d/10proxy (for apt to connect to repositories through proxy) sudo nano /etc/apt/apt.conf.d/10proxy

Then add this with my proxy details: Acquire::http::Proxy “http://username:password@proxy_server_address:port/”;Acquire::https::Proxy “http://username:password@proxy_server_address:port/”;

Save the file.

3. nano ~/.bashrc sudo nano ~/.bashrc

Add this line at the end, of course, with my proxy details: export http_proxy=http://username:password@proxy_server_address:portexport https_proxy=https://username:password@proxy_server_address:port

The run: source ~/.bashrc

How to check if I have the proxy working?

Create a file nano ~/myip.sh  with this content: #!/bin/bashmyip1=”$(curl -sb -H ipinfo.io/ip)”echo “IPv4 address from ipinfo.io: ${myip1}”myip2=”$(curl -sb -H ifconfig.co)”echo “IPv4 address from ifconfig.co: ${myip2}”myip3=”$(host myip.opendns.com resolver1.opendns.com | sed -En ‘s/.*has address (([0-9]*\.){3}[0-9]{3})/\1/p’)”printf “IP address from myip.opendns.com: %s\n” “$myip3″exit

Make the file executable: sudo chmod +x ~/myip.sh .

Run it: sh ~/myip.sh

The result should look like: pi@raspberrypi:~ $ sh ~/myip.shIPv4 address from ipinfo.io: 1xx.1xx.1x.1xxIPv4 address from ifconfig.co: 2xxx:660x:xx:xxxx:4xxx:9xxx:xxx0:axxxIP address from myip.opendns.com: 1xx.1xx.1xx.1xx

Cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *