From owner-freebsd-net@FreeBSD.ORG Fri Mar 16 00:50:00 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A5D18106564A for ; Fri, 16 Mar 2012 00:50:00 +0000 (UTC) (envelope-from ericx@ericx.net) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 223298FC0C for ; Fri, 16 Mar 2012 00:49:59 +0000 (UTC) Received: by eekd17 with SMTP id d17so2337090eek.13 for ; Thu, 15 Mar 2012 17:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericx.net; s=selector0; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=Sm3PKFyZrtTxX0k3gwauO58xkdUR6Xgc1hAzzSvu69Q=; b=OF7o3su1Bn6l/zlGIUMZNcFHqqBrS83O8IQ0I88il+sl27ZWLys1eiGOkCCTs+2/cf RUMxjj5Az3jdvWE+thYpz7N97N6QKzLFcQgw1qFKL6Lc8WZA0joswtQjbkwD2mLY7c5n qvofh6CFrTNvkAZ3o1jy8ea/4K8g6fIvgbzrc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=Sm3PKFyZrtTxX0k3gwauO58xkdUR6Xgc1hAzzSvu69Q=; b=MecKfnu2GmR4PmMrTfVZvqq2NvNuGr83vcUjtHxK89lCGDd+1YueFrvE11vDu+CbCn bDarfUSNeGgvdghWsPJYaD9kO3U/Zr8WsCRVeQnSPuU9793GtFp8GCwlZ95c6CPTNRp4 YV2dvHcPA623wA3nOkFE9nwOejqOYkFh1SqNE0H16sKIKfaJPEPkiHY2uyn3VRnPCUZ3 bqrt2cSp6bKlNVFOaeR+d2lOSqP5xL/BVdi+4QQRKsOtWdkrv9K/a4Z5JSGuH4KJv2sz HygM3JmOoNYqeowDU7vh35tjgIkLkQv7i8JPoVZBaIiej4qkDZ7MdRPhpOeKEN5ueq44 cySw== Received: by 10.213.8.197 with SMTP id i5mr39369ebi.212.1331858998904; Thu, 15 Mar 2012 17:49:58 -0700 (PDT) Received: from ?IPv6:2001:470:1f07:a3a:0:dead:d00d:ff02? ([2001:470:1f07:a3a:0:dead:d00d:ff02]) by mx.google.com with ESMTPS id y11sm12564908eem.3.2012.03.15.17.49.57 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Mar 2012 17:49:58 -0700 (PDT) Message-ID: <4F628E33.1060303@ericx.net> Date: Thu, 15 Mar 2012 20:49:55 -0400 From: "Eric W. Bates" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: freebsd-net@freebsd.org References: <4F607EDF.4010505@rdtc.ru> <4F61769B.2040809@rdtc.ru> In-Reply-To: Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit X-Gm-Message-State: ALoCoQmTr2NqISWPa76nAWftdLhXPWPxhwB9pUOtH4ChsLd2awJj4LTF7PrWttHHDp0BpI8oeUma 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 00:50:00 -0000 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 reboots) for an interface in rc.conf is: >>> ifconfig_em0="dhcp" ? >> >> Yes, thats what man rc.conf says. > > Minor correction, but the man page says 'ifconfig_em0="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="DHCP" > ifconfig_em0="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. FreeBSD rc has a clever way around this. In /etc/network.subr ifscript_up(), if the file /etc/start_if.em0 is readable, it will be dot executed. So you can put as much multi-line config info in there as you would like. e.g.: ifconfig em0 mediaopt half-duplex dhclient em0 As long as network_interfaces includes em0 (and it will be automatically included by default), then start_if.em0 will be run. Conversely, stop_if.em0 will also run when rc runs at shutdown.