LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (http://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   Switching back and forth between Wireless and Ethernet (http://www.linuxquestions.org/questions/linux-wireless-networking-41/switching-back-and-forth-between-wireless-and-ethernet-413020/)

FWSquatch 02-08-2006 10:27 AM

Switching back and forth between Wireless and Ethernet
 
I have an HP Omnibook XE3 running Debian Sarge. For the longest time, I would plug into my home and work network with a 25 ft ethernet cable. Well, I finally got my wireless card working and now I can run it on my wireless network at home, but when I go to work, I have to plug into theirs. How do I switch back and forth between my wireless and my network card?

fouldsy 02-08-2006 12:23 PM

There are hotplug scripts that can detect whether a physical network cable is attached, allowing you to then activate the wired interface, otherwise activate your wireless connection, and wrap all this into your own startup script. Personally, I just bring up my wireless connection automatically on boot, then have a quick shell script that I can run to let me pick an additional network to connect into at work. An example would be:
Code:

#!/bin/bash
depmod -a
modprobe ndiswrapper

ifconfig eth0 down
ifconfig wlan0 down

iwconfig wlan0 essid "youressid"
iwconfig wlan0 key restricted [1] yourkey
ifconfig wlan0 youripaddress netmask yournetmask

route add default gw yourdefaultgw

ifconfig wlan0 up

and something similar for your wired connection. The whole script including the menu system can be found here - http://www.fouldsy.com/?p=157 . Just adjust it to your needs.

Linux.tar.gz 02-08-2006 09:40 PM

You can take a look at ifplugd:
http://www.stud.uni-hamburg.de/users...jects/ifplugd/


All times are GMT -5. The time now is 10:57 PM.