Redhat: Enabling proxy for specific IP addresses only

I have a server that ordinarily does not require a proxy to connect (e.g.) to any URL on the internet. However some specific systems (IP addresses) I need to connect to via a specific proxy.

My question is how I can specify the proxy per IP-Address / subnet without disrupting the normal configuration where no proxy is required.

I am aware of the following variables that can be set, however this operates on an exclusion basis to access the proxy rather than an inclusion basis:

export http_proxy=http://my-proxy.tld:8080
export https_proxy=https://my-proxy.tld:8080
export no_proxy=127.0.0.1,localhost,192.168.1.123, ...

The server in question is a RedHat V7.1 box.

Any ideas will be much appreciated. Thanks in advance Alex


You can use Squid. If you want a smaller footprint installation and smaller configuration files, you could also try Tinyproxy.