Stacked Runlevels

From Funtoo
Revision as of 00:21, 13 March 2014 by Daniel Robbins (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

It is common for a laptop user to use DHCP most of the time; however, they may also need to periodially connect to network where a static network configuration is required. This is a situation where a Funtoo Linux machine will require multiple network configurations. Funtoo Linux supports this.

The recommended approach for doing this is to use multiple, stacked runlevels. To do this, you will need to create two new runlevels which are children of the default runlevel. This can be done like this:

# install -d /etc/runlevels/static
# install -d /etc/runlevels/dynamic

Two new runlevels, static and dynamic, have now been created. Now, we will make these runlevels children of the default runlevel using the following commands:

# rc-update --stack add default static
# rc-update --stack add default dynamic

Now, the runlevels static and dynamic will consist of anything in default plus any additional scripts you add to each new runlevel.

To complete our multiple network configuration, we would now do something like this:

# rc-update add netif.eth0 static
# rc-update add dhcpcd dynamic

To switch to or between each runlevel, we would type:

# rc static


# rc dynamic

If we wanted to boot into dynamic by default, this could be done by editing /etc/inittab and modifying this line:

l3:3:wait:/sbin/rc default

To read as follows:

l3:3:wait:/sbin/rc dynamic