Page 1 of 1

Connect Raspi to a Proxy

Posted: Thu Sep 27, 2012 7:52 pm
by raspiworld
Hi, I have a problem with my internet connectivity.
I only have acces to the Internet over a proxy server. When I try to visit a website with the browser, it works, because of the proxy settings of the browser.

But when I want to install new software, there is no connection to the Internet, when I tipe in "apt-get update" for example.

Is there any posibility or setting to get access to the internet over a proxy?


Thank you!

Re: Connect Raspi to a Proxy

Posted: Sat Sep 29, 2012 2:22 am
by Wendo
Add the following lines to the file /etc/environment

export http_proxy="http://username:password@host:port/"

Re: Connect Raspi to a Proxy

Posted: Tue Oct 02, 2012 10:09 am
by phughes
Hi,

Very new to this. I have tried to edit the file as you have said, no authentication required.

export http_proxy=http://proxy.county.ac.uk:8080

This doesn't seem to do anything. Did you get it working??

Cheers,
Pete

Re: Connect Raspi to a Proxy

Posted: Tue Oct 02, 2012 11:10 am
by VAXXi
apt seems to ignore the HTTP_PROXY environment variable.

You can make it work by putting

Code: Select all

Acquire::http::Proxy "http://yourproxyaddress:proxyport";
in a file placed in /etc/apt/conf.d (named similar to "10proxy" for example). It should also work when placed in /etc/apt/apt.conf but I don't remember if this file still exists on the latest Raspbian.

Re: Connect Raspi to a Proxy

Posted: Tue Oct 02, 2012 12:23 pm
by phughes
Hi,

Thanks for the reply. Looks promising, but i'm not quite sure where exactly to add the line.

The structure i have is as follows;

/etc/apt/ - contains 3 files (sources.list, trustdb.gpg & trusted.gpg)
/etc/apt/apt.conf.d - contains 3 files (70debconf, 50raspi & 01autoremove)
/etc/apt/preferrences.d - empty
/etc/apt/sources.list.d - 1 file (raspi.list)
/etc/apt/trusted.gpg.d - empty

Do I create a new file or use one of these?

Many thanks,
Pete

Re: Connect Raspi to a Proxy

Posted: Tue Oct 02, 2012 12:25 pm
by VAXXi
Create a new file in /etc/apt/apt.conf.d/ and name it "10proxy"; put inside the long line in my above post. Apt-get should work immediately after.

Re: Connect Raspi to a Proxy

Posted: Tue Oct 02, 2012 12:44 pm
by phughes
Wonderful. Thank you :)

Re: Connect Raspi to a Proxy

Posted: Wed Oct 03, 2012 1:24 pm
by phughes
Internal proxy. For internet use.

I'm getting an error using dillo; DNS failed to resolve domain\username

I have changed the file /etc/environment to read as follows;

Code: Select all

export http_proxy="http://domain\username:password@proxyip:port/"
This looks like a syntax error with my code, any suggestions?

Cheers,
Pete

Re: Connect Raspi to a Proxy

Posted: Thu Oct 04, 2012 7:16 am
by phughes
Hi Guys,

Dillo doesn't like proxy servers I dont think. The above code works perfectly fine on the other richer browsers.

Cheers,
Pete

Re: Connect Raspi to a Proxy

Posted: Fri Oct 05, 2012 3:53 pm
by raspiworld
Hi guys,
I tried to go to the directory using "cd /etc/apt/apt.conf.d" but the terminal says "Not a directory"
To create the "10proxy" file there I have to go in there.
Cut and paste doesn't work, too. (Permission denied)

If I try to move the file to the Folder "apt.conf.d" using "mv 10proxy /etc/apt/apt.conf.d" the file goes to "/etc/apt" and get the name "apt.conf.d".

I don't understand this. I just want to have a Internet connection on my Raspi.

Many thanks

Re: Connect Raspi to a Proxy

Posted: Fri Oct 05, 2012 7:54 pm
by VAXXi
Not sure about what Linux distribution you're using, but try adding a "/" at the end of the path (after apt.conf.d) and prefix the commands with sudo in order to make sure it's not a permission problem.

Re: Connect Raspi to a Proxy

Posted: Mon Oct 08, 2012 9:41 pm
by raspiworld
Worked fine.

Thank you!

Re: Connect Raspi to a Proxy

Posted: Thu Jan 23, 2014 12:37 am
by tsantosc123
Hello, I've created the "10proxy" file and put the line said by VAXXi in it, but I still can't access apt.
I think it's because I need an username and password to connect in my proxy server.

There's something I can do to include the username and password?

Thank you.

Re: Connect Raspi to a Proxy

Posted: Thu Jan 23, 2014 1:01 am
by DougieLawson
At a guess

Code: Select all

Acquire::http::Proxy "http://yourusername:yourpassword@yourproxyaddress:yourproxyport";

Re: Connect Raspi to a Proxy

Posted: Mon May 26, 2014 2:59 pm
by jneha
VAXXi wrote:apt seems to ignore the HTTP_PROXY environment variable.

You can make it work by putting

Code: Select all

Acquire::http::Proxy "http://yourproxyaddress:proxyport";
in a file placed in /etc/apt/conf.d (named similar to "10proxy" for example). It should also work when placed in /etc/apt/apt.conf but I don't remember if this file still exists on the latest Raspbian.


Thank you. the apt-get works in my Raspi by setting the proxy.. Thank you :)

Re: Connect Raspi to a Proxy

Posted: Tue Mar 08, 2016 11:50 am
by Chanderjeet
I used these steps to get proxy up and running -

viewtopic.php?f=28&t=136554&p=907699#p907699


then I create a blank file named 10proxy under /etc/apt/apt.conf.d and added this line :

Acquire::http::Proxy "http://yourproxyaddress:proxyport";



It works like charm !

Re: Connect Raspi to a Proxy

Posted: Wed Apr 20, 2016 4:03 pm
by netitux
This works! Thanks!

Re: Connect Raspi to a Proxy

Posted: Thu Nov 10, 2016 5:03 pm
by nageshub
I have a similar kind of problem, where in I am connecting pi2 with raspbian Jesse to a college network having proxy server. I had set proxy in 10proxy file and everything is working fine as am able to ping google.com and all other servers. But when I try to connect to cayenne iot wget link, it shows ' resolving' and fails to connect even many tries after timeout. Am able to connect to this link in my desktop.
Can anybody help.....?

Re: Connect Raspi to a Proxy

Posted: Sun Nov 13, 2016 4:18 pm
by nageshub
Before anyone, I solved this problem myself. Just have to add proxy to wget in /etc/wgetrc

Re: Connect Raspi to a Proxy

Posted: Mon Oct 30, 2017 8:41 am
by asmaa_alsousy
nageshub wrote:
Sun Nov 13, 2016 4:18 pm
Before anyone, I solved this problem myself. Just have to add proxy to wget in /etc/wgetrc
HI
my raspberry pi can see the WIFI but cannot connect to it
it required a pre shared key
I entered the password of WIFI, but it still seem not connected.
there is a proxy and I dont know how to add it to the raspberry pi3
can you please explain how to add proxy to wget.
thanks very much
:)

Re: Connect Raspi to a Proxy

Posted: Tue Mar 13, 2018 7:43 pm
by atulkrishna
For connecting Raspi to a proxy server you can follow this blog. It works fine for me.
[https://theailearner.com/2018/03/13/con ... xy-server/]

Re: Connect Raspi to a Proxy

Posted: Mon May 20, 2019 4:56 pm
by GodSaveTheDoge
How can i connect to a proxy with raspberry pi 3 b+
It's a socks5 proxy, not http.
(host is 127.0.0.1, the port is 9050)
I have raspbian.

(yep it's tor)

Re: Connect Raspi to a Proxy

Posted: Sat Jun 22, 2019 6:42 pm
by bricolodu13
Hello The community :D !

I have a Pi 3B+ and a Zero W that both can wirelessly connect to a proxy : Fine
Both can ping Google, both can do apt-get update : Fine

BUT :
I have on these Pi LogitechMediaServer that is running and none of my Pi can connect to any internet Radio or Streaming plateform from the LMS when the Pi are connected to the Proxy.
I have the very same issue with other applications that need an internet connection.

Note that if connected to a non Proxy connection, LMS and any other applications can connect to Internet

So there should be some sort of indication to provide somewhere so that LMS can ALSO connect to Internet from the Proxy connection

:?: Any idea ?

Thank you for your help.
Jean