LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-09-2005, 03:02 PM   #1
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Rep: Reputation: 15
Startup Scripts??


Well, one problem follows another. I just got my Netgear WG511 wireless card working by "stuffing" prism54 firmware and using commands from a terminal window. Simple commands:

# ifconfig eth1 192.168.0.105
# route add default gw 192.168.0.1

I thought it would be easy to automate by editing the /etc/network/interfaces file. NOT SO. The file apparently doesn't get executed during boot up as I thought, so the card never gets activated. But, if I run the script from a terminal window, the card is activated and I have network access.

So, my question: How can I get /etc/network/interfaces to execute during boot?

As an alternative, I came across a web site that had a script for starting the Netgear card from a user created file with a similar script. The instructions for automation said to put the script in rc.local. I don't have a clue what rc.local is. I can find no such directory or file on my system.

I would appreciate any help/insight/link, jimbo
 
Old 07-09-2005, 03:19 PM   #2
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
What Linux distro are you using? You still get /etc/network/interfaces read + executed on boot. But, if you want to create your own scripts, simply create a simple bash script:
Code:
#!/bin/bash
# Network startup script
ifconfig eth1 192.168.0.105
route add default gw 192.168.0.1
save this tp /etc/init.d/mynet.sh and set permissions:
Code:
chmod a+x /etc/init.d/mynet.sh
then symlink your startup script to /etc/rc2.d/ /etc/rc3.d/ /etc/rc4.d/ /etc/rc5.d/
Code:
ln -s /etc/init.d/mynet.sh /etc/rc2.d/S40mynet
ln -s /etc/init.d/mynet.sh /etc/rc3.d/S40mynet
ln -s /etc/init.d/mynet.sh /etc/rc4.d/S40mynet
ln -s /etc/init.d/mynet.sh /etc/rc5.d/S40mynet
Some distros have tools that automatically create the symlinks by running system tool that picks up your file from /etc/init.d/ . Basically, all the files in /etc/init.d are called by symlinks as the various run levels are invoked by the system during startup.

Please note .that's a very, very basic startup and crude way of linking your script, without any handling of shutting down or restarting the network service if you need, but it will work. I'm sure someone will do something better.Have a look on the net at bash scripting, the boot process using init.d and the runlevels if you want to improve things and understand exactly how to do it, but at least that will get you going.
 
Old 07-09-2005, 03:21 PM   #3
zuralin
Member
 
Registered: Sep 2003
Distribution: Debian testing/unstable
Posts: 229

Rep: Reputation: 32
It does get executed on startup, you just have to have the proper format. For example:
auto eth1
iface eth1 inet static
address 192.168.0.105
netmask 255.255.255.0
gateway 192.168.0.1
network 192.168.0.1
broadcast 192.168.0.255
 
Old 07-09-2005, 05:04 PM   #4
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
My installation is Etch, latest.

Thanks for the thoughtful replies. I will try adding the script to init.d.

Second, I have the correct format in /etc/network/interfaces, but it just doesn't seem to execute. When I execute it from a terminal window, it gives an error message that says iface and auto are unknown commands.

Maybe I missed a needed package when I installed?

Thanks again, jimbo

Last edited by jimbo-62; 07-09-2005 at 05:06 PM.
 
Old 07-10-2005, 11:16 AM   #5
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
Here is the rest of the story. As I explained in other posts, I was able to get my Netgear WG511 wireless PC card working by executing commands from a terminal window. See the thread, "How to Activate Wireless". But I wasn't able to automate the process. The /etc/network/interfaces script didn't seem to execute during boot. But I discovered that the entries in that file must ONLY be the high level entries as explained in the Debian Reference Manual, Chapter 10.6.

And, in addition, there is a further requirement for PC (PCMCIA) cards, and activating the card at boot, as described in the Debian Reference Manual, Chapter 10.10.1 and 10.10.2.

In any case I have two versions of /etc/network/interfaces that work for me.

Version 1 - Static IP addresses.

auto lo
iface lo inet loopback

mapping hotplug (Hotplug activates the card.)
script grep
map eth1

iface eth1 inet static
address 192.168.0.105 (IP address of your PC.)
netmask 255.255.255.0
gateway 192.168.0.1 (IP address of your router/gateway.)

ifup eth1 (This line must follow the other eth1 lines.)

Version 2 - Dynamic IP addresses.

auto lo
iface lo inet loopback

mapping hotplug
script grep
map eth1

iface eth1 inet dhcp
wireless-essid <name of your network>
wireless-channel 9
wireless-ap 00:40:05:5A:81:d9 <LAN MAC address of your router. >

ifup eth1

Thanks for the help, jimbo
 
Old 07-10-2005, 11:23 AM   #6
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Looks like reading the Debian docs have paid off then and explained why you weren't getting /etc/network/interfaces applied at boot. Assuming it's all working okay now. Have fun!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
startup scripts... ValidiusMaximus Linux - Software 8 01-11-2005 06:55 PM
Startup Scripts jhartney Linux - Newbie 3 01-07-2005 02:35 AM
Startup scripts celticselph Slackware 5 04-08-2004 08:23 AM
startup scripts mimi Linux - General 1 04-24-2002 04:22 AM
X Startup Scripts JHuizingh Linux - General 1 09-18-2001 02:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:35 AM.

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