From owner-freebsd-net@FreeBSD.ORG Fri Mar 16 15:39:59 2012 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 A93381065674 for ; Fri, 16 Mar 2012 15:39:59 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id 528428FC12 for ; Fri, 16 Mar 2012 15:39:58 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.4/8.14.4) with ESMTP id q2GFcwQJ091412; Fri, 16 Mar 2012 10:38:58 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.4/8.14.4/Submit) id q2GFcvCO091411; Fri, 16 Mar 2012 10:38:57 -0500 (CDT) (envelope-from brooks) Date: Fri, 16 Mar 2012 10:38:57 -0500 From: Brooks Davis To: "Eric W. Bates" Message-ID: <20120316153857.GB81115@lor.one-eyed-alien.net> References: <4F607EDF.4010505@rdtc.ru> <4F61769B.2040809@rdtc.ru> <4F628E33.1060303@ericx.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aVD9QWMuhilNxW9f" Content-Disposition: inline In-Reply-To: <4F628E33.1060303@ericx.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@freebsd.org Subject: Re: Use of network_interfaces in 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: Fri, 16 Mar 2012 15:39:59 -0000 --aVD9QWMuhilNxW9f Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 15, 2012 at 08:49:55PM -0400, Eric W. Bates wrote: > On 3/15/2012 7:27 PM, Kevin Oberman wrote: > > 2012/3/14 Eugene Grosbein: > >> 15.03.2012 06:33, hiren panchasara ?????: > >> > >>> network_interfaces is basically historic rudiment > >>> used in 2.2.x FreeBSD version and alike. > >>> > >>> In general, you should not use it in modern version at all. > >>> > >>> > >>> Thanks Eugene. > >>> > >>> So, the only way to specify boottime configuration (that survives reb= oots) for an interface in rc.conf is: > >>> ifconfig_em0=3D"dhcp" ? > >> > >> Yes, thats what man rc.conf says. > > > > Minor correction, but the man page says 'ifconfig_em0=3D"DHCP". It may > > not be case sensitive, but I have always uded CAPS like the man page > > specifies. Also, I usually end up specifying SYNCDHCP to avoid having > > something else that requires network starting before the interface is > > configured. > > > > Of course, ifconfig_* may have any valid ifconfig argument in it, but > > remember the rc.conf is shell, so you must put all of the definition > > in a single statement. You can't do: > > ifconfig_em0=3D"DHCP" > > ifconfig_em0=3D"mediaopt half-duplex" > > That will not do DHCP, so hte interface will not come up. Of course, > > you can concatinate a second entry to the first using normal sh > > syntax. >=20 > FreeBSD rc has a clever way around this. In /etc/network.subr=20 > ifscript_up(), if the file /etc/start_if.em0 is readable, it will be dot= =20 > executed. So you can put as much multi-line config info in there as you= =20 > would like. e.g.: >=20 > ifconfig em0 mediaopt half-duplex > dhclient em0 >=20 > As long as network_interfaces includes em0 (and it will be automatically= =20 > included by default), then start_if.em0 will be run. Conversely,=20 > stop_if.em0 will also run when rc runs at shutdown. On many cases you can simply use: ifconfig_em0=3D"DHCP mediaopt half-duplex" While DHCP is not an actual ifconfig option we strip it from the list (along with several other psuedo-arguments) and pass the remainder to ifconfig. Not all option will work this way, but I believe mediaopt does. -- Brooks --aVD9QWMuhilNxW9f Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFPY16RXY6L6fI4GtQRAo6yAJoDTKxzZHbNW80gpf2u6lb1LwsYuwCfQtyP Rnzw1llBrC4l4NjgUlNHTAY= =Whaq -----END PGP SIGNATURE----- --aVD9QWMuhilNxW9f--