Job Evers wrote:

 On Sat, 24 Jul 2004, Mikkel L. Ellertson wrote:

> One other thing to think about. If you usually know if you want
> network access when you boot, and you do not often change your
> network status after booting, set up two net profiles. One with
> network enabled, and one with it disabled. then set up two entries
> in lilo, one for each net profile. You can then select witch one
> to boot into. (You add PROFILE=<profile name> in the append
> section for each boot entry.) The nice thing about Netprofiles is
> that you can define what services start, what interfaces are
> defined, separate host and resolv.conf files for each one, etc.
> You can change profiles without rebooting, and it will start/stop
> services as necessary to match the new profile. (It is a lot like
> changing run levels, but it does even more!)
>

 Woah, this is awesome. Can you send more details on how to
 accomplish all of this? I would love to be able to change how my
 system starts up dependant on what kind of network I will be access
 (and also if I will be running off of battery or external power)

 Thanks,

 Job

It is fairly easy. You can set create the profiles using MCC. In drakeconnect, the top line starts Profile:
You can create new profiles there, as well as configure the profiles. You can also change the current profile there. If you are a command line person, like I am, all the profile information in stored in /etc/netprofile and the profiles subdirectory tree. The current profile is listed in current.


Each profile in stored in its own subdirectory in /etc/netprofiles/profiles. the files tree contains the files that get changed when you change to that profile. The services tree contains the list of services that are run when that profile is active. You can remove services by deleting the file with the service name, or add services by creating an empty file with the service name. For example, to have the ssh server run, you would use the command "touch sshd" while in the services directory.

To change profiles from the command line, you can use the set-netprofile command. The form is set-netprofile <profile name>. So,, to change to a profile called Static_IP, you would use
"set-netprofile Static_IP".


The way I choose the profile to use at boot time was to create entries in /etc/lilo.conf for each profile. So I have entries like:

image=/boot/vmlinux-2.4.22-36mdk
             label="Dynamic_IP"
             root=/dev/hda3
             read-only
             append="devfs=mount acpi=on PROFILE=Dynamic_IP"
             initrd=/boot/initrd-2.4.22-36mdk.img

image=/boot/vmlinux-2.4.22-36mdk
             label="Static_IP"
             root=/dev/hda3
             read-only
             append="devfs=mount acpi=on PROFILE=Static_IP"
             initrd=/boot/initrd-2.4.22-36mdk.img

You can copy the entry as many times as you need to, and just change the label and the PROFILE for each entry. The only drawback is that when you upgrade the kernel, you have to edit lilo.conf by hand so the profiles use the new kernel. One of these days, I am going to write a small script to be run at startup to ask what profile I want to use. I just have not gotten to it yet.

One thing to remember - the changes you make to /etc/lilo.conf do not take affect until you run "lilo" as root.

Mikkel
--

   Do not meddle in the affairs of dragons,
for you are crunchy and taste good with ketchup.


____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to