Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

DNS resolve for hostnames in a network

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
1veedo
Apprentice
Apprentice
Posts: 152
Joined: Mon Dec 19, 2005 12:16 am

DNS resolve for hostnames in a network

  • Quote

Post by 1veedo » Thu Jan 13, 2011 6:49 pm

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: Select all

ssh tux
I get an error,

Code: Select all

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?
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Jan 13, 2011 7:47 pm

1veedo,


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

For baselayout2/openrc the net.example flle says

Code: Select all

# 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.
Top
1veedo
Apprentice
Apprentice
Posts: 152
Joined: Mon Dec 19, 2005 12:16 am

  • Quote

Post by 1veedo » Sun Jan 16, 2011 12:51 am

So I need something like

Code: Select all

dhcp_eth0="sendhost"
?
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sun Jan 16, 2011 1:11 pm

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.
Top
floppymaster
Developer
Developer
User avatar
Posts: 234
Joined: Wed Jul 07, 2010 1:05 am
Location: Detroit, MI, USA

  • Quote

Post by floppymaster » Sun Jan 16, 2011 9:08 pm

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.
Top
magic919
Advocate
Advocate
Posts: 2182
Joined: Fri Jun 17, 2005 7:31 am
Location: Berkshire, UK

  • Quote

Post by magic919 » Mon Jan 17, 2011 12:19 pm

I run dnsmasq on my networks to allow this kind of thing. It provides the much needed link between DHCP and DNS functions.
Top
platojones
Veteran
Veteran
User avatar
Posts: 1602
Joined: Wed Oct 23, 2002 10:48 pm
Location: Just over the horizon

  • Quote

Post by platojones » Mon Jan 17, 2011 11:57 pm

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.
Top
Post Reply

7 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic