User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Using RPi via Proxy [SOLVED]

Wed Jul 03, 2013 5:26 am

Hello,
I've very recently bought a Raspberry Pi. I have flashed the SD card and Rpi boots in perfectly. I have to access Internet via proxy at my University. As a basic step, I created a file
apt.conf
in

Code: Select all

/etc/apt/apt.conf.d
and set it to update/install software via terminal. But this didn't work. Next i created a file
apt.conf
directly in

Code: Select all

/etc/apt/
. Even this won't work. I surfed Internet for possible solution and following a blog post, I created a file
10proxy
in

Code: Select all

/etc/apt/apt.conf.d
. Still I wasn't able to update/install software from terminal. Please help me to configure my proxy settings so that I can update/install softwares from terminal. Thanks in Advance.
Last edited by northstar on Thu Jul 04, 2013 7:30 am, edited 1 time in total.

User avatar
rpdom
Posts: 15361
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Using RPi via Proxy

Wed Jul 03, 2013 6:51 am

What did you put in those files?

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 6:59 am

I put these lines in the file with proper username, password, proxy and port.
Acquire::http::proxy "http://usr:pwd@proxy:port/";
Acquire::https::proxy "https://usr:pwd@proxy:port/";
Acquire::ftp::proxy "ftp://usr:pwd@proxy:port/";
Acquire::socks::proxy "socks://usr:pwd@proxy:port/";
Last edited by northstar on Wed Jul 03, 2013 7:03 am, edited 1 time in total.

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Using RPi via Proxy

Wed Jul 03, 2013 7:01 am

And what sort of proxy are they using ?
What errors come up when you try to run apt-get update ?
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 7:13 am

The proxy is a university wide proxy. I edited the apt.conf file in my laptop running Ubuntu 12.04 and the changes made me install/update softwares directly from the terminal. Thought Rpi would behave the same way as my Ubuntu, because it is a remix of Debian. But, the configuration is different is Rpi. :)

User avatar
rpdom
Posts: 15361
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Using RPi via Proxy

Wed Jul 03, 2013 7:39 am

northstar wrote:The proxy is a university wide proxy. I edited the apt.conf file in my laptop running Ubuntu 12.04 and the changes made me install/update softwares directly from the terminal. Thought Rpi would behave the same way as my Ubuntu, because it is a remix of Debian. But, the configuration is different is Rpi. :)
Your configuration looks correct to me. I wonder why it isn't working?

Raspbian on the Pi is a lot closer to Debian than Ubunto is, but the configs should be the same.

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 8:55 am

Does this mean, I must flash my SD card again ?

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 4:16 pm

Any suggestions please ? Your suggestions will be of great help to me.

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 4:56 pm

This is the error I get when I try to update using
sudo apt-get update
:

Code: Select all

Err http://raspberrypi.collabora.com wheezy Release.gpg                                                                         
  Temporary failure resolving 'raspberrypi.collabora.com'
Err http://mirrordirector.raspbian.org wheezy Release.gpg                                                                       
  Temporary failure resolving 'mirrordirector.raspbian.org'
Err http://archive.raspberrypi.org wheezy Release.gpg                                 
  Temporary failure resolving 'archive.raspberrypi.org'
Reading package lists... Done                                                         
W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/wheezy/Release.gpg  Temporary failure resolving 'mirrordirector.raspbian.org'

W: Failed to fetch http://raspberrypi.collabora.com/dists/wheezy/Release.gpg  Temporary failure resolving 'raspberrypi.collabora.com'

W: Failed to fetch http://archive.raspberrypi.org/debian/dists/wheezy/Release.gpg  Temporary failure resolving 'archive.raspberrypi.org'

W: Some index files failed to download. They have been ignored, or old ones used instead.

User avatar
rpdom
Posts: 15361
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Using RPi via Proxy

Wed Jul 03, 2013 5:22 pm

Errors resolving addresses are usually to do with DNS lookup problems. That isn't normally done via a proxy, but a DNS server - either local or external.

What is the content of your /etc/resolv.conf file?

Do you get a response from "ping -c 1 google.com"? Pings might be blocked on your network, so this might not work, but does it get an IP address?

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 5:27 pm

I tried
ping 8.8.8.8
and it worked perfect. And btw, the content in /etc/resolv.conf is :
domain Home
search Home
nameserver 192.168.1.1

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 5:28 pm

But, when I try with
apt-get install/update
it throws this error. Moreover, my browser's working fine.

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 5:43 pm

How do I get around this problem ??? Its really irritating when you have work and idea at hand and the packages are not getting installed :/

User avatar
rpdom
Posts: 15361
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Using RPi via Proxy

Wed Jul 03, 2013 5:48 pm

northstar wrote:I tried
ping 8.8.8.8
and it worked perfect. And btw, the content in /etc/resolv.conf is :
domain Home
search Home
nameserver 192.168.1.1
That is a local DNS nameserver, which should be ok - as long as it knows about mirrordirector.raspbian.org and the others in your list.

It seems ping by address works. But how about ping by name as I suggested? The google.com one, or you could try ping -c 1 mirrordirector.raspbian.org

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Wed Jul 03, 2013 5:51 pm

it says
ping:unknown host

User avatar
rpdom
Posts: 15361
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Using RPi via Proxy

Wed Jul 03, 2013 6:56 pm

northstar wrote:it says
ping:unknown host
So it looks like your local DNS server is limiting which sites you can get to :(

You might be able to override that. First we can test it by editing /etc/resolv.conf and adding

Code: Select all

nameserver 8.8.8.8
On the end. Then try the ping and apt-get update again. This is just a test, so the change to the file will get lost when you next reboot. If it works we can see about making it permanent.

[edit]It might even get reset before the next boot - it depends on how often your DHCP settings get renewed, but see if it works anyway.

User avatar
northstar
Posts: 11
Joined: Wed Jul 03, 2013 4:46 am
Location: Hyderabad, India

Re: Using RPi via Proxy

Thu Jul 04, 2013 6:25 am

Thanks all. It works now... I created a file 10proxy in
/etc/apt/apt.conf.d
and
sudo apt-get update
works perfectly. Thanks again.


Pssst : How do I mark this thread as Solved ?

User avatar
rpdom
Posts: 15361
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Using RPi via Proxy

Thu Jul 04, 2013 7:27 am

northstar wrote:Pssst : How do I mark this thread as Solved ?
Edit your first post to the thread and add "[solved]" to the subject :)

Return to “Networking and servers”