# Dns correct sequency in /etc/resolv.conf



## BsDjUsTbSd (May 16, 2020)

Hello,

in /etc/resolv.conf should  i put ipv6 and then ipv4 with nameserver or ipv4 first and ipv6.
or it doesn't matter?


----------



## Phishfry (May 16, 2020)

Whether /etc/resolv.conf is even needed to be setup is depending on your connection type.
DHCP connections use the resolvconf service to store settings in /etc/resolv.conf
So unless you use static IP on your ethernet interface this step is not even needed.
/etc/resolv.conf is automatically populated on DHCP connections.

The ordering of /etc/resolv.conf does not matter to answer your question.
Only if you have two identical keywords does it matter.
For instance:

```
nameserver 1.1.1.1
nameserver 8.8.8.8
```
In this case the first value is used first and waits 5 seconds before moving to the second value if no connection is available on the first value.

```
options timeout:1
```
This would reduce the keyword value to one second before rolling over to the second value.

You only need to use this to override your DHCP server settings on individual machines.
Like changing the DNS nameserver.

So it goes like this.
`dhclient` receives the information from the DHCP server and passes it to `resolvconf` which stores the info in /etc/resolv.conf.


----------



## frakswe (May 17, 2020)

damn fine explanation Phishfry


----------



## BsDjUsTbSd (May 17, 2020)

`The ordering of /etc/resolv.conf does not matter to answer your question.`
Thanks for actually answering my question


----------



## T-Daemon (May 17, 2020)

Phishfry said:


> /etc/resolv.conf is automatically populated on DHCP connections.


To prevent auto-populating and overwriting create /etc/resolvconf.conf , set `resolvconf=NO` . resolvconf.conf(5)


----------

