Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 9451  / 1 Year ago, sun, december 11, 2022, 1:39:59

Im using Ubuntu server edition. In that it's configured to use ip address provided by DHCP. Now, I want to edit the resolv.conf file so that it points to the nameservers that I want to define. Obviously editing the resolv.conf file directly will not work as the changes will get overwritten. I also tried a different approch to edit /etc/resolvconf/resolv.conf.d/head and adding nameserver entries there that worked for me but it is said that it is not recommended. So I want to know how can I add nameserver entries if my machine is configured to use DHCP. I believe I will have to edit /etc/network/interfaces I tried a lot of tricks but nothing seems to work. Also is this possible to add nameserver if using DHCP?


More From » 12.10

 Answers
4

You can add new settings in /etc/network/interfaces



It will look like this:



  iface eth0 inet static
    address x.x.x.x
    netmask x.x.x.x
    gateway x.x.x.x
    dns-nameservers x.x.x.x


Read more from the official documentation


[#30191] Sunday, December 11, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
clegian

Total Points: 283
Total Questions: 115
Total Answers: 115

Location: Morocco
Member since Tue, Feb 2, 2021
3 Years ago
clegian questions
;