From owner-freebsd-net@FreeBSD.ORG Wed Aug 18 02:12:20 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3000D1065672 for ; Wed, 18 Aug 2010 02:12:20 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id D29078FC16 for ; Wed, 18 Aug 2010 02:12:19 +0000 (UTC) Received: by qyk11 with SMTP id 11so1510698qyk.13 for ; Tue, 17 Aug 2010 19:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=cIQBamWQdMp6IbbRSTM8xldGzwKdxfXkosLrXHixn9I=; b=Zu/gYTLZX/FT2uU8lYoWxNA2XzJD49PBC6Kvc8PNwA1rl9Ocdz9DRL+k8+gl4Xples bJPV+LbOI57PEKiznMAQsU2Q+zjS62qSQ0plpLQyX2u2ZxTsjOKNoxS1MF2/s3QDdtKA QAEFVYcuOcff8ol71cdMtyEN+xDhboQXu2Vx8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=s1zGCj4AqjgGIR6EL9WfiZ7Scg3YAESzmWsYNk1RVIthfF0WABJXJ5qirQjo+RCVIB vQUsrzwdcXj0d2yfSraD8z2BSrPwhebRAMJ82g0s2lWfGeM1/upvS7mon0lTrizHn19E 75dL9D5YK7lQ1E1H8I9oQZ1pPwv2wXygNX6r8= Received: by 10.229.227.210 with SMTP id jb18mr5455973qcb.93.1282095654499; Tue, 17 Aug 2010 18:40:54 -0700 (PDT) Received: from centel.dataix.local (adsl-99-190-82-4.dsl.klmzmi.sbcglobal.net [99.190.82.4]) by mx.google.com with ESMTPS id t24sm9550854qcs.23.2010.08.17.18.40.52 (version=SSLv3 cipher=RC4-MD5); Tue, 17 Aug 2010 18:40:53 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4C6B3A22.4000803@DataIX.net> Date: Tue, 17 Aug 2010 21:40:50 -0400 From: jhell User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.8) Gecko/20100806 Lightning/1.0b1 Thunderbird MIME-Version: 1.0 To: "Julian H. Stacey" References: <201008151243.o7FCgvC7011391@fire.js.berklix.net> In-Reply-To: <201008151243.o7FCgvC7011391@fire.js.berklix.net> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Net , Zeus V Panchenko , =?ISO-8859-1?Q?I=F1igo_Ortiz_de_Urbina?= Subject: Re: startup network configuration choice X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2010 02:12:20 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/15/2010 08:42, Julian H. Stacey wrote: > Personally I have this in /etc/rc.conf, > host="mylap" ; domain="company.com" > host="mylap" ; domain="no.net" > host="mylap" ; domain="home.net" > hostname="$host.$domain" > case $hostname in #{ > "mylap.home.net") #{ > ifconfig_fxp0="inet 192.168.10.11" > # whatever other things too > ;; > "mylap.company.com") > ifconfig_fxp0="inet 10...... > ;; > ifco........ > "mylap.no.net") > ;; > esac This is not a bad configuration but lacks the ability to be booted into the right environment via a single keystroke or boot into its default. I was playing around with this idea a while back but do not really have a need for such a thing at this time as DHCP in most cases that I need it surfices for a client machine, and servers don't normally move unless the daemons carry them away. PS: do not let the daemons drink 'Red Bull'. The files that I was modifying to do just this was /etc/network.subr, /boot/beastie.4th and ultimately /etc/rc.conf. /etc/network.subr: * This needed the ability to parse kenv(1) for a variable I will call ``network_profile'' network_profile: * Initialized to an integer 0, 1, 2, 3. left unset defaulting to 0. /boot/beastie.4th: * Should be modified to contain entries that allow you to set the network_profile to the values stated above and then boot normally. /etc/rc.conf: * Would contain something similiar to what you have above but to just look at the value of network_profile and throw your ifconfig and whatever lines in its respective case statements. You might be able to set a kenv(1) variable through grub or other utilities from ports but still some modification would be needed to the beastie boot menu to allow you to change them dynamically. Another thought that had come to mind while doing the above was to create a script in /etc/rc.d that when run with keyword BEFORE NETWORK would wait for the user to press 1, 2, 3, 4 if network_profiles="YES" and then source its respective variables from /etc/netprofile.1 .2 .3 .4 and continue on its way through the rest of the configuration after a predetermined hard coded timeout. There is a ton of ways that you can go about doing this but the final approach is up to you as one does not exist in the base system at this time. Good luck & Regards, jhell,v - -- jhell,v -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMazoiAAoJEJBXh4mJ2FR+fK8IAKAO6NmMTrwmqse9mfCNw53o NU84VScWVbat97HwSP+7nfPuS9NV/VNI0jjasvNmW4nxXAUF10+Vc/ej683Juwrg Ds7t6ZaZaGxfYRHB8DFaLHnM38kwQDY+aZB2hU94/jX+OgV6KQainOQ+xjzEUxjj 9CCNHvsUP2XCKAyNhcUq9pMb8bB9QKsd10qAeaWRK2N+RPhXi4Z8IREmIB/i1A4/ nOIcuNmLwJ6qmjzIZBWEN7/WpE9AQy5IB9yu+Qqo10MyVqJWkZRqww9THOaiEv3L qRFTdQlkpQom0txV+6nA6c75rhd0P1aSlKC0X9U82aue8rQy+RfYESGHLgAoGNQ= =DFae -----END PGP SIGNATURE-----