View previous topic :: View next topic |
Author |
Message |
1veedo Apprentice
Joined: 19 Dec 2005 Posts: 152
|
Posted: Thu Jan 13, 2011 6:49 pm Post subject: DNS resolve for hostnames in a network |
|
|
I have names for my computers but whenever I ssh I always have to use the full IP address. If I try to run sayI 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 |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54808 Location: 56N 3W
|
Posted: Thu Jan 13, 2011 7:47 pm Post subject: |
|
|
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 |
|
|
1veedo Apprentice
Joined: 19 Dec 2005 Posts: 152
|
Posted: Sun Jan 16, 2011 12:51 am Post subject: |
|
|
So I need something like Code: | dhcp_eth0="sendhost" | ? |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54808 Location: 56N 3W
|
Posted: Sun Jan 16, 2011 1:11 pm Post subject: |
|
|
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 |
|
|
floppymaster Developer
Joined: 07 Jul 2010 Posts: 231 Location: Detroit, MI, USA
|
Posted: Sun Jan 16, 2011 9:08 pm Post subject: |
|
|
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 |
|
|
magic919 Advocate
Joined: 17 Jun 2005 Posts: 2182 Location: Berkshire, UK
|
Posted: Mon Jan 17, 2011 12:19 pm Post subject: |
|
|
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 |
|
|
platojones Veteran
Joined: 23 Oct 2002 Posts: 1602 Location: Just over the horizon
|
Posted: Mon Jan 17, 2011 11:57 pm Post subject: |
|
|
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 |
|
|
|