From owner-freebsd-hackers Tue Nov 19 10: 5:39 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FD7737B401 for ; Tue, 19 Nov 2002 10:05:38 -0800 (PST) Received: from cfcl.com (cpe-24-221-172-174.ca.sprintbbd.net [24.221.172.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2270743E88 for ; Tue, 19 Nov 2002 10:05:38 -0800 (PST) (envelope-from rdm@cfcl.com) Received: from [192.168.254.205] ([192.168.254.205]) by cfcl.com (8.12.6/8.11.1) with ESMTP id gAJI6Bhe053089 for ; Tue, 19 Nov 2002 10:06:12 -0800 (PST) (envelope-from rdm@cfcl.com) Mime-Version: 1.0 Message-Id: In-Reply-To: <200211191517.17242.l.s.r@web.de> References: <200211191517.17242.l.s.r@web.de> X-Mailer: Eudora for Macintosh! Date: Tue, 19 Nov 2002 10:03:25 -0800 To: hackers@FreeBSD.ORG From: Rich Morin Subject: Re: auto-definition of a single network interface Content-Type: text/plain; charset="iso-8859-1" ; format="flowed" Content-Transfer-Encoding: quoted-printable Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 3:17 PM +0100 11/19/02, Ren=E9 Scharfe wrote: >OK, perhaps this can be made even simpler. Put this into your /etc/rc.conf >and be done: > > # a hack to ease the configuration of machines with only one NIC > _single=3D`ifconfig -l link` > eval ifconfig_${_single}=3D"inet 192.168.254.193 netmask 255.255.255.0" > eval ifconfig_${_single}_alias0=3D"inet 192.168.254.199 netmask 255.255.= 255.0" One of the nice things about FreeBSD's rc.conf approach is that it moves a large number of declarations out of assorted scripts, putting them into a set of "declarative" files. While these files technically contain code, I've never seen them contain anything other than "var=3Dval" statements. I am therefore loathe to suggest any hack that starts putting executable code in these files. I am also concerned about making the system too "brittle"; it should handle error conditions as cleanly as possible. So, while this is definitely a cute hack, I would not recommend it for general use. -r -- email: rdm@cfcl.com; phone: +1 650-873-7841 http://www.cfcl.com/rdm - my home page, resume, etc. http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc. http://www.ptf.com/dossier - Prime Time Freeware's DOSSIER series http://www.ptf.com/tdc - Prime Time Freeware's Darwin Collection To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message