LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-27-2005, 03:51 PM   #1
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 58
wlan0 script help


I have Slackware 10.2 installed on my laptop and when I am hanging out on the couch I like to use wireless. Here is how I connect;
Code:
ifconfig eth0 down
modprobe ndiswrapper
iwconfig wlan0 essid linksys
ifconfig wlan0 192.168.0.10 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1
This works great. Could someone help me with a script to automate this, thanks
 
Old 11-28-2005, 08:26 AM   #2
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Code:
#!/bin/bash

# Wireless network connection script

ifconfig eth0 down
modprobe ndiswrapper
iwconfig wlan0 essid linksys
ifconfig wlan0 192.168.0.10 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1
Stick that into /etc/init.d/ or /etc/rc.d (can't remember with Slack!) and then "chmod a+x wireless.sh", depending on what you saved it as. You then simply run your script as "/etc/init.d/wireless.sh" and let it connect. You'd need to run that as root due to the networking tools required, or a more elegant way I run it is to configure sudo to allow a normal user to execute it. You could add this to your default runlevel to load on each boot, depending on whether it's you primary network or not...
 
Old 11-28-2005, 10:19 AM   #3
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291

Original Poster
Blog Entries: 5

Rep: Reputation: 58
Thanks alot, looks easy now but when you don't know you just don't.
 
Old 11-28-2005, 10:56 AM   #4
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Quick + dirty bash scripting simply requires you stick "#!/bin/bash" at the top of your document, then each command on a new line. Change the pemissions so it can be executed, and it's no different a text file really :-) It's worth reading up on bash scripting as it's actually pretty powerful to control all sorts of things on your system! Have fun!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is wlan0:9 ? dlocalized Linux - Wireless Networking 1 07-03-2005 01:57 PM
dhclient wlan0 - wlan0: not found nickleus Linux - Networking 1 05-10-2005 09:06 PM
wlan0 there - but not there? karaite Linux - Wireless Networking 9 11-02-2004 01:38 PM
wlan0 Patbuzz86 Linux - Wireless Networking 8 04-28-2004 02:45 PM
Broadcom wireless with ndiswrapper: ifconfig wlan0 works; ifup wlan0 fails orangechicken Linux - Wireless Networking 2 04-17-2004 05:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration