如何让 Ubuntu 尊重 IPv6 的“忽略主机”代理设置?

Thi*_*CMC 10 ipv6 networking proxy

我刚刚在 下输入"dconf-editor", System ? Proxy ? ignore-hosts了以下内容:

['localhost', '127.0.0.0/8', '::1', '192.168.0.1', '2000::/3', 'fc00::/8']
Run Code Online (Sandbox Code Playgroud)

但是,谷歌浏览器(和apt-get update / upgrade)只是忽略了这个设置。

编辑:此外,Firefox 不支持这些ingore-hosts设置,甚至将其配置为“使用系统代理设置”。

例如,我的代理服务器(带有 Squid3 的 Ubuntu)处于双栈模式但是,我不想通过代理访问 IPv6 网站,这就是为什么我试图忽略整个 IPv6 Internet 的条目2000::/3,但是,它没有按预期工作。

编辑:另外,我不需要代理来访问Hyperboria驻留在下面的站点,fc00::/8但是它也不起作用......

我为什么要这样做?

因为我的环境已经是一个 IPv6-Only 网络,为了访问旧的互联网基础设施(IPv4-Only),我需要通过双栈代理。但是只有当网站没有 IPv6 时我才需要代理...

我怎么知道它不起作用?!

很简单,例如,只需访问一个显示 IPv6 地址的网站,http://www.sixxs.net或者http://ipv6.whatismyv6.com,然后,我仍然看到代理服务器的 IPv6 地址,因此,"ignore-hosts entry '2000::/3'"似乎无法正常工作。

编辑:另外,当我尝试访问Hyperboria网站时,Squid 返回一个无法访问的错误fc00::/8 network

(鱿鱼错误:(101)网络无法访问)

(当然不能,cjdns路由器直接在我的 Ubuntu 桌面上运行,因此,浏览时无需通过代理,Hyperboria fc00::/8但是,Ubuntu 不支持ignore-hosts代理设置。

mur*_*uru 1

我不知道如何Ubuntu 遵守该设置,但可能有解决方法:

  • APT 遵循环境变量中的设置/etc/apt/apt.conf(例如http_proxy)。的手册页apt.conf没有提到 dconf 设置,所以我认为 apt 不会检查它们。要指定 apt 应忽略代理的站点,请添加到/etc/apt/apt.conf

    Acquire::http::Proxy::<hostname/ip> DEFAULT;
    
    Run Code Online (Sandbox Code Playgroud)

    我认为这不能用于范围或子网,并且您需要为每个要排除的主机添加一个条目。

  • Chrome 尊重 no_proxy 环境变量,因此可以尝试使用它:

    no_proxy=localhost,127.0.0.0/8,::1,192.168.0.1,2000::/3,fc00::/8 google-chrome
    
    Run Code Online (Sandbox Code Playgroud)

    定义no_proxy/etc/environment确保其随处可用。众所周知,其他程序也支持此变量。

  • 最后,您可以考虑运行两个鱿鱼服务器。新主机将使用您当前的主机作为父主机,但仅适用于某些主机,使用allow_direct/never_direct设置。然后将新服务器设置为各处的代理服务器(/etc/apt/apt.conf/etc/environmentdconf条目)。我对双栈网络了解不多,所以我不知道这是否可行,但值得一提。

我不使用双栈网络,但由于我使用校园代理,我必须兼顾代理设置,我发现最后一个选项是最好的。让鱿鱼来玩杂耍吧。


小智 1

对于 Google Chrome 和 Chromium,您可以创建机器范围的策略文件。

Linux Chrome 管理员快速入门指南

以下是策略模板中的各种代理设置和说明:

// Proxy bypass rules
  //-------------------------------------------------------------------------
  // Google Chrome will bypass any proxy for the list of hosts given here.  This
  // policy only takes effect if you have selected manual proxy settings at
  // 'Choose how to specify proxy server settings'.  You should leave this
  // policy not set if you have selected any other mode for setting proxy
  // policies.  For more detailed examples, visit:
  // http://www.chromium.org/developers/design-documents/network-settings#TOC-
  // Command-line-options-for-proxy-sett

  //"ProxyBypassList": "http://www.example1.com,http://www.example2.com,http://internalsite/",

  // Choose how to specify proxy server settings
  //-------------------------------------------------------------------------
  // Allows you to specify the proxy server used by Google Chrome and prevents
  // users from changing proxy settings.  If you choose to never use a proxy
  // server and always connect directly, all other options are ignored.  If you
  // choose to use system proxy settings or auto detect the proxy server, all
  // other options are ignored.  If you choose fixed server proxy mode, you can
  // specify further options in 'Address or URL of proxy server' and 'Comma-
  // separated list of proxy bypass rules'.  If you choose to use a .pac proxy
  // script, you must specify the URL to the script in 'URL to a proxy .pac
  // file'.  For detailed examples, visit: http://www.chromium.org/developers
  // /design-documents/network-settings#TOC-Command-line-options-for-proxy-sett
  // If you enable this setting, Google Chrome ignores all proxy-related options
  // specified from the command line.  Leaving this policy not set will allow
  // the users to choose the proxy settings on their own.

  //"ProxyMode": "direct",

  // URL to a proxy .pac file
  //-------------------------------------------------------------------------
  // You can specify a URL to a proxy .pac file here.  This policy only takes
  // effect if you have selected manual proxy settings at 'Choose how to specify
  // proxy server settings'.  You should leave this policy not set if you have
  // selected any other mode for setting proxy policies.  For detailed examples,
  // visit: http://www.chromium.org/developers/design-documents/network-settings
  // #TOC-Command-line-options-for-proxy-sett

  //"ProxyPacUrl": "http://internal.site/example.pac",

  // Address or URL of proxy server
  //-------------------------------------------------------------------------
  // You can specify the URL of the proxy server here.  This policy only takes
  // effect if you have selected manual proxy settings at 'Choose how to specify
  // proxy server settings'.  You should leave this policy not set if you have
  // selected any other mode for setting proxy policies.  For more options and
  // detailed examples, visit: http://www.chromium.org/developers/design-
  // documents/network-settings#TOC-Command-line-options-for-proxy-sett

  //"ProxyServer": "123.123.123.123:8080",

  // Enable or disable PIN-less authentication
  //-------------------------------------------------------------------------
  // If this setting is enabled or not configured, then users can opt to pair
  // clients and hosts at connection time, eliminating the need to enter a PIN
  // every time.  If this setting is disabled, then this feature will not be
  // available.
Run Code Online (Sandbox Code Playgroud)