Date: Mon, 8 Apr 2002 23:52:26 -0700 From: Luigi Rizzo <rizzo@icir.org> To: Nate Williams <nate@yogotech.com> Cc: arch@FreeBSD.ORG Subject: Re: proposed code: automatic setting of hostname from MAC address Message-ID: <20020408235226.B57765@iguana.icir.org> In-Reply-To: <15538.12905.744914.71228@caddis.yogotech.com> References: <20020407035941.B37911@iguana.icir.org> <15538.12905.744914.71228@caddis.yogotech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Nate, probably i did not explain it clearly.
s Garance says, the code i am proposing lets you use the same
configuration file (/etc/rc.conf) on multiple machines, instead
of having to customise it for each one.
The call to auto_set_hostname() in rc.conf will fetch the MAC address
from the first ethernet card, look it up in a database of
MAC<->hostname pairs (/etc/ethers, or /etc/hosts), and sets the
"hostname" and "ifconfig_foo0" shell variables accordingly. From
there on, rc.conf is absolutely the same as usual.
Obviously, now that hostname is not constant, you can also find
it convenient to have a " case ${hostname} in ... esac" statement
in rc.conf to customise the configuration for the different
hosts.
This is not replacing the current scheme -- you can still choose
to put
hostname="foo.bar"
ifconfig_ed0="inet 1.2.3.4 netmask 0xffffff00"
in your rc.conf. But since this is often the only significant
difference among different rc.conf, having this sorted out
automatically can be very convenient.
Examples:
+ in a site that I know, the sysadmin manages a number of
FreeBSD boxes, and whenever an OS upgrade needs to be made,
he has to push around a number of configuration files. For
the most part, they are all the same except for rc.conf
(where the difference in most cases is limited to the setting
of "hostname" and "ifconfig_foo0", and possibly /etc/fstab.
+ for things such as PicoBSD images, or "rescue" floppy/CDs,
having this code lets you use the same exact media to
come up with the correct configuration on different boxes
+ (a bit less common, though still someone might do this)
for some time I used to carry my hard disk in a removable
frame and move it between my home and office machine.
Again this code would let the OS use the correct configuration in
the different places.
Does it make more sense now ?
cheers
luigi
> For what it's worth, I think this code is of little value (and I use
> PicoBSD) code. Can you explain why you believe this code is of more
> value than simply configuring the interfaces based on their order?
...
> In my opinion, it's less flexible than the current scheme of
>
> ifconfig_ed0="inet 192.168.0.1/24"
> ifconfig_fxp0="inet 192.168.0.1/24"
>
> Or whatever in /etc/rc.conf. You're setup requires a very non-standard
> configuration file of /etc/hosts, which is still a custom configuration
> file, vs. the standard customized file in /etc/rc.conf.
>
>
>
> Nate
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020408235226.B57765>
