To block ip addresses with Varnish edit the following file:
sudo nano /etc/varnish/default.vcl
And add the following. Of course replace the example ip addresses with the real ips you want to block.
After editing, execute:
sudo service varnish restart