# Configuring dhclient to use adsuck



## athos (Mar 30, 2012)

Hello everyone, 

I've been trying to set this up for a while (some hours), but I just can't understand how to configure this. Adsuck is an adds blocker, wich resolves the DNS queries and blocks all the names that are in a blacklist, it also needs a regular resolv.conf in its directory. So, the first line of /etc/resolv.conf (the normal one) should always be:

```
nameserver 127.0.0.1
```

And for that, my /etc/dhclient.conf is like this:

```
prepend domain-name-servers 127.0.0.1;
```

The problem comes when I try to save the nameservers of dhclient at /var/adsuck/resolv.conf. To do that, I have read about saving and editing the file: /etc/dhclient_enter_hooks, and I have read about the make_resolv_conf() function (by the way, I didn't find any information about it at the manuals), so I set up my dhclient_enter_hooks like this:


```
make_resolv_conf(){

	echo "Setting up /var/adsuck/resolv.conf"
	echo "search $new_domain_name" > /var/adsuck/resolv.conf
	for nameserver in $new_domain_name_server
		do echo "nameserver $nameserver" >> /var/adsuck/resolv.conf
		done

}
```

But it isn't working at all. What am I doing wrong? :q
Thank you for taking your time with this.


----------



## SirDice (Mar 30, 2012)

The file is called dhclient-enter-hooks, not dhclient_enter_hooks.


----------



## athos (Mar 30, 2012)

SirDice said:
			
		

> The file is called dhclient-enter-hooks, not dhclient_enter_hooks.



Hello SirDice, I renamed adequately the file, and rebooted, but it is still not working, any idea?


----------



## athos (Apr 2, 2012)

Well, I managed to get it working, I just had to take the script outside of the make_resolv_conf() function, and rename it to dhclient-enter-hooks, as SirDice said.

Thank you :e


----------

