dhclient.conf modifications do not change resolv.conf

3k views Asked by At

When I modify my /etc/dhcp/dhclient.conf with prepended nameservers, after a network manager restart, the generated resolv.conf file does not contains these servers. I'm working on Kali Linux.

Here is my dhclient.conf

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
prepend domain-name-servers 208.67.222.222, 208.67.220.220;

After modifying it I run

service network-manager restart

And this is the output of a cat /etc/resolv.conf

# Generated by NetworkManager
nameserver 192.168.1.254
nameserver 2001:b07:a99:4d41:ead1:1bff:fe7c:75eb

With no nameservers.

2

There are 2 answers

0
Gábor On

use prepend instead of supersede

prepend domain-name-servers 127.0.0.1;

root@debian:~# grep prepend /etc/dhcp/dhclient.conf       
#prepend domain-name-servers 127.0.0.1;

root@debian:~# cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.153.2
nameserver 192.168.88.1
search localdomain

root@debian:~# grep prepend /etc/dhcp/dhclient.conf
prepend domain-name-servers 127.0.0.1;

root@debian:~# /etc/init.d/networking restart
[ ok ] Restarting networking (via systemctl): networking.service.

root@debian:~# cat /etc/resolv.conf  
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search localdomain
0
OusStack On

use proxy chain and activate the nameserver by removing # tag after this step add your nameserver info and save