# How do I get my DNS from DHCP?

## msulli1355

This PC has a static IP address.  I did this back in the days when there were three Linux machines running on my LAN.  Now there is one Linux machine and two Windows machines, but the Windows machines ocassionally need to connect to the Linux box because the Linux box is the only one that I use for making backups.  The past few days my Linux box has had a lot of trouble connecting to outside the LAN.  I suspect it's because of DNS.  

Here is my /etc/resolv.conf file:

michael@camille ~ $ sudo cat /etc/resolv.conf

Password: 

# Generated by net-scripts for interface eth0

nameserver 127.0.0.1

nameserver 24.116.0.53

nameserver 24.116.2.50

Here is my /etc/conf.d/net:

michael@camille ~ $ sudo cat /etc/conf.d/net

dns_domain_lo="espersunited.com"

config_eth0="192.168.0.3 netmask 255.255.255.0 brd 192.168.0.255"

routes_eth0="default via 192.168.0.1"

#dns_servers_eth0="127.0.0.1"

michael@camille ~ $ 

I have a named server running, which is why my first entry in /etc/resolv.conf is the loopback address.  The two addresses under that were chosen by the liveCD I used to install last April.  I suspect that those addresses have changed.  I want to change those addresses to addresses provided by my cable modem, but I can't seem to find any guide to tell me how to do that.  I want to keep my static IP, but I want DNS through DHCP.  Is there a way to do this, and if so, can anybody point me in the direction to finding it?

----------

## b52_

I don't think this is possible. It is either static or dhcp. I think the simplest solution is to switch to dhcp and reserve the IP for your linux box's MAC in your dhcp server.

----------

## Tony0945

Here is an example that specifies DNS but gets IP from the router. The router is configured to always give 192.168.102 to the MAC address:

 *Quote:*   

> dns_domain_lo="MsHome"
> 
> dns_domain_eth0="MsHome"
> 
> # This network configuration was written by net-setup
> ...

 

If you want the router to supply DNS, you have two choices:

1) specify the router address instead of the two WOW servers I specify.

2)comment out the dns_servers_eth0 line and remove "nodns" from the dhcp_eth0 line (i.e. dhncp_eth0="")

EDIT:  I see you said "cable modem" rather than "router", but I think it must be a combo unit. cable modem's don't usually supply DNS.

----------

## krinn

if you use a router, it is your router that will resolve dns for you with the dns of your the provider

dns_servers_eth0="192.168.0.1"

----------

## Tony0945

 *krinn wrote:*   

> if you use a router, it is your router that will resolve dns for you with the dns of your the provider
> 
> dns_servers_eth0="192.168.0.1"

 

Not necessarily. My router points to OpenDNS, but an ISP modem/router undoubtedly does points to providers DNS. Possibly so he can track you and sell the results.

----------

