LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   dnsmasq doubt/question (http://www.linuxquestions.org/questions/slackware-14/dnsmasq-doubt-question-614677/)

dpballey 01-19-2008 12:11 AM

dnsmasq doubt/question
 
Hi,

This is Slackware 10 box.
I am going to implement dnsmasq as dns/dhcp on my network. Is it possible to implement static addresses on my lan with dnsmasq? If not, I will have to burn my fingers with bind.

Best Regards

salasi 01-19-2008 04:22 AM

Quote:

Originally Posted by dpballey (Post 3027799)
Hi,

This is Slackware 10 box.
I am going to implement dnsmasq as dns/dhcp on my network. Is it possible to implement static addresses on my lan with dnsmasq? If not, I will have to burn my fingers with bind.

Best Regards

This question might have been better in 'networking', however...

If you use DHCP to hand out addresses in the well established manner, they won't be static. That is, the first box to ask for an IP will get the next IP in the list to be handed out, and it (AFAIK) doesn't matter which dhcp client/servers you use, that will be the case.

However, there is a relatively simple cure. Don't use DHCP to hand out IP addresses. If you configure each client box to have a static IP it will never ask for an IP via DHCP, irrespective of which dhcp servers exist on the network. The admin in dealing with static adresses scales with the number of machines, so you might think this is a bad solution if you have several hundred of them, but my guess is that you have fewer.

In practice you might choose a scheme like the following:

Say everything is on the 192.168.1.x subnet. Allow your server and router to have 192.168.1 & .2. Start your static clients from, say, 192.168.1.10 up to 192.168.1.30 (depending on number of clients). You might then still allow the dhcp server to hand out addresses from 192.168.1.100 to .120 just in case you ever forget about the configuration and allow a machine using dhcp on to your network or maybe are using the network to supply the software to a machine for its first boot and config.

This, of course, will have litle to do with how your network is seen from the outside world, but you didn't mean that, did you?

mpier 01-19-2008 06:08 AM

Hi all,
Quote:

Originally Posted by dpballey (Post 3027799)
Hi,

Is it possible to implement static addresses on my lan with dnsmasq?

Yes it is. You can eg bind the IP to MAC address. Grep man dnsmasq for /etc/ethers or dhcp-host. If you have static arp you can use ethers file.

Sorry for my bad english...

dpballey 01-20-2008 11:48 PM

dns masq queries answered well
 
Hi,

Thanks Salasi
Thanks Mpier

Thanks for your valued inputs. Since Salasi's input seems simpler to my limited knowledge. Therefore, I shall be following his guide for implementing it as a quick solution. However, to increase / upgrade my knowledge I shall not forget to read the documentation described by Mpier.

My network is a small network of 12 machines, Salasi.

Thanks once again.

Best Regards

archtoad6 02-27-2008 09:29 AM

The trouble w/ true static IP addresses is that you must visit each box, normally physically, & set its IP address (from its console) using the tools provided by its OS. It's much easier to have your DHCP server assign fixed IP addresses based on the MAC addresses it sees. This is especially easy in dnsmasq. You can use either the /etc/dnsmasq.conf file, or the /etc/ethers file. Take mpier's excellent advice -- the man dnsmasq page is here. Also check out dnsmasq.conf.example & the /etc/ethers
man page
.

The format for the 2nd is almost trivial. The relevant section of the 1st begins:
Quote:

# Supply parameters for specified hosts using DHCP. There are lots
# of valid alternatives, so we will give examples of each. Note that
# IP addresses DO NOT have to be in the range given above, they just
# need to be on the same network. The order of the parameters in these
# do not matter, it's permissble to give name,adddress and MAC in any order
.

On a personal note, I wouldn't even use static IP's on a 2-box LAN, let alone one w/ 12. W/ fixed IP's assigned through DHCP, you can "have your cake & eat it too" -- permanent addresses & central administration.

archtoad6 02-27-2008 09:33 AM

The trouble w/ true static IP addresses is that you must visit each box, normally physically, & set its IP address (from its console) using the tools provided by its OS. It's much easier to have your DHCP server assign fixed IP addresses based on the MAC addresses it sees. This is especially easy in dnsmasq. You can use either the /etc/dnsmasq.conf file, or the /etc/ethers file. Take mpier's excellent advice -- the dnsmasq man page is here.
Also check out dnsmasq.conf.example & the /etc/ethers man page.

The format for the 2nd is almost trivial. The relevant section of the 1st begins:
Quote:

# Supply parameters for specified hosts using DHCP. There are lots # of valid alternatives, so we will give examples of each. Note that # IP addresses DO NOT have to be in the range given above, they just # need to be on the same network. The order of the parameters in these # do not matter, it's permissble to give name,adddress and MAC in any order
On a personal note, I wouldn't even use static IP's on a 2-box LAN, let alone one w/ 12. W/ fixed IP's assigned through DHCP, you can "have your cake & eat it too" -- permanent addresses & central administration.

bgeddy 02-27-2008 10:21 AM

- and then there's the hassle of setting up default routes,netmasks, name servers, broadcast addresses, ntp servers etc that can all be handed out with DHCP.

Dnsmasq is definitely the way to go in my opinion. Centralize all your IP data for easy maintenance.

As stated, a "pseudo" static IP setup can be had matching mac addresses to IP's or hostnames to IP's within dnsmasq.conf so a machine always gets the same IP via DHCP.

I have four or five boxes on my network and find that to be too many to administer individually - (I would say twelve boxes is definitely a case for DHCP). Just let dnsmasq do all the work.

dpballey 02-28-2008 07:47 AM

Thanks for your valued inputs, Senior Members.

Quote:

The trouble w/ true static IP addresses is that you must visit each box, normally physically, & set its IP address (from its console) using the tools provided by its OS.
Agreed.

Quote:

- and then there's the hassle of setting up default routes,netmasks, name servers, broadcast addresses, ntp servers etc that can all be handed out with DHCP.
Most important is assigning of default routes, nameservers,ntp servers, and thus I shall be able to control it centrally, as also advised by archtoad6.
Thanks friends for your inputs once again. The decision is in faour of dnsmasq.

Regards

archtoad6 02-28-2008 08:04 AM

Cool!

Thanks for listening, i.e. taking our advice. -- There is nothing a busy body likes better than to have their advice taken. ;)

Seriously, if you need any help w/ dnsmasq, be sure to post back here. (We're already subscribed & will be sure to see your post.)

dpballey 02-29-2008 03:24 AM

Thanks for holding my hand.
Today I tried dnsmasq. It did not assign nameservers to the client machine though it did assign IP, Netmask and Gateway.
Supposedly, dnsmasq should take the nameservers from /etc/resolv.conf (as given in /etc/dnsmasq.conf) file where I have the dns nameservers entered.

Please look at following quote. Here, since I am not assigning any other resolv-file, should dnsmasq not assign the nameservers from /etc/resolv.conf?
Quote:

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
#resolv-file=

Si, i think I have to uncomment following lines in bold?
Code:

# By  default,  dnsmasq  will  send queries to any of the upstream
# servers it knows about and tries to favour servers to are  known
# to  be  up.  Uncommenting this forces dnsmasq to try each query
# with  each  server  strictly  in  the  order  they  appear  in
# /etc/resolv.conf
#strict-order

Regards

bgeddy 02-29-2008 12:11 PM

Dnsmasq, on my setup at least, issues the IP of the machine I am running dnsmasq on as the nameserver to clients.

This writes to /etc/resolv.conf on the client machines pointing them to my local machine as dnsmasq acts as a caching dns server. The client machines look to my local machine (gateway) for dns requests - again this is the machine running dnsmasq.

The clients have "USE_DHCP='yes'" set in their /etc/rc.inet1.conf and "DHCP_KEEPRESOLV" not set (the default) for the relevant interface.

Is /etc/resolv.conf being written on your clients and if so what is being written ?

NB I have not had to make any changes to the lines you quote to get this to work. I believe those lines are to control how dnsmasq performs its lookups and not the IP it hands out via DHCP as this is its own address.

So - in a nutshell - dnsmasq is acting as the dns server for the network and forwarding requests (when necessary) to upstream servers - caching them as it goes.

evilDagmar 03-01-2008 01:19 AM

Correction...

Static addresses can be defined just fine in every DHCP server I've ever seen (with one really rinky-dink exception). Just because a host uses DHCP to get it's IP address does not necessarily mean it's IP is dynamic.

Even with ISC's dhcpd (which apparently everyone seems allergic to because it requires fifteen minutes of reading a man page) setting a static lease amounts to this much being added to the DHCP server's configuration:

Code:

group {
  host dryad {
    hardware ethernet 00:12:8e:4b:2c:a3;
    fixed-address 10.1.1.2;
  }
}


archtoad6 03-03-2008 01:21 PM

Terminology Quibble
 
Yes, I know I may be nit-picking; but I object to calling any dynamically assigned IP "static" -- my dictionary says "static" & "dynamic" are opposites. That makes "dynamically assigned static IP addresses" a real oxymoron. However permanent they are intended to be, I much prefer the term "fixed" for such IP's.

The authorities I tried to consult at best are silent or disagree w/ each other & at worst contradict themselves:
http://www.google.com/search?q=site%...+ip+address%22
http://www.google.com/search?q=site%...+ip+address%22

http://www.google.com/linux?q=%22fixed+ip+addresses%22
http://www.google.com/linux?q=%22static+ip+addresses%22

http://en.wikipedia.org/wiki/Dhcp#Applicability
http://en.wikipedia.org/wiki/Dhcp#Ba...ocol_Operation
http://en.wikipedia.org/wiki/Dhcp#IP_address_allocation
http://en.wikipedia.org/wiki/IP_addr...c_IP_addresses

http://man.linuxquestions.org/index....pe=2&section=8


Absent a consensus which I can point to here, all I can do is list the terms I prefer & hope that my preferences come from learning from authoritative sources, rather than . . . :
  1. Static IP address -- Manually set at/on the host. (permanent)
  2. Fixed IP address -- Automatically set by the DHCP server to a value from a table, usually according to MAC address. (also permanent)
  3. Sticky IP address -- Automatically set by the DHCP server from a pool, BUT the server is configured so that it will never change under normal circumstances.
  4. Dynamic IP address -- Automatically set by the DHCP server from a pool, persistence depends on various configurable server options.
  5. Volatile IP address -- Automatically set by the DHCP server from a pool, AND the server deliberately changes it periodically.
Notes
  • #1 & #2 -- these are the ones we must agree to disagree about.
  • #3 & esp. #5 are not in common use.
    • #3 is the term my ISP uses to describe its policy of long term stability for its customers who don't buy a "true" static IP.
    • #5 is my attempt to describe the policy of my former ISP, Earthlink over Time-Warner, where my IP address changed in the early morning every March 1st & Oct. 1st unless I took deliberate action to keep it from happening.
  • #4 -- At least there is one term that we all seem to use the same way.

evilDagmar 03-05-2008 12:54 AM

Quote:

Originally Posted by archtoad6 (Post 3076869)
Yes, I know I may be nit-picking; but I object to calling any dynamically assigned IP "static" -- my dictionary says "static" & "dynamic" are opposites. That makes "dynamically assigned static IP addresses" a real oxymoron. However permanent they are intended to be, I much prefer the term "fixed" for such IP's.

So you can try to make up your own terminology if you like, but to the rest of the world it doesn't matter whether or not a machine has a static IP assignment configured in shell scripts or obtained through DHCP. The result is the same, either way. One mechanism (DHCP) is just much, much more manageable than the other.

As to item #5, such things are not only contrary to the spirit of DHCP, but have been cautioned against many, many times because they result in, among other things, broken downloads and a lot of calls to tech support (Win98 used to be much less than reliable about taking on a new IP address).


When in doubt, just read the RFCs.

archtoad6 03-05-2008 06:43 AM

Which RFC's? I'd like to see the authoritative sources for the terminology. I spent at least one fruitless hour searching before my last post.


All times are GMT -5. The time now is 07:05 AM.