[squid-users] Howto make Squid config dependent on hostname?

Grant Taylor gtaylor at tnetconsulting.net
Fri Sep 16 03:26:04 UTC 2022


On 9/15/22 8:29 AM, Hildegard Meier wrote:
> Hello,

Hi,

> we have two Squid servers (Linux hosts) and each shall have the very 
> same config file /etc/squid/squid.conf which is versioned and deployed 
> from a central deployment server.  So each host shall have deployed 
> the same files.
> 
> Each of the two shall have the other configured as sibling cache peer.
> 
> So node1 shall have
> cache_peer node2.examlpe.com sibling 3128 3130
> 
> and node2 shalle have
> cache_peer node1.examlpe.com sibling 3128 3130

I have no idea if it will work or not, but I might be tempted to try -- 
what I first saw as -- Solaris's "mailhost" or "losthost" name overloading.

Meaning that you would have a single identical entry in the config file 
on both systems:

    cache_peer peer-cache-node.example.com sibling 3128 3130

And then each host would use /etc/hosts to resolve the 
peer-cache-node.example.com name to it's neighbor's IP.  E.g.

node1:/etc/hosts
    ...
    192.0.2.1	node1.example.com
    192.0.2.2	node2.example.com peer-cache-node.example.com
    ...

node2:/etc/hosts
    ...
    192.0.2.1	node1.example.com peer-cache-node.example.com
    192.0.2.2	node2.example.com
    ...

I sort of suspect that the nodes already have a per-node /etc/hosts file.

This is untested and wild speculation on my part.  Can / will someone 
with more experience comment on the viability of such "mailhost" or 
"loghost" use?

Aside:  Solaris 8 / 9 / 10 used to ship with a lot of files configured 
with <something>host used in various configuration files and rely on the 
name resolution to resolve that to the proper IP address for the 
environment, be it the hosts file, NIS(+), or DNS.



-- 
Grant. . . .
unix || die

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4017 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20220915/d5954aff/attachment.bin>


More information about the squid-users mailing list