ifconfig_x0="DHCP" and ifconfig_x0_alias0="a.b.c.d"
Devin.Teske at fisglobal.com
Fri Dec 6 22:34:19 UTC 2013
On Dec 6, 2013, at 9:16 AM, Nikos Vassiliadis wrote:
> 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_alias0="inet 220.127.116.11/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_alias0="inet 18.104.22.168/24"
NOTE: See "man sysrc" for more info
Need more control? Use a shell API library...
# At the top of your rc...
# Then wherever you want...
f_sysrc_set ifconfig_net0 DHCP
f_sysrc_set ifconfig_net0_alias0 "inet 22.214.171.124/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).
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
More information about the freebsd-questions