Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Linux Software

Location Profiles For Unix Laptops? 15

Cyron Green asks: "I travel quite a bit with my laptop (it keeps me company). I hate having to change my NIC settings everytime I stop somewhere or I go from work to home. Is there any type of Location Managment software out there for Linux or FreeBSD?"
This discussion has been archived. No new comments can be posted.

Location Profiles For Unix Laptops?

Comments Filter:
  • by Tet ( 2721 ) <slashdot AT astradyne DOT co DOT uk> on Monday February 05, 2001 @11:17AM (#455377) Homepage Journal
    In times gone by, you used to be able to do:
    cardctl scheme home
    cardctl scheme work

    to switch to your home or work network settings respectively. However, at some time around Red Hat 6.x, this stopped working. By then, though, I wasn't using the laptop enough for me to bother to find out why... Can anyone shed any light on this?

  • a couple of solutions are suggested in the laptop how-to :
    http://www.linux.com/howto/Laptop-HOWTO-10.html# ss 10.2

    namely netdev and devine
    http://www.uni-bielefeld.de/~portgym/net/netenv. ht ml
    http://www.fefe.de/devine

    You might also want to check the pcmcia how-to:
    http://www.linux.com/howto/PCMCIA-HOWTO.html
    which describes how to setup scheme support....

    hope this helps.
  • OK, this is cool. But what if some of my 'schemes' need to enable WEP in different ways? Do the schemes extend into the wireless.opts file too?

    I have more than just 'work' and 'home'; I have clients' net configs (though simple DHCP often works for wired connections) and I have both wired and wireless at home.

    I never noticed that RH6 broke anything in the pcmcia package because I always build a new kernel as soon as the laptop is up and running. But I've heard that they 'simplified' the network.opts file a little too much.
  • I've used netdev, which involves configuring various LILO boot configurations (and your network boot scripts then test for the boot configuration name).

    I think Divine [freshmeat.net] is a better concept. A configuration file tells it what servers exist on your various networks, and it then looks for the servers and sets the network configuration appropriately. But Divine doesn't know about DHCP yet.

  • by William Aoki ( 392 ) on Monday February 05, 2001 @12:04PM (#455381) Homepage

    PCMCIA schemes are set up in /etc/pcmcia. Your network settings live in /etc/pcmcia/network.opts and are used by the script /etc/pcmcia/network.

    RedHat replaces /etc/pcmcia/network with a script that uses RedHat's network configuration files in /etc/sysconfig/network-scripts. This allows you to use the GUI configuration tools to set up your network but prevents you from using schemes to handle your network configuration. On my RedHat laptop, I went diving in the pcmcia-cs source tree to find the 'normal' /etc/pcmcia/network so I could use schemes.

    That said, I normally leave my laptop set to obtain network configuration information from DHCP. The DHCP servers on networks where I have a static IP have been told to reserve it for my laptop (well, technically, for my laptop's NIC), and when visiting other networks I don't have to futz around finding an IP. Whenever the computer is away from its home network, it uses MobileIP to bring up a tunnel back to its home agent. It looks more or less the same to other hosts regardless of its location, and I can suspend the laptop, drive to another location, and plug in to a completely diffirent network without disturbing my ssh sessions.

  • by True Dork ( 8000 ) on Monday February 05, 2001 @08:12PM (#455382) Homepage
    That was driving me nuts too, so I installed sudo, gave my user account sudo rights to ifconfig, route, and pump. Then my scripts looks similar to:

    #!/bin/bash
    sudo ifconfig eth0 192.168.0.50
    sudo route add default gw 192.168.0.1

    or...

    #!/bin/bash
    sudo pump -i eth0

    Now, if you need to change your resolv.conf, maintain several and chown them to your user account. That way you can have resolv.conf.work, resolv.conf.home, resolv.conf.client3 and hell, you could symlink /etc/resolv.conf to which one you ned in the bash script. I dont have that problem as I just use my ISP's named from wherever I am. A little slower, but I dont have to change anything!

    After I made all my scripts, I put a menu in my KDE bar that had links to all my scripts. I bring the laptop out of suspend, click the bar, choose where I am, and poof.
  • What about Linuxconf?
    I know it has profiles called Work and Home, though I've never dared to try it out I would assume it has something to do with it.
  • Beautiful. The power of scripting is quite inspiring.
  • maybe its what you're looking for.
    gnetswitch [lost-angel.com]
  • Um, maybe init 3 and init 4? Or do you mean switching between a profile and off?
  • OK, this is cool. But what if some of my 'schemes' need to enable WEP in different ways? Do the schemes extend into the wireless.opts file too?

    Yes, they work in wireless.opts. The scheme is passed as the first argument of $ADDRESS. So home,*,*,00:02:2D:*) matches my MAC on my lucent card while using my home scheme. Scheme's can be appended as a kernel parameter, so I have different lilo entries for each scheme.

    I never noticed that RH6 broke anything in the pcmcia package because I always build a new kernel as soon as the laptop is up and running. But I've heard that they 'simplified' the network.opts file a little too much.

    To get the Lucent cards to work with 6.2 you have to download a newer version of the PCMCIA-cs package, build it and install it.

  • by Enry ( 630 )
    Why not do the settings via DHCP? I run my laptop between home and work all the time, plus the wireless card. Using static DHCP, I always get the same IP address, name, and other settings.
  • by lizrd ( 69275 ) <[su.pmub] [ta] [mada]> on Monday February 05, 2001 @01:09PM (#455389) Homepage
    I've heard of some people setting up init scripts on laptops to use the (generally) unused runlevel 4. Usually I've heard about this in terms of enabling some power management features, but I don't see why you couldn't change the network startup scripts while you were at it. Once you'd done that it would just be a matter of typing init 4 or init 5 to switch between two different profiles.
    _____________
  • No, I actually ment what I said. This does vary a little bit by distro (Suse in particular is a little strange), but the usual scheme for Linux run levels is:
    1. Halt
    2. Single User
    3. Multi user, no network
    4. Multi user w/ network
    5. Unused
    6. X
    7. Reboot

    This is at least correct for the rpm based distros. I'm not sure about everyone else, but I think it's pretty consistent. I can't remember how to start a OL from 0. There should be a zero next to halt.
    _____________

  • I am using my laptop
    * At home with a wireless card
    * At work
    * Visiting other offices
    * Visiting clients
    * On the road (from hotels, etc)

    I never reboot the laptop, only suspend/restore (it occasionally crashes, though, about once a month, but usually for some unrelated reason).

    I run Debian (woody/2.2.17), and among the software I have installed is a dhcp client, divine, dnrd, wwwoffle, exim, imap, fetchmail, ntpdate, and some more.

    There's a bunch of scripts that reconfigure the above packages as needed.

    All my browsers (including apt-get) are pointed at the wwwoffle proxy.

    /etc/resolv.conf points at localhost, and dnrd is restarted with new options on every connection. dnrd quits on suspend.

    I download e-mail with fetchmail to my local imap and use it from whatever mail client pleases me. fetchmail starts in daemon mode when there's an ethernet connection, on PPP it just runs once. It quits on suspend.

    I send all e-mail through the local forwarding exim. Exim is configured to send everything on to mailhost, and mailhost is remapped in /etc/hosts to a different IP for every configuration (a small script in /etc/setmailhost does that).

    My wireless card is configured for only one IP address (in /etc/pcmcia/wireless.opts), because I currently only use it at home. It could, of course, use DHCP.

    The ethernet card (pcmcia) is used both at work and elsewhere. Some of these places have DHCP, some do not. I use dhcpcd and divine (although divine doesn't work well with dhcp). Each divine config has a script attached to it that changes the configuration for the above daemons. Where there is no DHCP, I have to run the divine script by hand.

    For PPP, there are similar scripts in /etc/ppp/ip-up.d that change settings based on the provider.

    Samba is restarted on every restore and pcmcia network card insert, because it needs to rebind itself to the new interfaces. I haven't bothered changing the workgroup from the scripts yet, but that is something I plan to do.

    The situation that I haven't figured out very well yet is when there are several interfaces active (2 ethernet cards in at the same time, or ethernet and PPP running simultaneously). For me that so rarely happens that I don't want to invest time in figuring out a good solution.

    If you wish to know more details, drop me a mail at eero.raun@cyberdude.com.

A morsel of genuine history is a thing so rare as to be always valuable. -- Thomas Jefferson

Working...