Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-01-2011, 10:07 PM
|
#1
|
Member
Registered: Jan 2011
Location: Netherlands (Zuid Holland)
Distribution: Debian 8
Posts: 31
Rep:
|
DNSMASQ how to automatically add hostnames
I am using DNSMASQ on a Debian 5.0.6. server.
I configured DNSMASQ as DHCP server, and want it to answer local DNS requests. However, I am unable to use hostnames, and am forced to use IP addresses when pinging, opening a ssh shell on a remote server, opening a remote desktop to a windows system etcedtera.
Because I use DHCP, I can not hard code the ip addresses in the hosts file.
How do I configure DNSMASQ so that i can use hostnames for computers who get their IP addresses from DHCP.
|
|
|
01-02-2011, 04:37 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
To the best of my knowledge this happens by default, so I'd look at seeing what query you are actually sending to the dns service compared to the hostname signed by dhcp. If you use either tcpdump our add the log-queries option to dnsmasq.conf you cash see exactly what it's being requested and how it related. I've recently been caught up in what domain names are added at various parts of the process.
|
|
|
01-02-2011, 08:22 PM
|
#3
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
Quote:
Originally Posted by Axel van Moorsel
... How do I configure DNSMASQ so that i can use hostnames for computers who get their IP addresses from DHCP.
|
From http://www.thekelleys.org.uk/dnsmasq/doc.html:
Quote:
The integrated DHCP server supports static and dynamic DHCP leases ... and the names can specified by each machine or centrally by associating a name with a MAC address in the dnsmasq config file.
|
Indicates you can do what you want to do. You'll need to fix the IP addresses to the MAC addresses, & therefore to the hostnames
How recently have you read the man page? A quick scan of it indicates that:
-G, --dhcp-host=[<hwaddr>][,id:<client_id>|*][,set:<tag>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]
may be the option you need.
Warning: I haven't worked w/ dnsmasq for a couple of years & I didn't do a through read of the man page today.
Please read it for yourself, & then ask any specific questions it leaves you w/.
|
|
|
01-06-2011, 06:16 AM
|
#4
|
Member
Registered: Jan 2011
Location: Netherlands (Zuid Holland)
Distribution: Debian 8
Posts: 31
Original Poster
Rep:
|
Thanks guys for your replies. Sorry I didn't reply sooner, but I am working on several projects, and this one is not the most important right now.
Somehow the dynamic updates didn't work, so I had to work with IP addresses instead of host-names. This is a minor nuisance for server, which have fixed IP addresses, and just a little less minor for workstations. One of my minor projects is creating some scripts to access some test computers. I created a script to to test if a host is running, if not then start it with wakeonlan, and then use ssh for servers, or vncviewer for workstions to take remote control.
I solved the issue for now by hard coding the IP addresses in DNSMASQ, and in the hosts file on the DNS server, and this works fine. For the few computers I am working now this is an acceptable solution.
Of course, dynamic updates should be used in large networks, but for now I will close this thread, as I have other things on my mind.
|
|
|
01-06-2011, 06:18 AM
|
#5
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
Oh, you weren't using DNS and DHCP within dnsmasq?? You said you wanted it to do DNS in the first post?
|
|
|
01-06-2011, 07:17 AM
|
#6
|
Member
Registered: Jan 2011
Location: Netherlands (Zuid Holland)
Distribution: Debian 8
Posts: 31
Original Poster
Rep:
|
I was using DNS with DNSMASQ, and DHCP with dhcp3-server. By now I have removed dhcp3-server, and configured DNSMASQ as DHCP server. This seems to have solved the problem, because now I can ping dhcp-hosts by name. I haven't fully tested it yet, but it seems fine.
One small issue left: the host-name resolution does not work on the DNS server itself. As I probably will never use it on the server itself, I will leave it as it is.
Thanks for your support
|
|
|
01-12-2011, 09:42 AM
|
#7
|
LQ Newbie
Registered: Jan 2011
Posts: 3
Rep:
|
I am trying to do the same thing. I can report the following:
I am running an Ubuntu dnsmasq host supplying DHCP requests and DNS requests to various clients. All clients seem to be getting IP addresses correctly from DHCP server. All UBUNTU clients seem to be registering their hostnames with dnsmasq when they get their IP addresses. However, I have other CentOS clients and they DO NOT register their hostnames with dnsmasq for some reason. I'm really not sure why not, but the whole point is NOT to have to lock in a particular machine with a particular IP address, so we really don't want to have to do this. Any thoughts on the differences between the two Linux OSes?
|
|
|
01-12-2011, 10:25 AM
|
#8
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
Clients should not register with a server, that's illogical (And windowsy). If the DHCP dishes out a lease, then it should update the DNS server using tsig etc. As for the difference, I'd guess it is maybe that the hostname is not being provided as part of the DNS request?
|
|
|
01-13-2011, 08:39 AM
|
#9
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
Is there a difference between the DHCP clients on the Ubuntu & CentOS machines?
Or their configurations?
|
|
|
01-14-2011, 12:32 PM
|
#10
|
LQ Newbie
Registered: Jan 2011
Posts: 3
Rep:
|
The DHCP client on Ubuntu 10.10:
Internet Systems Consortium DHCP Client V3.1.3
The DHCP client on CentOS 5.5:
Internet Systems Consortium DHCP Client V3.0.5-RedHat
Doesn't seem like there would be much of a difference...?
|
|
|
01-15-2011, 09:55 AM
|
#11
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
How about the configuration files?
Hint: use "Code:" tags or a pastebin to post them.
|
|
|
01-18-2011, 01:36 PM
|
#12
|
LQ Newbie
Registered: Jan 2011
Posts: 3
Rep:
|
Ok, I have it working with CentOS. It seems that CentOS does not include dhclient.conf file out of the box. In that file, it is necessary to make some specifications. This file is included out of the box with an Ubuntu installation. For CentOS, it should be located in /etc/dhclient.conf The line that's necessary is:
send host-name "myHostName";
There are still a few issues, none of which are particularly high priority for me, but I should mention here:
-It appears Fedora does not use dhclient as it's default DHCP client. When I run dhclient on a Fedora 14 server, nothing happens (whereas with Ubuntu and CentOS, it has clear feedback that it is communicating with the DHCP server). Does anyone know what DHCP client Fedora uses and a) if I can change it to dhclient; and/or b) if whatever client it DOES use can send a hostname back to the DNS server upon receipt of new IP address?
-CentOS still does not receive the domain. I use these settings in the dhclient.conf file:
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope, interface-mtu, ntp-servers;
require domain-name;
So it should get domain-name, but when I type hostname --fqdn, I still only get the short hostname (myHostName), not my full domain (myHostName.my.domain).
|
|
|
All times are GMT -5. The time now is 08:25 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|