I have multiple qemu VMs dinamically rebooted. Each of them with DHCP in a NAT virtual network and a unique hostname. From any VM I can see that resolv.conf is using as nameserver.

I want to access a VM using hostname instead of setting a static IP configuration in each of them.

My virtual network is 192.168.122.* and I can list the interface in my host:

$ ip addr
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether fe:54:00:a4:49:cd brd ff:ff:ff:ff:ff:ff
    inet brd scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 52:54:00:40:7f:76 brd ff:ff:ff:ff:ff:ff

Adding nameserver to /etc/resolv.conf is not working. What am I doing wrong?


Adding nameserver to /etc/resolv.conf at the beginning solves the problem, but faces another: every time that host is rebooted, NetworkManager rewrites the resolv.conf file.

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.