Debian/Kali – Problem with writing to /etc/resolv.conf
7,177
If your /etc/resolv.conf is autogenerated by NetworkManager, it will be overwritten at many network events like DHCP-Requests. This is done by the resolvconf package. See man resolvconf
(head and tail files) for persistent change of the resolv.conf.
Related videos on Youtube
Author by
EvenDance
Updated on September 18, 2022Comments
-
EvenDance over 1 year
I want to connect to a public DNS Server (in this case Google's) by modifying the
/etc/resolv.conf
(which is automatically generated by NetworkManager). If I edit the content of the file viagedit /etc/resolv.conf
tonameserver 8.8.8.8 nameserver 8.8.4.4
(which are the IPs of Google's public DNS server), everything works fine and I do not even have DNS leaks, but if I run my Script:
#!/bin/sh echo "nameserver 8.8.8.8" > /etc/resolv.conf echo "nameserver 8.8.4.4" >> /etc/resolv.conf
It does not work and I have no Internet-Connection at all.
-
EvenDance over 7 yearsThere is no error message, the script changes the
resolv.conf
like I want to the same thing I do viagedit
, I just do not have an internet connection afterwards...:( -
Vafa over 7 yearsCould you please post the output of following commands :
ifconfig -a
andnetstat -rn
-
Anthony Geoghegan over 7 yearsIt would be useful to edit your question to show the result of
cat /etc/resolv.conf
when it's working before you run your script and after your script has run (when it's broken). -
roaima over 7 yearsWhen you "have no Internet Connection" do you really mean that? What is then the result of running
ping -c4 8.8.8.8
? If you get no result please post the output ofnetstat -rn
. But add these answers to your question; do not put them here in comments.
-