# Alternative rc.confs



## balanga (Oct 16, 2018)

Is it possible to have alternative rc.confs which are selectable at FreeBSD's boot menu?


----------



## Martin Paredes (Oct 17, 2018)

No from the boot menu, maybe Boot Environments with ZFS can work, but the upgrade process become complicated

What is the problem?

More info in beadm(1)


----------



## xtaz (Oct 18, 2018)

I can imagine one possible use for this is taking a laptop between different networks where you use different static IP addresses or DHCP, or IPv4/6 etc. and need a slightly different configuration for each. Similarly you might only want SSH running if you are on your own LAN rather than a public network. Or load a different set of firewall rules.

That kind of thing. You could script something up to do this for you, but I don't think there is anything already in the system which can do this.

ZFS boot environments could do this, but it would become a pain maintaining several of them.


----------



## ikbendeman (Oct 29, 2018)

You could probably do some of your own scripting to have it done post init... I don't think you'd want to do it in standard rc.conf. you could write your own script under /etc/rc.d/ or have it triggered on log-in, perhaps as a daemon, that could scan for network location by ID, or whatever method you planned on using, ifconfig up/wpa_supplicant, etc, and just have it done post login, rather than at startup, but keep in mind, you'll have to trigger other network dependent rc scripts post network config (for this example). Best way I could think of to do it.... if you read the man pages for rc, you could also possibly find a better option as far as prioritizing, etc.

Put enough work into it, you could maybe contrib to ports tree. Have you looked at PC-BSD's (or TrueOS, is it now?) solution for this and/or are you only looking to do network automation? If you're looking for more than just dhcp/ifconfig you'll be doing some deep scripting.


----------

