tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: DHCP vs RARP?



    Date:        Sun, 5 Sep 2021 19:26:14 -0400 (EDT)
    From:        Mouse <mouse%Rodents-Montreal.ORG@localhost>
    Message-ID:  <202109052326.TAA16260%Stone.Rodents-Montreal.ORG@localhost>

  | Replicating most of the declaration just to make up for deficiencies in
  | the parser is...aesthetically offensive,

It isn't a deficiency, it is a design choice, in general it is much
more flexible.

  | (It's also annoyingly tedious to add a new address to.)

It actually isn't, it is easier - the way you'r trying to do it you need
to add a new line into the middle of the file (and pick the right place
to do it, in case you have several different groups like this).

The way it is, all you do is

  printf 'host foo%d { hardware ethernet %s; fixed-address 1.2.3.4; }' \
	$((++foocount)) "${macaddr+" >> config-file

which is much simpler - stick that in a script (or sh function) which
works out an initial value for foocount from what is already in the
file, and all you need to do is

	addmac 22:33:44:55:66:77

or perhaps
	addmac foo 22:33:44:55:66:77
and parameterise a bit more, so it can handle multiple different groupings
more easily.

Put a loop around the printf, and you can add as many mac addrs in one
command line as you like.  [And of course, add \t and \n into the printf
format string to make the results be whatever format you like best.]

  | If I end up doing much that depends on DHCP-assigned diskless booting
  | addresses, I'll probably fix this at some point.

Don't.  I used to dislike this kind of config when I first encountered
it (in some ancient bind perhaps) but with more experience I realise
just how much better it is than the old way.

kre



Home | Main Index | Thread Index | Old Index