squid-windows icon indicating copy to clipboard operation
squid-windows copied to clipboard

[Question] Possible to use network interface name instead of IP address?

Open Saya47 opened this issue 4 years ago • 0 comments

Greetings,

I know that when we want to specify the tcp outgoing address, we should use this line in the config:

tcp_outgoing_address 192.168.1.20

But sometimes, the IP address is not static and always changes. Checking for the new IP, editing the config with the new address, stopping and starting the Squid server takes a lot of time, is there any way to use a network interface name instead of using and IP address here? For example I wish we could use something like:

tcp_outgoing_interface Wi-Fi

Foe example, iIn these following 2 scenarios, I cannot assign a static IPv4 addresses to my network cards, thus my IP is dynamic and always changes:

  1. I share my Android phone's internet as a hotspot on the laptop. There's no way to assign a static IPv4 address to it. It doesn't accept the IP address.
  2. I use OpenVPN Connect software to connect to a VPN server using an .ovpn profile. This also doesn't accept a static IPv4 address, it doesn't honor the Windows' settings and simply uses it's own IPv4 address which changes every time I reconnect.

Thanks a lot in advance.

Edit: Here's my full config file:

acl localnet src 10.0.0.0/8	
acl localnet src 172.16.0.0/12	
acl localnet src 192.168.0.0/16	
acl localnet src fc00::/7       
acl localnet src fe80::/10      
acl SSL_ports port 443
acl Safe_ports port 80		
acl Safe_ports port 21		
acl Safe_ports port 443		
acl Safe_ports port 70		
acl Safe_ports port 210		
acl Safe_ports port 1025-65535	
acl Safe_ports port 280		
acl Safe_ports port 488		
acl Safe_ports port 591		
acl Safe_ports port 777		
acl CONNECT method CONNECT
tcp_outgoing_address 192.168.1.20
http_access allow localhost manager
http_access deny manager
http_access deny !Safe_ports
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 3128
coredump_dir /var/cache/squid
refresh_pattern ^ftp:		1440	20%	10080
refresh_pattern ^gopher:	1440	0%	1440
refresh_pattern -i (/cgi-bin/|\?) 0	0%	0
refresh_pattern .		0	20%	4320
dns_nameservers 8.8.8.8 208.67.222.222
max_filedescriptors 3200

Saya47 avatar Jun 11 '21 11:06 Saya47