niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
proposed code: automatic setting of hostname from MAC address
Post new topic   Reply to topic Page 1 of 1 [15 Posts] View previous topic :: View next topic
Author Message
Neil Blakey-Milner
*nix forums beginner


Joined: 10 Apr 2002
Posts: 5

PostPosted: Wed Apr 10, 2002 7:17 am    Post subject: non-variables in rc.conf (Re: proposed code: automatic setting of hostname from MAC address) Reply with quote

On Tue 2002-04-09 (22:51), Luigi Rizzo wrote:
Quote:
On Tue, Apr 09, 2002 at 08:34:03PM +0100, Nik Clayton wrote:
...
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.

Why not do this in /etc/rc.conf.local, which can be local to each
machine, with /etc/rc.conf being sitewide?

rc.conf can be local as well. My whole point is try to have
a single config file as opposed to 100 of them!

Maybe I'm being silly, but I was hoping the whole rc.conf system could
move from being "sh" and become just variables in preparation for some
as-yet-undefined changes to configuration that may be required in
future. In fact, I wrote the first step to do this and posted it a
while back (can't find it at the moment. The file name was
rc.sourceconf or something).

This move would make sysinstall and potential future configuration tools
much easier to maintain and write, since the entire "rc configuration"
can be handled by a C library (these exist already, iirc).

The alternative is to make the configuration tool include sh's
functionality, or call it externally.

Future changes (the as-yet-undefined bit) might be per-hostname/ip
configuration at around 6.0 era (or even 5.0, but I'm not in a hurry).

Abstracting the configuration away from "shell scripts and functions"
would allow us to pull the configuration in from other locations in the
"backend". The one basic example I did perform was in the order of
(replace \ns with real enters):

eval `echo 'g/^[:space:]*$/d\ng/^#/d\ng/$/s//;/\ng/./' | ed -s \!'cat /etc/rc.alternate.conf'`

Anyway, assume that we can get our network configured beforehand, and we
can then use ldap, NIS, or whatever (netinfo?) to get our configuration.

In Luigi's case, he would write a new backend that does some magic to
set (or overwrite) variables based on hostname or ip. Something that
grabs all variables prefixed with the hostname, and removes the prefix,
and then sets the variables. It could even be written in C.

Or maybe I'm thinking in entirely the wrong direction?

Neil
--
Neil Blakey-Milner
nbm@mithrandr.moria.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Luigi Rizzo
*nix forums addict


Joined: 07 Apr 2002
Posts: 72

PostPosted: Wed Apr 10, 2002 3:51 am    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

On Tue, Apr 09, 2002 at 08:34:03PM +0100, Nik Clayton wrote:
....
Quote:
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.

Why not do this in /etc/rc.conf.local, which can be local to each
machine, with /etc/rc.conf being sitewide?

rc.conf can be local as well. My whole point is try to have
a single config file as opposed to 100 of them!

cheers
luigi

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Nik Clayton
*nix forums beginner


Joined: 09 Apr 2002
Posts: 20

PostPosted: Tue Apr 09, 2002 5:34 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

On Mon, Apr 08, 2002 at 11:52:26PM -0700, Luigi Rizzo wrote:
Quote:
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.

Why not do this in /etc/rc.conf.local, which can be local to each
machine, with /etc/rc.conf being sitewide?

I've done that before and it works well.

N
--
FreeBSD: The Power to Serve http://www.freebsd.org/ (__)
FreeBSD Documentation Project http://www.freebsd.org/docproj/ \\\'',)
\/ \ ^
--- 15B8 3FFC DDB4 34B0 AA5F 94B7 93A8 0764 2C37 E375 --- .\._/_)
Back to top
Nik Clayton
*nix forums beginner


Joined: 09 Apr 2002
Posts: 20

PostPosted: Tue Apr 09, 2002 5:32 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

On Mon, Apr 08, 2002 at 08:45:02PM -0400, Garance A Drosihn wrote:
Quote:
Hmm. I did not understand Luigi's reference to /etc/hosts, but
I had assumed that the feature was similar to how MacOS 10 works.
The machine gets an IP address via DHCP (for instance), and
then sets the machine's hostname based on what DNS says is the
hostname for that IP address. That works out pretty well.

Not directly relevant to the topic at hand, but FreeBSD does this too.
Just make sure that you that you don't have a 'hostname' line in
/etc/rc.conf and dhclient will pick up whatever hostname is offered
by the DHCP server.

N
--
FreeBSD: The Power to Serve http://www.freebsd.org/ (__)
FreeBSD Documentation Project http://www.freebsd.org/docproj/ \\\'',)
\/ \ ^
--- 15B8 3FFC DDB4 34B0 AA5F 94B7 93A8 0764 2C37 E375 --- .\._/_)
Back to top
Nate Williams
*nix forums beginner


Joined: 08 Apr 2002
Posts: 4

PostPosted: Tue Apr 09, 2002 2:38 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

Quote:
Why do you define it "non standard", and call "not standard"
the config files ?
+ yes, in the picobsd version the MAC<->hostname mapping was in
/etc/hosts, but this will be moved to /etc/ethers which is the
standard place for this stuff;

/etc/ethers is for determining a network mask, not for determining a
host's IP address. Using it otherwise is non-standard.

aren't you mistaking it for /etc/networks ?

You are indeed correct. /etc/ethers does do what you've asked.


Nate

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Luigi Rizzo
*nix forums addict


Joined: 07 Apr 2002
Posts: 72

PostPosted: Tue Apr 09, 2002 2:37 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

On Tue, Apr 09, 2002 at 10:31:02AM -0600, Nate Williams wrote:
....
Quote:
Why do you define it "non standard", and call "not standard"
the config files ?
+ yes, in the picobsd version the MAC<->hostname mapping was in
/etc/hosts, but this will be moved to /etc/ethers which is the
standard place for this stuff;

/etc/ethers is for determining a network mask, not for determining a
host's IP address. Using it otherwise is non-standard.

aren't you mistaking it for /etc/networks ?

Quote:
man 5 ethers
Formatting page, please wait...Done.

ETHERS(5) FreeBSD File Formats Manual ETHERS(5)

NAME
ethers - ethernet address database

DESCRIPTION
The ethers database contains information regarding known 48-bit ethernet
addresses of hosts on an Internetwork. The data is stored in a file
called /etc/ethers in the following format:

ethernet-address fully-qualified-host-name

Items are separated by any number of blanks and/or tab characters. A
``#'' at the start of a line indicates the beginning of a comment that
extends to the end of the line. A ``+'' at the start of a line will
cause the ethers(3) library functions to use data stored in the NIS(4)
ethers.byname and ethers.byaddr maps in addition to the data in the
/etc/ethers file.

An ethernet address is expressed in ASCII form as "xMadMadMadMadMad" where x
is a hexadecimal value between 0x00 and 0xFF. The address values should
be in network order. Hostnames specified in the /etc/ethers database
should correspond to entries in the hosts(5) file.

Quote:
/etc/rc.conf *is* the method for configuring each machine. You're
changing what was previously a machine-specific file into a
machine-independant file, totally changing the way things are done. (In
a more confusing/less flexible way I might add.)

However, I don't have a better solution. What I did was rip out all of

point taken. We disagree, but that's the beauty of diversity :)

cheers
luigi

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Nate Williams
*nix forums beginner


Joined: 08 Apr 2002
Posts: 4

PostPosted: Tue Apr 09, 2002 2:31 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

Quote:
Right. It allows you to use the a custom configuration file that will
allow you to configure multiple machines with the same configuration
file, right?

I don't like it because it's non-standard, and uses a completely
non-standard configuration file.

I frankly don't understand your objection. I am just proposing to
add a few shell functions in the default scripts that users may
decide to use if they like to, or just stick to the existing
code.

Why do you define it "non standard", and call "not standard"
the config files ?
+ yes, in the picobsd version the MAC<->hostname mapping was in
/etc/hosts, but this will be moved to /etc/ethers which is the
standard place for this stuff;

/etc/ethers is for determining a network mask, not for determining a
host's IP address. Using it otherwise is non-standard.

Quote:
+ the use of a "case ${hostname} .." in rc.conf is, yes, "non standard",
but you don't have to use it, and as a matter of fact it is what lets
you handle the "slightly different configuration" for each machine
in a centralised place.

/etc/rc.conf *is* the method for configuring each machine. You're
changing what was previously a machine-specific file into a
machine-independant file, totally changing the way things are done. (In
a more confusing/less flexible way I might add.)

Quote:
However, I don't have a better solution. What I did was rip out all of
the code in my PicoBSD builds to use the stock 'rc.conf' stuff, and then
I add a customized rc.conf for each different machine I build (by hand)
that contains that machine's configuration. However, in my case, each
machine has a slightly different configuration, so I need something more
than a different ifconfig line, so my situation is obviously different
than yours.
...

Just because something is useful doesn't mean it should be added to
FreeBSD. I believe your solution has very limited usefulness beyond
your particular situation, and as such, shouldn't be added to FreeBSD.



Nate

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Luigi Rizzo
*nix forums addict


Joined: 07 Apr 2002
Posts: 72

PostPosted: Tue Apr 09, 2002 2:27 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

On Tue, Apr 09, 2002 at 09:50:04AM -0600, Nate Williams wrote:
....
Quote:
Right. It allows you to use the a custom configuration file that will
allow you to configure multiple machines with the same configuration
file, right?

I don't like it because it's non-standard, and uses a completely
non-standard configuration file.

I frankly don't understand your objection. I am just proposing to
add a few shell functions in the default scripts that users may
decide to use if they like to, or just stick to the existing
code.

Why do you define it "non standard", and call "not standard"
the config files ?
+ yes, in the picobsd version the MAC<->hostname mapping was
in /etc/hosts, but this will be moved to /etc/ethers which is the
standard place for this stuff;

+ the use of a "case ${hostname} .." in rc.conf is, yes, "non standard",
but you don't have to use it, and as a matter of fact it is what lets
you handle the "slightly different configuration" for each machine
in a centralised place.

Quote:
However, I don't have a better solution. What I did was rip out all of
the code in my PicoBSD builds to use the stock 'rc.conf' stuff, and then
I add a customized rc.conf for each different machine I build (by hand)
that contains that machine's configuration. However, in my case, each
machine has a slightly different configuration, so I need something more
than a different ifconfig line, so my situation is obviously different
than yours.
....


cheers
luigi
-----------------------------------+-------------------------------------
Luigi RIZZO, luigi@iet.unipi.it . Dip. di Ing. dell'Informazione
http://www.iet.unipi.it/~luigi/ . Universita` di Pisa
TEL/FAX: +39-050-568.533/522 . via Diotisalvi 2, 56126 PISA (Italy)
Mobile +39-347-0373137
-----------------------------------+-------------------------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Nate Williams
*nix forums beginner


Joined: 08 Apr 2002
Posts: 4

PostPosted: Tue Apr 09, 2002 1:50 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

Quote:
Nate, probably i did not explain it clearly.

I used the stuff in PicoBSD, so I'm fairly comfortable with it.

Quote:
As 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.

Right. It allows you to use the a custom configuration file that will
allow you to configure multiple machines with the same configuration
file, right?

I don't like it because it's non-standard, and uses a completely
non-standard configuration file.

However, I don't have a better solution. What I did was rip out all of
the code in my PicoBSD builds to use the stock 'rc.conf' stuff, and then
I add a customized rc.conf for each different machine I build (by hand)
that contains that machine's configuration. However, in my case, each
machine has a slightly different configuration, so I need something more
than a different ifconfig line, so my situation is obviously different
than yours.

(Replacing rc.conf is trivial by doing the copy && gunzip over top of
the MFS version by sticking a compresses copy of the customized rc.conf
on the floppy in a special directory as the examples in the past have
done.)

Quote:
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.

Unless the box needs a different configuration. Basically, you're
trying to batch configure the hosts using the exact same configuration
files, but differentiating them by MAC address. This only works if you
know the MAC addresses ahead of time, and in my case, this can change
when a piece of hardware fails, etc...

Quote:
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.

I wish this worked with PicoBSD, but it didn't. :(

Quote:
+ 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 ?

Yes, but it's not quite as bullet-proof as you let on, since you still
need to do all the MAC addresses ahead of time. So, if you replace an
ethernet card, you have to build a new customized floppy anyways.

It works well for fairly static configurations you know about ahead of
time. However, in those cases, you still need N different floppies, so
it's almost just as easy to create customized rc.conf files for each
floppy.

Just my .02 worth....



nate

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Luigi Rizzo
*nix forums addict


Joined: 07 Apr 2002
Posts: 72

PostPosted: Tue Apr 09, 2002 8:34 am    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

On Tue, Apr 09, 2002 at 01:42:49AM -0700, Terry Lambert wrote:
Quote:
Luigi Rizzo wrote:
The call to auto_set_hostname() in rc.conf will fetch the MAC address
from the first ethernet card,

I like the idea, except which etherent card is "first"?

the first one listed by "ifconfig -l" :)

In practice, in my databases i tend to put the MAC
addresses of all cards installed, so the process is
reasonably safe even if the probe order changes.

Think only broke briefly when ifconfig stopped printing
leading zeros in the MAC addresses, but this has been
fixed now.

cheers
luigi

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Terry Lambert
*nix forums Guru


Joined: 19 Mar 2002
Posts: 434

PostPosted: Tue Apr 09, 2002 6:42 am    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

Luigi Rizzo wrote:
Quote:
The call to auto_set_hostname() in rc.conf will fetch the MAC address
from the first ethernet card,


I like the idea, except which etherent card is "first"?

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Luigi Rizzo
*nix forums addict


Joined: 07 Apr 2002
Posts: 72

PostPosted: Tue Apr 09, 2002 4:52 am    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

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

Quote:
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
Back to top
Garance A Drosihn
*nix forums Guru Wannabe


Joined: 21 Mar 2002
Posts: 190

PostPosted: Mon Apr 08, 2002 10:45 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

At 6:14 PM -0600 4/8/02, Nate Williams wrote:
Quote:
Luigi Rizzo <rizzo@icir.org> wrote:

Comments ?

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.

Hmm. I did not understand Luigi's reference to /etc/hosts, but
I had assumed that the feature was similar to how MacOS 10 works.
The machine gets an IP address via DHCP (for instance), and
then sets the machine's hostname based on what DNS says is the
hostname for that IP address. That works out pretty well.

But Now that I've read his message a little closer, I see he's
talking about something else. While his code does require
a custom configuration, there still is some point to it, if
he's using it on a lot of machines. It's *one* custom image
which can be used on a hundred different machines (if you
personally are running a hundred different machines, such as
in a public-lab setting).

I must admit I haven't had a lot of time to think about the
specific implementation he's asking about, although I have the
feeling that something like it could be generally useful.

--
Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu
Senior Systems Programmer or gad@freebsd.org
Rensselaer Polytechnic Institute or drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Nate Williams
*nix forums beginner


Joined: 08 Apr 2002
Posts: 4

PostPosted: Mon Apr 08, 2002 10:14 pm    Post subject: Re: proposed code: automatic setting of hostname from MAC address Reply with quote

Quote:
as part of the PicoBSD "rc" scripts, there is some code which
determines the hostname (and IP) of a box from the MAC address
of the first ethernet interface, using /etc/hosts
as a database of known machines. The relevant code is in

src/release/picobsd/floppy.tree/etc/rc.conf.defaults

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?

Quote:
I was wondering whether, with the necessary modifications (see
NOTES), there is interest in merging this feature into the standard
startup scripts. For PicoBSD the usefulness is obvious -- being
images often resident on removable media, this lets you use the
exact same image for different machines.

How so vs. the standard way of just configuring an interface?

Quote:
I have other setups where this can be useful, e.g. I often use disks
on removable frames and move them back and forth across different
machines; or, for some centrally-administered configurations, this
mechanism can also be very useful, as it permits to centralise the
configuration to one or two files (rc.conf plus the database of
MAC<->hostnames).

Comments ?

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
Back to top
Luigi Rizzo
*nix forums addict


Joined: 07 Apr 2002
Posts: 72

PostPosted: Sun Apr 07, 2002 8:59 am    Post subject: proposed code: automatic setting of hostname from MAC address Reply with quote

Hi,
as part of the PicoBSD "rc" scripts, there is some code which
determines the hostname (and IP) of a box from the MAC address
of the first ethernet interface, using /etc/hosts
as a database of known machines. The relevant code is in

src/release/picobsd/floppy.tree/etc/rc.conf.defaults

I was wondering whether, with the necessary modifications (see
NOTES), there is interest in merging this feature into the standard
startup scripts. For PicoBSD the usefulness is obvious -- being
images often resident on removable media, this lets you use the
exact same image for different machines.

I have other setups where this can be useful, e.g. I often use disks
on removable frames and move them back and forth across different
machines; or, for some centrally-administered configurations, this
mechanism can also be very useful, as it permits to centralise the
configuration to one or two files (rc.conf plus the database of
MAC<->hostnames).

Comments ?

cheers
luigi

NOTES

1. Possible modifications include fetching the MAC-hostname
info from /etc/ethers instead of /etc/hosts, and enabling
this feature only if explicitly invoked from rc.conf
(i.e. put an 'auto_set_hostname()' call in rc.conf in place
of 'hostname=foo.bar' and make sure the procedure is run
only once even if rc.conf is sourced multiple times).

2. This code becomes mostly useful if we use, in rc.conf,
a case statement to set the configuration:

# rc.conf
auto_set_hostname()
...
case "${hostname} in
*.at.work)
defaultrouter="5.6.7.8"
sendmail_enable="YES"
;;
*.at.home)
defaultrouter="1.2.3.4"
;;
esac
...

3. Another thing (again already implemented in the PicoBSD scripts) that
helps a lot in managing multiple configurations is to have
a mechanism to overwrite, from the rc* scripts, some basic
(and short) configuration files such as resolv.conf, host.conf,
and maybe fstab. Basically you set shell variables in rc.conf to provide
the content for these files, and at some early point in /etc/rc
these variable are used to update the corresponding files in /etc



This seems to be deprecated by the current structure of rc.conf,
though it can have some good uses.
--------------------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [15 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 5:42 am | All times are GMT
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Postfix ldap and Rewriting sender email address endfx Postfix 2 Thu Apr 17, 2008 9:34 pm
No new posts recipient address restriction 3dd13 Postfix 0 Wed Mar 26, 2008 1:46 pm
No new posts Where is this code not freeing memory ? jithoosin C++ 2 Fri Jul 21, 2006 9:39 am
No new posts Where is this code not freeing memory ? jithoosin C++ 1 Fri Jul 21, 2006 9:27 am
No new posts Where is this code not freeing memory ? jithoosin C++ 1 Fri Jul 21, 2006 9:12 am

MPAA | Debt Consolidation | Magazine Subscriptions | Debt Consolidation | Bankruptcy
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2393s ][ Queries: 20 (0.0648s) ][ GZIP on - Debug on ]