From owner-freebsd-arch Mon Apr 8 23:52:34 2002 Delivered-To: freebsd-arch@freebsd.org Received: from iguana.icir.org (iguana.icir.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id 5C99B37B419 for ; Mon, 8 Apr 2002 23:52:28 -0700 (PDT) Received: (from rizzo@localhost) by iguana.icir.org (8.11.6/8.11.3) id g396qQN57953; Mon, 8 Apr 2002 23:52:26 -0700 (PDT) (envelope-from rizzo) Date: Mon, 8 Apr 2002 23:52:26 -0700 From: Luigi Rizzo To: Nate Williams Cc: arch@FreeBSD.ORG Subject: Re: proposed code: automatic setting of hostname from MAC address Message-ID: <20020408235226.B57765@iguana.icir.org> References: <20020407035941.B37911@iguana.icir.org> <15538.12905.744914.71228@caddis.yogotech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15538.12905.744914.71228@caddis.yogotech.com> User-Agent: Mutt/1.3.23i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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