LinuxQuestions.org
Visit Jeremy's Blog.
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 08-04-2007, 05:36 PM   #1
{e}
LQ Newbie
 
Registered: Apr 2007
Location: Tromsų (NOR)
Distribution: Foresight 1.3.2
Posts: 13

Rep: Reputation: 0
[SOLVED] Script to start network connection?


Hey,

I got a wirelss connection which requires to be started with the manual "ifconfig/iwconfig" routine. This is boring and waste of time to do every time I have booted my computer.

I'd like the network to start by itself. in /etc/sysconfig/network-scripts there are two scripts, one for eth0 and one for lo. I've tried to use them both as examples, just by replacing some entries which correspond to the wireless wlan0 parameters, but to no success.

During boot, the network fails to start, shown by this; Set encode (8B2A, SET failed on device wlan0, network is down.

What entries would be correct in a script to make it work, and what info do I need to add that is correct regarding the wireless device/network? I've tried with: DEVICE, BOOTPROTO, HWADDR,ONBOOT and DCHP_HOSTNAME.

Thanks for any ideas!

E.

EDIT: Should probably be moved to the networking forum. Sorry

Last edited by {e}; 08-05-2007 at 06:00 AM.
 
Old 08-04-2007, 06:29 PM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
The series of commands you use to get wireless up is what you put in the script after the #! /bin/bash line. You make the script executable and put it someplace where the system can find it at boot. Then you put the full path + scriptname at the bottom of your /etc/rc.local file.
 
Old 08-04-2007, 06:52 PM   #3
{e}
LQ Newbie
 
Registered: Apr 2007
Location: Tromsų (NOR)
Distribution: Foresight 1.3.2
Posts: 13

Original Poster
Rep: Reputation: 0
I add the .bin extension to make it executable? And, where can I put so it'll be noticed during boot?

Thanks!
 
Old 08-04-2007, 07:07 PM   #4
sparc86
Member
 
Registered: Jul 2006
Location: Joinville, Brazil
Distribution: Debian, CentOS
Posts: 301

Rep: Reputation: 31
forget this extension stuff. Linux is not Windows.

Use the command:

#chmod 775 script

then put the file in some place at /etc/rc.d (if you're a slackware user) or /etc/init.d (Debian, Redhat, etc... don't forget to build sym links at /etc/rc*.d).

Now every time in which you reboot your box, these commands will be executed.
 
Old 08-04-2007, 08:45 PM   #5
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
sparc68: I chose rc.local because the guy seemed pretty noo. Seems I was right. This will need more exact instructions.

{e}: please state which distribution you are using. You should edit your profile to include this and your location. Thanks.

OT:
I always thought:

"To follow the path:
look to the path."

But I realize now that it depends on your path:

"To follow the path:
look to the master,
follow the master,
stab the master in the back,
take his money...

To follow the path:
look to the master,
follow the master,
see through the master,
realize you've been conned...

"To follow the path:
look to the master,
follow the master,
walk with the master,
see through the master,
follow the mistress...

"To follow the path:
look to the master,
follow the master,
walk with the master,
wonder why the master is a penguin...

"To follow the path:
dress warm,
pick up you feet,
don't scuff your shoes,
wipe your nose...

"To follow the path:
echo $PATH

If you seek enlightenment:
w3m http://enlightenment.sourceforge.net/
 
Old 08-04-2007, 09:31 PM   #6
{e}
LQ Newbie
 
Registered: Apr 2007
Location: Tromsų (NOR)
Distribution: Foresight 1.3.2
Posts: 13

Original Poster
Rep: Reputation: 0
Simon, I am not a noob in a big sense, just when it comes to making scripts like this. Foresight has the same file system as RedHat if that is to any help.

Have I got it right now if I save this file
Code:
#! /bin/bash

sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid MYNETWORKNAME
sudo iwconfig wlan0 key MYKEY
sudo dhclient wlan0
,

and put it's name and location at the bottom of /etc/rc.local? Where should I save this script then?

Last edited by {e}; 08-04-2007 at 09:33 PM.
 
Old 08-04-2007, 11:51 PM   #7
sparc86
Member
 
Registered: Jul 2006
Location: Joinville, Brazil
Distribution: Debian, CentOS
Posts: 301

Rep: Reputation: 31
just copy the following to the rc.local (without the #!/bin/bash):

sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid MYNETWORKNAME
sudo iwconfig wlan0 key MYKEY
sudo dhclient wlan0
 
Old 08-05-2007, 06:00 AM   #8
{e}
LQ Newbie
 
Registered: Apr 2007
Location: Tromsų (NOR)
Distribution: Foresight 1.3.2
Posts: 13

Original Poster
Rep: Reputation: 0
Thank you! That worked!
 
  


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
Script to check connection (and restart network if down) mac_phil Linux - Networking 15 06-21-2016 05:59 PM
how to start a dial-up network connection on open suse 10.2 runnin on a laptop venom.unleashed Linux - Networking 1 05-27-2007 06:12 PM
how to start a dial-up network connection on open suse 10.2 venom.unleashed SUSE / openSUSE 1 05-14-2007 06:51 AM
Script wanted to start ntpd when dialup connection is up farpoint Fedora 3 04-25-2007 03:03 PM
How can I create a script to start my network? asdfjkl Linux - Wireless Networking 3 08-12-2004 09:12 AM

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

All times are GMT -5. The time now is 11:16 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