2

I've set up a squid forward proxy to cache all internet requests. I have a public ip and opened port 3128. Now I just need to set my ubuntu server to force all internet connections to pass through this proxy, using the ip address and port number.

I know this command which will make ubuntu access the internet via a proxy, but I was told it wasn't permanent.

export http_proxy="http://proxy.example.com:8080"

Which command do I need to use to force ubuntu to go through this proxy regardless of reboots or sessions?

Thanks

jc.yin
  • 531
  • 2
  • 7
  • 13

2 Answers2

2

Instead of doing an export, put this in file /etc/environment:

http_proxy="http://proxy.example.com:8080"
https_proxy="http://proxy.example.com:8080"
ftp_proxy="http://proxy.example.com:8080"
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY="http://proxy.example.com:8080"
HTTPS_PROXY="http://proxy.example.com:8080"
FTP_PROXY="http://proxy.example.com:8080"
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"

and reboot your server/vm.

pa4080
  • 29,831
  • do we still need to configure url in the browser to access internet through proxy ?? ( eq. inside firefox settings > Configure proxies to access internet ) – pkm Aug 05 '17 at 10:33
  • this work fine!!! thanks – pbms Jun 08 '22 at 11:28
0

fter some googling. i was able to fix this:

original: /etc/apt/apt.conf

    Acquire::http::Proxy "xx.xx.xx.xx:8080";

modified apt.conf

/etc/apt/apt.conf

    Acquire::http::Proxy "http://xx.xx.xx.xx:8080";