Difference between revisions of "Stacked Runlevels"

 
(2 intermediate revisions by 2 users not shown)
Line 23: Line 23:
 
If we wanted to boot into <tt>dynamic</tt> by default, this could be done by editing <tt>/etc/inittab</tt> and modifying this line:
 
If we wanted to boot into <tt>dynamic</tt> by default, this could be done by editing <tt>/etc/inittab</tt> and modifying this line:
  
{{File
+
<pre>
|/etc/inittab|<pre>
+
 
l3:3:wait:/sbin/rc default
 
l3:3:wait:/sbin/rc default
</pre>}}
+
</pre>
 +
 
 
To read as follows:
 
To read as follows:
  
{{File
+
<pre>
|/etc/inittab|<pre>
+
 
l3:3:wait:/sbin/rc dynamic
 
l3:3:wait:/sbin/rc dynamic
</pre>}}
+
</pre>
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 +
[[Category:First Steps]]
 +
[[Category:Official Documentation]]

Latest revision as of 00:21, March 13, 2014

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

Or:

# 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