-1

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.

Marchinka
  • 23
  • 2
  • 8
  • 1
    Please note that Stack Overflow is for programming questions and not general computing issues. Please review [What topics can I ask here?](https://stackoverflow.com/help/on-topic) for more details. Question may be appropriate for [Super User](http://superuser.com) or [Unix & Linux](http://unix.stackexchange.com) but do check their help before posting. – kaylum Mar 25 '20 at 23:03

2 Answers2

0

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
Gábor
  • 371
  • 3
  • 8
0

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

OusStack
  • 13
  • 1
  • 6