Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Dec 2013 22:34:16 +0000
From:      "Teske, Devin" <Devin.Teske@fisglobal.com>
To:        Nikos Vassiliadis <nvass@gmx.com>
Cc:        Devin Teske <dteske@freebsd.org>, "Teske, Devin" <Devin.Teske@fisglobal.com>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: ifconfig_x0="DHCP" and ifconfig_x0_alias0="a.b.c.d"
Message-ID:  <A8804E33-3822-4092-A95B-368A799A5099@fisglobal.com>
In-Reply-To: <52A20652.4010809@gmx.com>
References:  <52A20652.4010809@gmx.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Dec 6, 2013, at 9:16 AM, Nikos Vassiliadis wrote:

> Hi,
>=20
> 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=3D"DHCP"
> ifconfig_net0_alias0=3D"inet 1.2.3.4/24"
>=20
> I ve tried some combinations found in the manual but nothing worked
> so far...
>=20

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=3D"DHCP"
	sysrc ifconfig_net0_alias0=3D"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).
--=20
Devin

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A8804E33-3822-4092-A95B-368A799A5099>