From owner-freebsd-net@FreeBSD.ORG Tue May 5 22:54:25 2009 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 6D2561065670 for ; Tue, 5 May 2009 22:54:25 +0000 (UTC) (envelope-from ccowart@rescomp.berkeley.edu) Received: from hal.rescomp.berkeley.edu (hal.Rescomp.Berkeley.EDU [169.229.70.150]) by mx1.freebsd.org (Postfix) with ESMTP id 566CA8FC08 for ; Tue, 5 May 2009 22:54:25 +0000 (UTC) (envelope-from ccowart@rescomp.berkeley.edu) Received: by hal.rescomp.berkeley.edu (Postfix, from userid 1225) id 1D4C53C05E6; Tue, 5 May 2009 15:54:25 -0700 (PDT) Date: Tue, 5 May 2009 15:54:25 -0700 From: Chris Cowart To: Giulio Ferro Message-ID: <20090505225425.GA49013@hal.rescomp.berkeley.edu> Mail-Followup-To: Giulio Ferro , freebsd-net@freebsd.org References: <4A00BE6C.5030800@zirakzigil.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <4A00BE6C.5030800@zirakzigil.org> Organization: RSSP-IT, UC Berkeley User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-net@freebsd.org Subject: Re: Configure networking outside rc.conf 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: Tue, 05 May 2009 22:54:25 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Giulio Ferro wrote: > I was wondering if there was a way to cleanly configure networking > without using rc.conf but only ifconfig and other utilities >=20 > This is what I mean: let's suppose that I have a complex network > configuration to launch on my machine, for example: > - many physical nics (with different speed, mtu, duplex...) > - many aliases on them > - many vlans > - many carped interfaces > - ng_fec > - ... >=20 > What I ask is: can I, set up networking in a way that is equivalent to > creating the configuration in /etc/rc.conf and then using > "/etc/rc.d/netif restart" ? >=20 > I know how to set up the example configuration above, what I > don't know is if I can do that cleanly, that is, cleaning the state of > all interfaces, truncating vlans, etc., and then creating them again > with ifconfig, ngctl, etc. Assuming the NICs are displayed by ifconfig -a or inserted into cloned_interfaces in /etc/rc.conf, you can create the following scripts: /etc/start_if.vlan100 /etc/stop_if.vlan100 Where start_if.vlan100 is sourced by the netif start and stop_if.vlan100 is sourced by the netif stop. For example: | ccowart dev-aux etc $ cat /etc/start_if.vlan81 | ifconfig vlan81 vlan 81 vlandev em0 | ifconfig vlan81 inet 10.81.1.1/16 I don't know that two files per interface is any cleaner than a really long /etc/rc.conf (I usually prefer the latter, but I generally am not dealing with more than 20-40 lines at most). --=20 Chris Cowart Network Technical Lead Network & Infrastructure Services, RSSP-IT UC Berkeley --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iQIcBAEBAwAGBQJKAMOgAAoJEIGh6j3cHUNPygQQAK2uqpQnSulGtFFi0O95J/eT qkV2yF1k6RLucmx2+bmYQWh7D95eAW5NUMP4klAzLh+X8+tYAKCStwY1+qB1PCeo 1AkOqvDpjHz+CEjEQlKKZ6ukamM1BCtcc3Alg3D1TSFQO4KS1jXEdnR+/rg769bc DjY7p6W2t/bagUrenxfCRGew2JvMh0X4G/oPpHuSjYC2DkNceJsGq0lEI0+/bc4t rWrXUKSdJsx3naJxUWZcfNN5sgUNd4AQHSQR6NTM4iqkUaTzNx4bt+PrzMz5m2I9 3X53Am1V+cAY5cdPbld4/f4wge8lFrVctjv6feyWDMNbI0RPjX3JjCwVNxpjt86z FsuWPTdfqvtIcwzC/zHxfdJID3+rky+6CbSOhABqcSAWSsb2+u7wTCRmY9lkHe8m nB6s3M1+pJJ3au0OzKXG5JxzRBpIbgPDLXkpTzEPPKTcSOghx1ZuwHeJNcFY/aSB cEcq/2iADEF2Bhwarja2FWsV9m36f5cw5NHdqWWSd7sqNZ29wx6wa48m1yKQRuy5 Esm5Sq66YBfq3nNUYmc8DKnWdOPiv3BZzsN+FiOh2haEnfL4g4BiCQ4sxHjjhckO yFHTxrReW1R+zW0KgRlkXdBiJYmuLFJknSaq5K9VXWWmZ1spy+V1S5iZyhLXhXgS Pf85NH1WLyrOAf/HisXT =kMQW -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9--