# preventing net-scripts from modifying resolv.conf?

## jeffk

My server's resolv.conf is being modified by net-scripts, even though I use static IPs:

```
# cat /etc/resolv.conf 

# Generated by net-scripts for interface lo

domain acme.com
```

The onboard nic:

```
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)

# lsmod | grep 816

r8169                  24196  0 

mii                     4160  1 r8169
```

was troublesome during initial Gentoo build-out, so the dhcp_eth0 line added during that troubleshooting is likely the cuprit:

```
# cat /etc/conf.d/net

dns_domain_lo="acme.com"

dhcp_eth0="nodns nontp nonis"

config_eth0=( "1.2.3.20 netmask 255.255.255.(snip) brd 1.2.3.255"

              "1.2.3.21 netmask 255.255.255.(snip) brd 1.2.3.255"

              (...)

              "1.2.3.31 netmask 255.255.255.(snip) brd 1.2.3.255")

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

I do not have any dhcp packages installed, AFAICT:

```
# emerge -s dhcp       

Searching...    

[ Results for search key : dhcp ]

[ Applications found : 9 ]

 

*  app-vim/dhcpd-syntax

      Latest version available: 20030825

      Latest version installed: [ Not Installed ]

      Size of files: 2 kB

      Homepage:      http://www.vim.org/scripts/script.php?script_id=744

      Description:   vim plugin: syntax highlighting for dhcpd.conf

      License:       as-is

*  net-analyzer/dhcpdump

      Latest version available: 1.8

      Latest version installed: [ Not Installed ]

      Size of files: 10 kB

      Homepage:      http://www.mavetju.org/unix/general.php

      Description:   DHCP Packet Analyzer/tcpdump postprocessor

      License:       BSD-2

*  net-misc/dhcp

      Latest version available: 3.1.1

      Latest version installed: [ Not Installed ]

      Size of files: 779 kB

      Homepage:      http://www.isc.org/products/DHCP

      Description:   ISC Dynamic Host Configuration Protocol

      License:       isc-dhcp

*  net-misc/dhcpcd

      Latest version available: 4.0.7

      Latest version installed: [ Not Installed ]

      Size of files: 51 kB

      Homepage:      http://roy.marples.name/projects/dhcpcd

      Description:   A DHCP client

      License:       BSD-2

*  net-misc/dhcping

      Latest version available: 1.2

      Latest version installed: [ Not Installed ]

      Size of files: 73 kB

      Homepage:      http://www.mavetju.org/unix/general.php

      Description:   Utility for sending a dhcp request to a dhcp server to see if it is responding.

      License:       BSD

*  net-misc/dhcpv6

      Latest version available: 1.0.22

      Latest version installed: [ Not Installed ]

      Size of files: 685 kB

      Homepage:      https://fedorahosted.org/dhcpv6/

      Description:   Server and client for DHCPv6

      License:       GPL-2

*  net-misc/selfdhcp

      Latest version available: 0.2a

      Latest version installed: [ Not Installed ]

      Size of files: 158 kB

      Homepage:      http://selfdhcp.sourceforge.net

      Description:   a small stealth network autoconfigure software.

      License:       GPL-2

*  net-misc/udhcp [ Masked ]

      Latest version available: 0.9.9_pre20041216-r4

      Latest version installed: [ Not Installed ]

      Size of files: 41 kB

      Homepage:      http://udhcp.busybox.net/

      Description:   udhcp Server/Client Package

      License:       GPL-2

*  sec-policy/selinux-dhcp [ Masked ]

      Latest version available: 20080525

      Latest version installed: [ Not Installed ]

      Size of files: 328 kB

      Homepage:      http://www.gentoo.org/proj/en/hardened/selinux/

      Description:   SELinux policy for dhcp server

      License:       GPL-2
```

Since the server is offsite, I only have limited opportunities to update the networking configuration. I'm gathering information for experiments next time I'm at the server's location.

I will of course try removing any mention of dhcp_eth0 in /etc/conf.d/net.  If that doesn't work or presents problems with this particular NIC, Are there any other options that would direct net-scripts to leave /etc/resolv.conf unaltered?

----------

## qubix

You sure can remove the "dhcp" line, as you don't use dhcp client anymore.

I recon, that it's being updated, because you've put >>dns_domain_lo="acme.com" << into your /etc/conf.d/net. If you take that out, resolv.conf should stop being updated.

But if you want to have that acme.com being put in, than you might want to add line:

```

dns_servers_eth0=" IP's of your dns servers here "

```

in order to update your resolv.conf with IP's of required DNS servers. Other variables like "search" are also available, be sure to check out /etc/conf.d/net.examples

Regards!

----------

## UberLord

dns_domain_lo="acme.com" 

That line modifies /etc/resolv.conf

So remove it from /etc/conf.d/net

----------

