Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Dec 2013 09:48:32 +0000
From:      Jill Patterson <jillwpatterson13@gmail.com>
To:        questions@freebsd.org
Subject:   www.freebsd.org
Message-ID:  <001a11c3a890ef8d8c04ed2b03bc@google.com>

next in thread | raw e-mail | index | archive | help
PGRpdiBkaXI9Imx0ciI+SGksPGJyPkFyZSB5b3UgaW50ZXJlc3RlZCBpbiBnZXR0aW5nIGVzdGlt
YXRlcyBvbiBkZXNpZ25pbmcgIA0KeW91ciB3ZWJzaXRlIG9yIGEgd2Vic2l0ZSByZWRlc2lnbj8g
V2UgYWxzbyBjYW4gZ2V0IHlvdSBlc3RpbWF0ZXMgb24gU0VPICANCihTZWFyY2ggRW5naW5lIE9w
dGltaXphdGlvbikgbWFya2V0aW5nIGF0IG5vIGNvc3QuIElmIHlvdSBhcmUgaW50ZXJlc3RlZCwg
IA0KcmVwbHkgYmFjayB0byB0aGlzIGVtYWlsIHdpdGggdGhlIHNlcnZpY2VzIHRoYXQgeW91IGFy
ZSBpbnRlcmVzdGVkIGluIGFuZCAgDQp3ZSB3aWxsIGdldCB5b3UgZXN0aW1hdGVzIGluIHRoZSBu
ZXh0IDI0IGhvdXJzLjxicj4NCkJlc3QgcmVnYXJkcyw8YnI+SmlsbCBQYXR0ZXJzb248YnI+U0VP
L1dFQiBTcGVjaWFsaXN0PGJyPkU6IDxhICANCmhyZWY9Im1haWx0bzpqaWxsd3BhdHRlcnNvbkBn
bWFpbC5jb20iICANCnRhcmdldD0iX2JsYW5rIj5qaWxsd3BhdHRlcnNvbkBnbWFpbC5jb208L2E+
IDxicj48YnI+PGJyPqCgoCAgDQo8YnI+oKCgoKCgoKCgoKAgU6CgIEWgIE+goKCgoKCgoKCgoCA8
YnI+U2VhcmNoIEVuZ2luZSBPcHRpbWl6YXRpb248YnI+PGJyPg0KV2UgcmVzcGVjdCB5b3VyIHBy
aXZhY3kgYW5kIHdhbnQgdG8gbWFrZSBzdXJlIHlvdSBhcmUgYXdhcmUgb2YgYSBmZXcgIA0KdGhp
bmdzLiBCeSByZXBseWluZyB0byB0aGlzIGVtYWlsLCB5b3UgYXV0aG9yaXplIG91ciBBdXN0cmFs
aWFuIGFmZmlsaWF0ZXMgIA0KdGhhdCBjYW4gaGVscCB3aXRoIHlvdXIgcHJvamVjdCB0byBjYWxs
IHlvdSBhdCB0aGUgbnVtYmVyIHlvdSBwcm92aWRlZCwgYW5kICANCnlvdSB1bmRlcnN0YW5kIHRo
YXQgdGhleSBtYXkgdXNlIGF1dG9tYXRlZCBwaG9uZSB0ZWNobm9sb2d5IHRvIGNhbGwgeW91LiBB
dCAgDQpubyB0aW1lIGFyZSB5b3UgcmVxdWlyZWQgdG8gbWFrZSBhIHB1cmNoYXNlLjxicj4NClVu
c3Vic2NyaWJlPGJyPjwvZGl2Pg0K
From owner-freebsd-questions@FreeBSD.ORG  Tue Dec 10 09:58:21 2013
Return-Path: <owner-freebsd-questions@FreeBSD.ORG>
Delivered-To: freebsd-questions@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 9A3A2F40
 for <freebsd-questions@freebsd.org>; Tue, 10 Dec 2013 09:58:21 +0000 (UTC)
Received: from mout.gmx.net (mout.gmx.net [212.227.15.15])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 338AF190A
 for <freebsd-questions@freebsd.org>; Tue, 10 Dec 2013 09:58:21 +0000 (UTC)
Received: from [192.168.68.134] ([79.110.95.2]) by mail.gmx.com (mrgmx101)
 with ESMTPSA (Nemesis) id 0M97Nh-1Virou1Nin-00COAG for
 <freebsd-questions@freebsd.org>; Tue, 10 Dec 2013 10:58:13 +0100
Message-ID: <52A6E5AC.5050100@gmx.com>
Date: Tue, 10 Dec 2013 10:58:04 +0100
From: Nikos Vassiliadis <nvass@gmx.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.1.1
MIME-Version: 1.0
To: Devin Teske <dteske@freebsd.org>
Subject: Re: ifconfig_x0="DHCP" and ifconfig_x0_alias0="a.b.c.d"
References: <52A20652.4010809@gmx.com>
 <A8804E33-3822-4092-A95B-368A799A5099@fisglobal.com>
In-Reply-To: <A8804E33-3822-4092-A95B-368A799A5099@fisglobal.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0:YoCB5XHLh4xtBK+meFUmW0kuUh/yKp4Ki1bx6VHWWZVN9d5RWJJ
 Sbi6rr9RwiTObBTi3CdElv5L0+De0Q+nkeEiLbeFBIwbnahSTKotoZLR7pL4M1vVSq0xAPM
 4cVEG6eRt+ugcuF/A76YnWtjI1jZxL4KxkZ/L0gZ6TWpm36lAlW0jW6sFfc6IIPymw5jivT
 LLL7XEV7bbRcyHNjVxkvQ==
Cc: "Teske, Devin" <Devin.Teske@fisglobal.com>,
 FreeBSD Questions <freebsd-questions@freebsd.org>
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>;
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Dec 2013 09:58:21 -0000

On 06.12.2013 23:34, Teske, Devin wrote:
>
> On Dec 6, 2013, at 9:16 AM, Nikos Vassiliadis wrote:
>
>> Hi,
>>
>> I am looking for a rc friendly way to set up an IP alias and DHCP
>> on an interface. I am after this:
>> ifconfig_net0="DHCP"
>> ifconfig_net0_alias0="inet 1.2.3.4/24"
>>
>> I ve tried some combinations found in the manual but nothing worked
>> so far...
>>
>
> What release are you on?
>
> If you're on 9.2-R or higher... there are multiple ways...
>
> First way... Use sysrc(8)...
>
> 	sysrc ifconfig_net0="DHCP"
> 	sysrc ifconfig_net0_alias0="inet 1.2.3.4/24"
>
> 	NOTE: See "man sysrc" for more info
>
> Need more control? Use a shell API library...
>
> 	# At the top of your rc...
> 	. /usr/share/bsdconfig/sysrc.subr
>
> 	# Then wherever you want...
> 	f_sysrc_set ifconfig_net0 DHCP
> 	f_sysrc_set ifconfig_net0_alias0 "inet 1.2.3.4/24"
>
> 	NOTE: Works on 9.2-R+
> 	NOTE: If you're on 11.0-C or higher, there's an API reference...
> 		see "bsdconfig includes -d sysrc" for sysrc API references
>
> However, you'll need to be aware, that if you intend to change these
> values *during* the boot process... the newly modified values may
> not take effect for the current boot, as the values are aggressively
> cached (for which there is a patch by Sir Percival to address -- see
> SVN r258894 for additional information on that).
>

Yes, it works great. Good to know about sysrc, I didn't know about it...

Sorry for the delayed answer, I was offline.

Nikos




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001a11c3a890ef8d8c04ed2b03bc>