首页 > 解决方案 > Ubuntu server 18.04 LTS does not use the proxy anymore

问题描述

I have a Problem with one of my Servers. I am using one Proxy, but the Server does not accept the Proxy and tries to directly connect to the Internet. I checked where the Server wants to connect, thats how i know it is no Network issue. My Routing and Firewall works correct.

I tried to Google for the Problem but I did not find a solution. My guess is that I am missing one Setting where the Proxy should be entered.

This is what I did:

  1. Proxy in /etc/Environment for the whole system

    http_proxy="http://192.168.1.10:8080" ftp_proxy="ftp://192.168.1.10:8081"

  2. Added the Proxy in /etc/apt/apt.conf AND /etc/apt/apt.conf.d/proxy.conf since I Read thet the file changed with 18.04 LTS:

    Acquire::http::Proxy "http://192.168.1.10:8080";

  3. Tried to add the Proxy in the terminal:

    export http_proxy="http://192.168.1.10:8080" export ftp_proxy="http://192.168.1.10:8081"

Here is an example for one issue:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys *****

I get a timeout when I enter this command (with the correct key). My DNS works, I get the correct IP for all Servers and everything I want to connect to.

Can anyone help me? Thats all I found which I could try. When I had ubuntu Server 16.04 LTS, way 3 was enough to work, and way 1 was needed if I did not want to insert the Proxy in each session.

标签: ubuntu

解决方案


This needs a lot of investigation. At first, are you sure your proxy is connected to the internet and, more importantly, forwarding the traffic correctly? if so, then you need to check whether your proxy is allowing http, https, and ftp traffics. Pinging the proxy server from your client would be useful to make sure you have access to the proxy server and no filter is applied.

After going through the abovementioned, you have to make sure your server is passing "https" traffic through the proxy, in your case, you didn't explicitly enter the https_proxy in your Environment neither apt.conf.

consider the following: in apt.conf add:

Acquire::https::proxy "http://192.168.1.10:8080";

in your environment file add:

https_proxy="http://192.168.1.10:8080"

If you want to export your proxy then consider exporting https_proxy:

export https_proxy="http://192.168.1.10:8080"

推荐阅读