0

I know that "/etc/resolv.conf" is auto generated file by "/etc/resolvconf/resolv.conf.d/head" when reboot Ubuntu 14.04. It's ok

But where i can locate same "/etc/resolvconf/resolv.conf.d/head" file in CentOS 7 ?

UPDATE

Content of file /etc/resolv.conf

# Generated by NetworkManager

search reesu.co.in

nameserver 8.8.8.8

nameserver 8.8.4.4

But i want to see content in file /etc/resolv.conf:

# Generated by NetworkManager

search domain.tld

nameserver 8.8.8.8

nameserver 8.8.4.4

OR

# Generated by NetworkManager

#search reesu.co.in

search domain.tld

nameserver 8.8.8.8

nameserver 8.8.4.4

after every reboot:

2

Did you try /etc/resolv.conf ?

In other words, resolv.conf is either generated by NetworkManager if you have it installed or you have to configure it yourself.

I've had that problem with Redhat servers where I wanted to keep NetworkManager from overwriting my static configuration of resolv.conf so I ended up setting my configuration in resolv.conf then changing the attributes to read-only like so

chattr +i /etc/resolv.conf

NOTE: you will have to do chattr -i before being able to change the content of /etc/resolv.conf in the future.

  • Content of file /etc/resolv.conf # Generated by NetworkManager search reesu.co.in nameserver 8.8.8.8 nameserver 8.8.4.4 But i want to see content in file /etc/resolv.conf: # Generated by NetworkManager search domain.tld nameserver 8.8.8.8 nameserver 8.8.4.4 OR # Generated by NetworkManager #search reesu.co.in search domain.tld nameserver 8.8.8.8 nameserver 8.8.4.4 after every reboot: – Rinku Yadav Jan 3 '15 at 8:21
  • @RinkuYadav here's your solution. It works like a charm. – Digisec Jan 3 '15 at 8:28
  • Better : i need to manually update file /etc/resolv.conf. And i will never stop VPS server. Any other better idea please share if you have. – Rinku Yadav Jan 3 '15 at 8:52
  • imagine that this is due to the hostname of the server. Please feel free to change it in /etc/hostname and /etc/sysconfig/network to domain.tld as needed. Someone told me. – Rinku Yadav Jan 3 '15 at 8:59
  • This is due to NetworkManager auto-generating the file. Why do you need to change it ? You can write a script to change it for you if you like. – Digisec Jan 3 '15 at 15:11
3

In CentOS, you add entries to:

/etc/sysconfig/network-scripts/ifcfg-eth0.

You can add up to two DNS entries in the ifcfg-eth* file as, for example:

DNS1=8.8.8.8 DNS2=4.4.4.4

Official source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.