<div dir="ltr"><div>Hello Matus,<br><br>I think you can achieve this using the ${service_name} macro together with the tcp_outgoing_address directive.<br><br>The proposed scheme would look like this:</div><div>Suppose you have several Squid hosts: host1, host2, host3, etc.<br>1. Register host-specific names in your DNS (or /etc/hosts), such as host1-special, host2-special, host3-special, pointing to their corresponding "special" IPs.<br>2. Pass the hostname as the service name when starting Squid using the -n option. In a systemd unit file, you can use -n %H (or %h for the short hostname).<br>3. Use the ${service_name} macro in your tcp_outgoing_address directive, for example:<br>tcp_outgoing_address ${service_name}-special special_hosts<br><br>Another very handy approach I can recommend for managing identical configs with per-host values is using Ansible templates (Jinja2).<br><br>Kind regards,</div><div> Ankor</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">чт, 26 нояб. 2026 г. в 19:24, Matus UHLAR - fantomas <<a href="mailto:uhlar@fantomas.sk">uhlar@fantomas.sk</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>On 26 November 2026 11:28:52 am UTC, Matus UHLAR - fantomas <<a href="mailto:uhlar@fantomas.sk" target="_blank">uhlar@fantomas.sk</a>> wrote:<br>
>>This seems to be possible, although confusing in case of multiple ACLs to match.<br>
<br>
On 26.11.26 16:04, Nishant Sharma wrote:<br>
>For each ACL you can have separate outgoing address lines in the file.<br>
><br>
>For AND match, you can have those ACLs on the same line.<br>
><br>
>I hope I am able to understand your concern.<br>
<br>
Aha... yes, I understand how ACLs work.<br>
<br>
But keeping the same list of ACLs in separate file is a complication.<br>
Your proposed "/special/host/file" and separate file containing:<br>
<br>
tcp_outgoing_address x.x.x.x special_hosts<br>
<br>
would be easy in case of routing requests from single list of source hosts <br>
via extra address.<br>
If those acls were more complicated, the separate file would look like:<br>
<br>
tcp_outgoing_address x.x.x.x src1 dst1<br>
tcp_outgoing_address x.x.x.x src2 dst1<br>
tcp_outgoing_address x.x.x.x src2 dst2<br>
<br>
...and I'd have to maintain two these files on two extra hosts.<br>
This is where macros/variables would make it easy for me.<br>
<br>
<br>
For now I'm speculating about using:<br>
<br>
tcp_outgoing_mark 0x10 [...]<br>
[...]<br>
<br>
iptables -t nat -A POSTROUTING -m mark --mark 0x10 -j SNAT --to-source $altsource<br>
<br>
<br>
where I can include file containing $altsource to firewall config file.<br>
<br>
<br>
-- <br>
Matus UHLAR - fantomas, <a href="mailto:uhlar@fantomas.sk" target="_blank">uhlar@fantomas.sk</a> ; <a href="http://www.fantomas.sk/" rel="noreferrer" target="_blank">http://www.fantomas.sk/</a><br>
Warning: I wish NOT to receive e-mail advertising to this address.<br>
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.<br>
Silvester Stallone: Father of the RISC concept.<br>
_______________________________________________<br>
squid-users mailing list<br>
<a href="mailto:squid-users@lists.squid-cache.org" target="_blank">squid-users@lists.squid-cache.org</a><br>
<a href="https://lists.squid-cache.org/listinfo/squid-users" rel="noreferrer" target="_blank">https://lists.squid-cache.org/listinfo/squid-users</a><br>
</blockquote></div>