LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Switching Ethernet devices on boot (http://www.linuxquestions.org/questions/linux-networking-3/switching-ethernet-devices-on-boot-418159/)

omega9380 02-21-2006 06:02 PM

Switching Ethernet devices on boot
 
Ok, here's the rundown. I'm running Fedora Core 4 on a Dell Inspiron 4000. It has a Dell TrueMobile 1150 MiniPCI wireless card, and I use a Netgear 511 PCMCIA card. The wired card is on eth0 and the wireless on eth1. I am a Linux newbie.

Here's what I want to do. At school, I need to be on the wired card configured with DHCP. At home I need both wireless and wired configured staticly. What I want is for my computer to ask me which of the three configs I want DURING BOOT. The three would of course be:

Wireless Static
Wired Static
Wired DHCP

Is this possible?

jschiwal 02-21-2006 07:36 PM

You could save each of the configurations /etc/sysconfig/network/ifcfg-eth0 and /etc/sysconfig/network/ifcfg-wlan0
to templates and write some scripts in ~/bin that will copy over the current ones and start or stop ( or restart ) whatever service you need to. For example, save the configuration for your wireless device using dhcp. Suppose you named it ifcfg-school. Do the same for the home based wlan0 and eth0 config files. Then write a simple script that copies over the current value from the template, and then stops, starts or restarts whatever service that you need to.

Give these scripts mneumonic names, such as "school" and "home" or "net-school" and "net-home" and copy them to your path, such as in ~/bin. Entering "sudo school" will set up your configuration and you'll be ready to go in a few seconds.

I think this would be easier than using profiles. Make sure that the templates are readable only by root so that noone else can read the WIRELESS_WPA_PSK value from your wireless configuration.

If you wanted to, you could change the sudo configuration to allow yourself to execute these two scripts in particular as root without having to enter a password. That would speed up the process by a few seconds.


All times are GMT -5. The time now is 01:07 PM.