Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do I get my DNS from DHCP?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
msulli1355
Apprentice
Apprentice


Joined: 24 Nov 2005
Posts: 179
Location: OKlahoma, USA

PostPosted: Fri Nov 20, 2015 4:50 pm    Post subject: How do I get my DNS from DHCP? Reply with quote

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?
Back to top
View user's profile Send private message
b52_
n00b
n00b


Joined: 14 Nov 2003
Posts: 50
Location: Germany

PostPosted: Fri Nov 20, 2015 11:09 pm    Post subject: Reply with quote

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.
_________________
May the source be with you!
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2886
Location: Illinois, USA

PostPosted: Fri Nov 20, 2015 11:53 pm    Post subject: Reply with quote

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
config_eth0="dhcp"

# Prefer wpa_supplicant over wireless-tools
#modules="wpa_supplicant"

#We want to pick our own DNS server instead of defaulting to 192.168.0.1
dhcp_eth0="nodns"

#WOW! servers
dns_servers_eth0="64.233.207.2 64.233.207.16"


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.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 6968

PostPosted: Sat Nov 21, 2015 7:59 am    Post subject: Reply with quote

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"
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2886
Location: Illinois, USA

PostPosted: Sat Nov 21, 2015 3:41 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum