0

My qcow2 image uses local nameserver, 192.168.122.1 which is not working for reasons unknown.

So, I tried to use guestfish and edit the file /etc/resolv.conf to add nameservers, 8.8.8.8. This doesnt work as dhclient overwrites it.

I tried other methods, given here. Inside guestfish cli, when i try to vi edit the files, /etc/network/interfaces (or) /etc/resolvconf/resolv.conf.d/base, both the files are missing.

How can i permanently set a working nameserver in /etc/resolv.conf in the seed image?

Centos image version --- CentOS-7-x86_64-GenericCloud-20140929_01.qcow2

1
  • It seems as if fixing the problem with the libvirt-managed nameserver is going to be a more effective solution to the actual problem (because this is going to affect pretty much everything you boot in your virtual environment).
    – larsks
    Aug 9, 2015 at 3:19

1 Answer 1

1

If you want to prevent the DHCP client from overwriting /etc/resolv.conf, you can set PEERDNS=no in the appropriate network configuration file, which in your situation will probably be /etc/sysconfig/network-scripts/ifcfg-eth0. It will look something like this:

DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
USERCTL="yes"
PEERDNS="yes"
IPV6INIT="no"
PERSISTENT_DHCLIENT="1"

Just change PEERDNS="yes" to PEERDNS="no" (using, e.g., guestfish, or whatever your favorite mechanism is for modifying vm images).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .