Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Stacked Runlevels/pt-br

From Funtoo
< Stacked Runlevels
Revision as of 20:47, June 21, 2015 by Tocadotux (talk | contribs) (Created page with "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. Th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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:

root # install -d /etc/runlevels/static
root # 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:

root # rc-update --stack add default static
root # 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:

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

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

root # rc static

Or:

root # 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