# Problem with /etc/resolv.conf

## Fissile

Hi guys, just got gentoo up and running and everything is perfect for the most part. I am running into a slight problem with getting the internet working every time I reboot. It would seem my /etc/resolv.conf file only contain one uncommented line that is: 

```
domain <mydomainname>
```

and that is it. Everytime I reboot i have to 

```
echo nameserver 192.168.0.1 >> /etc/resolv.conf (x 2)
```

Is there any way to make this change permanent?

Thank you.

Muq

----------

## UberLord

You probably set dns_domain or dns_search in conf.d/net

You should also set dns_servers there as well.

----------

## Fissile

HI,

Alright so my conf.d/net is:

```
dns_domain_lo="universe"

config_eth0=( "dhcp" )

dhcp_eth0="nodns nontp nonis"

```

so i should do what exactly? I am kind of new at this.

----------

## truc

 *Fissile wrote:*   

> HI,
> 
> Alright so my conf.d/net is:
> 
> ```
> ...

 

I'd say, try this first, you probably don't need the other lines if you "borrowed" them from someone else

```
#dns_domain_lo="universe"

config_eth0=( "dhcp" )

#dhcp_eth0="nodns nontp nonis"

```

----------

## Fissile

Humm, I am sorry. Now i am confused. That is what I have

```
dns_domain_lo="universe"

config_eth0=( "dhcp" )

dhcp_eth0="nodns nontp nonis" 
```

I guess all i need to know is how do I prevent my /etc/resolv.conf from being reseted to just "domain universe" and not have to manually add "nameserver 192.168.0.1" everytime I reboot.

----------

## MostAwesomeDude

 *Fissile wrote:*   

> Humm, I am sorry. Now i am confused. That is what I have
> 
> ```
> dns_domain_lo="universe"
> 
> ...

 

Comment out the domain and dhcp options:

```
# dns_domain_lo="universe"

config_eth0=( "dhcp" )

# dhcp_eth0="nodns nontp nonis" 
```

The domain option is screwing up your /etc/resolv.conf, and the dhcp custom options are keeping it from regenerating correctly.

----------

## Apopatos

I have the same problem but my conf.d/net file says:

```
dns_domain_lo="gentoo"

config_eth0=( "10.0.0.139 netmask 255.255.255.0" )

routes_eth0=( "default via 10.0.0.138" )
```

is it something wrong with it and it changes my resolv.conf every time I boot?

----------

## crauley

 *Fissile wrote:*   

> HI,
> 
> Alright so my conf.d/net is:
> 
> ```
> ...

 

Try adding this to conf.d/net:

```

dhcpcd_eth0="-R"

```

From the man page:

```

       -R     Prevents dhcpcd from replacing /etc/resolv.conf or using resolv-

              conf.

```

----------

## UberLord

Maybe someone could donate better documentation   :Rolling Eyes: 

But if you specify dns_domain then it will overwrite /etc/resolv.conf with the options you have specified.

So if you only specify dns_domain_lo="foo" and restart the lo interface it will put "domain foo" in /etc/resolv.conf and remove everything else.

Let me put it another way - you probably don't need to specify a domain there. Ask yourself why you need it and what it's for.

----------

## sing_ecgroup

Have you tried to add these 2 lines to conf.d/net 

dns_servers_ESSID=( "192.168.0.1" "192.168.0.2" )

dns_domain_ESSID="some.domain"

----------

