2

I am running CentOS 6.5 on my desktop. I've set the Network Proxy using the network proxy application provided under Preferences. I've also set the following exceptions: localhost,127.0.0.0/8,172.16.0.0/12,192.168.0.0./16

But whenever I am using wget (I'm testing the proxy settings using using wget) then wget tries to connect to the proxy for private addresses, but wget localhost works fine and doesn't use the proxy.

I also removed all the proxy settings and set the proxy in the shell:

export http_proxy="<proxy_url>:<port>"
export https_proxy="<proxy_url>:<port>"
export no_proxy="localhost,127.0.0.0/8,172.16.0.0/12,192.168.0.0./16"

It work when I use the command wget <external_url> or wget localhost but fails when I use the command wget <private address from the $no_proxy variable>.

I also tried setting the variables in Ubuntu 14.04 also and facing the same issue.

Edit: I've found that the shell is ignoring the CIDR notation. If I need to browse 127.0.0.1 without a proxy then I need to input 127.0.0.1 in no_proxy variable instead of 127.0.0.0/8

0

2 Answers 2

8

You have and extra dot on one of the ranges:

export no_proxy="localhost,127.0.0.0/8,172.16.0.0/12,192.168.0.0/16"

EDIT:

After searching, it seems no_proxy won't work with networks, only domains .sample.com or exact IP 192.168.1.2, so either you add your local domain, all the IP your network has, or you use flags like wget --no-proxy

1
  • 1
    Thanks! It's still not working though. I've found that the shell is ignoring the CIDR notation. If I need to browse 127.0.0.1 without a proxy then I need to input 127.0.0.1 in no_proxy variable instead of 127.0.0.0/8 Aug 25, 2014 at 4:46
0

If we need to exclude 192.168.1.0/24 from proxy setting, we can set environment variable no_proxy as below:

export no_proxy=localhost,.localdomain
export no_proxy=${no_proxy},$(echo 192.168.1.{1..255} | sed 's/ /,/g')
1
  • 3
    That is impractical for large networks, such as 10.0.0.0/8.
    – RalfFriedl
    Oct 12, 2019 at 7:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .