[q&d]: Generating a squid acl arplist from dhcp.conf

Here is a quick and dirty method for creating an arplist for a squid acl rule from static dhcp.conf entries:

cat /etc/dhcp3/dhcp.conf | grep 00: | cut -d " " -f5 | cut -d ";" -f1 > /etc/squid/arplist

Lets take a closer look at a default dhcp.conf entry for static adressing:

host mypc {
hardware ethernet 00:01:02:03:04:05;
fixed-address 192.168.1.10;
}

  • grep will fish out the mac addresses with the identifier 00:
  • the first cut will reduce output to 00:01:02:03:04:05;
  • the second cut removes the semi column from the output
  • output is written into a file

If you are using customized config files, you will need to apply the command properly (duh!)

Including the acl list in your squid.conf

acl mylist arp "/etc/squid/arplist"
http_access allow
mylist