Hello,
The following shell script will help you to add multiple IPs to squid configuration, you need to add all the IP address which you like to configure in squid in a file called “iplist” and then execute the following script. Make sure you take a backup of your squid.conf file before executing this script.
#!/bin/bash awk '{printf "acl ip""%s \t%s\n",NR, "myip" " " $0}' iplist >> /etc/squid/squid.conf awk '{printf "tcp_outgoing_address" " " $0 " " "ip%s \t%s\n",NR,$5}' iplist >> /etc/squid/squid.conf /etc/init.d/squid restart
so that the acl will look something like the following.
acl ip1 myip xx.xx.xx.x1 tcp_outgoing_address xx.xx.xx.x1 ip1 acl ip1 myip xx.xx.xx.x2 tcp_outgoing_address xx.xx.xx.x2 ip2
That’s it. You are done. 🙂