Skip to content

Instantly share code, notes, and snippets.

@suntong suntong/
Last active Jul 18, 2019

What would you like to do?

Configure dbab

The dbab best works with a second static IP address. To configure dbab (and to work with a local web server):

  1. Stop dbab-svr service
  2. Change the IP address that dbab uses to the second IP address
  3. Start dbab-svr service
  4. Start your local web server again if you have any. You may need to limit its listening port from to your first static IP as well if necessary.

In details, do the following as root, again assuming that the server's own IP address is, and its second IP is The second IP will be used for the dbab pixelserv service, while server's own IP address will be used for WPAD.

# (run the following as root)

# stop dbab service
/etc/init.d/dbab stop

# use the second IP for dbab-svr to listens on
ip -f inet addr show eth0 | awk '/inet /{print $2}' | sed 's|/.*$||; 1d' | sudo tee /etc/dbab/dbab.addr
# verify its content before moving on
cat /etc/dbab/dbab.addr
# if it is not what you intent it to be, correct it with your text editor
  # or, set it manually (with a different IP address)
  echo | sudo tee /etc/dbab/dbab.addr

# update ad blocking list with the second IP address 

# OPTIONAL! do the following only if you have squid caching server
# and you want to enable automatic WPAD service
hostname | tee /etc/dbab/dbab.proxy
  # NB, if your squid caching server is on a different server, do this instead
  echo my_squid_server_name | tee /etc/dbab/dbab.proxy
# then, 
# Again verify everything here before moving on because script might not be
# 100% time correct. Manually tweaking is inevitable sometimes.

# restart DNS & DHCP
systemctl restart dnsmasq

# Verify dnsmasq ads blocking is working
$ dig +short

# re-start dbab service
/etc/init.d/dbab start

# Verify dbab pixelserv server is working
# do the following on command line or visit from browswer
$ curl -s --dump-header -
HTTP/1.1 200 OK
Content-type: image/gif
Accept-ranges: bytes
Content-length: 43

# re-start your local web server again if you have any

# optional, only when dbab will not auto start on boot up
update-rc.d dbab defaults

That's it. We're done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.