# Networkmanager and resolv.conf

## haneulso

I have to write down dns in /etc/resolv.conf.

But, I have a problem with NetworkManager, becouse every time it overwrites resolv.conf without dns.

How can I fix it?

----------

## ltboy

Pretty much everything network related overwrites resolv.conf. only way to make it stay is to enable the extended attributes for your filesystem and set the file as static, but that's just hackish and not really a solution.

probably best way would be to use your NetworkManager client to set the DNS values on a per network basis. After that just ignore resolv.conf.

----------

## Jaglover

Is it a laptop and you have to connect it in different places and different ways?

----------

## haneulso

It's a laptop.

And I have to connect to network at different places and different setting.

----------

## UberLord

Current NetworkManager should support resolvconf, so emerge openresolv  :Smile: 

----------

## john.peterson1982

DHCP overwrites resolv.conf. Use /etc/dhcp3/dhclient.conf to list "permanent" DNS nameservers. For example, the prepend command will put your nameservers ahead of any obtained through DHCP. The append command will put them after any obtained through DHCP.

For example:

prepend nameservers x.x.x.x, y.y.y.y, z.z.z.z;

----------

## UberLord

 *john.peterson1982 wrote:*   

> DHCP overwrites resolv.conf. Use /etc/dhcp3/dhclient.conf to list "permanent" DNS nameservers. For example, the prepend command will put your nameservers ahead of any obtained through DHCP. The append command will put them after any obtained through DHCP.
> 
> For example:
> 
> prepend nameservers x.x.x.x, y.y.y.y, z.z.z.z;

 

That won't work as NetworkManager supplies dhclient it's own automatically generated config.

----------

## Dagger

You can add your own DNS settings in nm-applet (gnome) and networkmanager-applet (kde - currently still only in kde-testing) clients on per-connection basic.

As Uberlord suggested - openresolv can solve all your DNS problems. Just reinstall NetworkManager with resolvconf use flag.

----------

