Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
DNS resolve for hostnames in a network
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
1veedo
Apprentice
Apprentice


Joined: 19 Dec 2005
Posts: 152

PostPosted: Thu Jan 13, 2011 6:49 pm    Post subject: DNS resolve for hostnames in a network Reply with quote

I have names for my computers but whenever I ssh I always have to use the full IP address. If I try to run say
Code:
ssh tux
I get an error,
Code:
ssh: Could not resolve hostname tux: Name or service not known
I know of a couple solutions to this and they mostly involve static IP addresses and modifying your hosts file which would be great if I was always on the same network but I don't want to have to set up different host files for every network I join, I just want it to be dynamic.

Usually routers have dns servers so I tried adding my router to /etc/resolv.conf but it didn't seem to do anything. Is there like a refresh you have to do when you modify that file (init 2 / init 5?) or am I simply doing it wrong?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46326
Location: 56N 3W

PostPosted: Thu Jan 13, 2011 7:47 pm    Post subject: Reply with quote

1veedo,


You need the sendhost option in your /etc/conf.d/net file for dhcp.

For baselayout2/openrc the net.example flle says
Code:
# GENERIC DHCP OPTIONS
# Set generic DHCP options like so
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"

# This tells the dhcp client to release its lease when it stops, not to
# overwrite dns, ntp and nis settings, not to set a default route and not to
# send the current hostname to the dhcp server and when it starts.
# You can use any combination of the above options - the default is not to
# use any of them.


The baselayout1 syntax is slightly different. This allows the dhcp server to associate the host name with the IP address it just gave you.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1veedo
Apprentice
Apprentice


Joined: 19 Dec 2005
Posts: 152

PostPosted: Sun Jan 16, 2011 12:51 am    Post subject: Reply with quote

So I need something like
Code:
dhcp_eth0="sendhost"
?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46326
Location: 56N 3W

PostPosted: Sun Jan 16, 2011 1:11 pm    Post subject: Reply with quote

1veedo,

Try it. I can't test as my home network is all static and I use /etc/hosts
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
floppymaster
Developer
Developer


Joined: 07 Jul 2010
Posts: 222
Location: Detroit, MI, USA

PostPosted: Sun Jan 16, 2011 9:08 pm    Post subject: Reply with quote

This will only work if your router's dhcp server is actually configured to update the dns server. I have never used an off-the-shelf router, so I'm not certain this is enabled by default on most models.

In my network, I have a Linux box (Ubuntu LTS) doing my routing, dns, and dhcp. I had to configure dhcpd to send dns updates, and bind to receive them.
Back to top
View user's profile Send private message
magic919
Advocate
Advocate


Joined: 17 Jun 2005
Posts: 2182
Location: Berkshire, UK

PostPosted: Mon Jan 17, 2011 12:19 pm    Post subject: Reply with quote

I run dnsmasq on my networks to allow this kind of thing. It provides the much needed link between DHCP and DNS functions.
Back to top
View user's profile Send private message
platojones
Veteran
Veteran


Joined: 23 Oct 2002
Posts: 1597
Location: Just over the horizon

PostPosted: Mon Jan 17, 2011 11:57 pm    Post subject: Reply with quote

magic919 wrote:
I run dnsmasq on my networks to allow this kind of thing. It provides the much needed link between DHCP and DNS functions.


Thank you! I was looking for exactly that application for the past couple of weeks. I didn't want a full scale BIND install for my simple home network and personal VPN for my android phone. I hate typing in IP addresses from on my phone though. Solved my problem in 5 minutes. Awesome application. I just installed it, with no configuration and it works perfectly.
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