Debian This forum is for the discussion of Debian 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
07-09-2005, 03:02 PM
|
#1
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Rep:
|
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
|
|
|
07-09-2005, 03:19 PM
|
#2
|
Senior Member
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284
Rep:
|
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.
|
|
|
07-09-2005, 03:21 PM
|
#3
|
Member
Registered: Sep 2003
Distribution: Debian testing/unstable
Posts: 229
Rep:
|
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
|
|
|
07-09-2005, 05:04 PM
|
#4
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
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.
|
|
|
07-10-2005, 11:16 AM
|
#5
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
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
|
|
|
07-10-2005, 11:23 AM
|
#6
|
Senior Member
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284
Rep:
|
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!
|
|
|
All times are GMT -5. The time now is 10:35 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|