SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have an HP laptop which I use both at work and at home. I use a wired connection at work on the LAN and at home I use Wireless connectivity.
The problem seems that when I go from one connection to another I wind up having to change some parameters. For example, if I use the laptop at home, I have to enter the WiFi router I have at home in the "gateway" area of Network card. When I go to work even though I don't have the wireless card on, I have to change the router to the one here at work.
In other words, is there any way for me to have two different network configurations dependant on the card i'm using at the time ie, Wireless or wired?
Thanks.
You should be able to write a quick script that handles the settings for wired + wireless networks. I have the same problem so created two scripts in /etc/init.d. When at work, I simply type /etc/init.d/wired start and it shuts down wlan0, configures dhcp for wired card, setups internal DNS servers, etc. When at home, simply /etc/init.d/wireless start and the opposite happens. Have a look at some basic bash scripting tutorials to look at setting up your scriptss it will make it much easier.
Thanks Fouldsy for the info. Actually, to make it much, much simpler for me why don't you email me your scripts!!!!! (If you would be so kind!)
Thanks again.
#!/bin/bash
case "$1" in
start)
depmod -a
modprobe ndiswrapper
ifconfig eth0 down
ifconfig wlan0 down
iwconfig wlan0 essid "setyours"
iwconfig wlan0 key restricted [1] setyourkeyhere
ifconfig wlan0 192.168.1.80 netmask 255.255.255.0
# Putting in the netmask prevents network activity, dunno why :-)
# Might just be a quirk of Gentoo, haven't looked to hard at it!
route add default gw 192.168.1.1
ifconfig wlan0 up
;;
stop)
ifconfig wlan0 down
;;
esac
exit 0
You could simply put the code into a script rather than working out start + stop, but I like the idea of stopping it for whatever reason. The wired network script is the same, but giving IP details for eth0 and shutting down wlan0. Or, configure your wired network as system default and only call the wireless script at home.
No problem, just tweak it for your own settings and come back with any problems. Is pretty straightforward. Would still suggest looking at learning some basic bash scripting for stuff like that - makes life so much easier
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.