DEV Community

technonotes-hacker
technonotes-hacker

Posted on

/etc/resolv.conf --> gets changed after the restart

  • After surfing the internet , found --> its due to one parameter.
  • its nothing but PEERDNS.

Definition

The ifcfg parameter PEERDNS determines if the file /etc/resolv. conf is modified or not. If it is set to "yes", then the parameters DOMAIN, DNS1 and DNS2 will be used to set the search and nameserver entries in the file. If PEERDNS is set to "no", the file is not modified.

  • Lets add and check,
$ cat /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
DEVICE=eth1
BOOTPROTO=dhcp
PEERDNS=no
Enter fullscreen mode Exit fullscreen mode
  • By default (so without further configuration/modification) overwrite /etc/resolv.confas soon as any network interfaces use DHCP. Depending on the exact version if initscripts/NetworkManager, "RESOLV_MODS=no" or "PEERDNS=no" in the relevant /etc/sysconfig/network-scripts/ifcfg-* files can prevent this.

  • Implementation Pending.

Reference

https://support.hpe.com/hpesc/public/docDisplay?docId=kc0110350en_us&docLocale=en_US

https://serverfault.com/questions/934641/my-etc-resolv-conf-is-getting-reset-every-time-i-restart-the-network

Image description

Top comments (0)