Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Dec 2013 22:34:16 +0000
From:      "Teske, Devin" <>
To:        Nikos Vassiliadis <>
Cc:        Devin Teske <>, "Teske, Devin" <>, FreeBSD Questions <>
Subject:   Re: ifconfig_x0="DHCP" and ifconfig_x0_alias0="a.b.c.d"
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

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=3D"DHCP"
> ifconfig_net0_alias0=3D"inet"
> 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=3D"DHCP"
	sysrc ifconfig_net0_alias0=3D"inet"

	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"

	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).

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: <>