l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2005 Mar 24 19:36

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: Slackware: Custom script on ifup? (Was: Re: [vox-tech] notebookwireless refinement question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slackware: Custom script on ifup? (Was: Re: [vox-tech] notebookwireless refinement question)

On Thu, 24 Mar 2005, Ryan wrote:

On Saturday 19 March 2005 09:03 pm, Donald Greg McGahan
dgmcgahan-at-yahoo.com |lugod| wrote:
New to Linux so pardon if this is not not clearly asked......but here
I have Slackware running on a Toshiba notebook.
It has a miniPCI wireless card.
I've figured out how to connect to my home wireless router by running a

iwconfig eth1 essid name key [1] XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX
dhcpcd eth1

Now when I turn on the notebook at home I'd like to have the start up
recognize the essid name and run this script and just connect or is
there a better way such as the rc.wireless.conf? Seems like I should be
able to look for this essid first then if it does not exist go to say
Moobilenet then look for an unsecured access point.
Most distros are able to run a script when an interface is brought up. I'm
not familiar with slackware, but I know it can be done in debian. Each distro
tends to handle network initialization in a diffrent way, so you'll need to
talk to a slackware person. I have changed he subject to get someone who
knows how to do this to respond ;)

Nice thing about Slackware is you can pretty easily edit the scripts in /etc/rc.d to put whatever you want. I've not messed with wireless yet, but the eth interfaces are usually configured by /etc/rc.d/rc.inet1. I usually leave this script alone out of old habit (on pre 10.x boxes, that script was overwritten by the network configuration binary, although I'm pretty sure that on 10.x only /etc/rc.d/rc.inet1.conf is overwritten). /etc/rc.d/rc.inet2 is run immediately afterwards to configure network related services such as the firewall and daemons. Calling your script at the start of this file is one way to go for getting the interface configured properly at boot.

As you already seemed to have guessed, the more accepted method is to put it in /etc/rc.d/rc.wireless.conf as that is called by /etc/rc.d/rc.inet1 during the eth_up process. Note that this when rc.wireless.conf is called, it is passed the eth${1} variable from /etc/rc.d/rc.inet1 so you have the interface name. It also calls it for all initialized interfaces, so if you also have an eth0 for example, it will also call rc.wireless.conf eth0. You will want to check this parameter in rc.wireless.conf so you only run your script when the wireless interface is reached. The advantage of a properly configured rc.wireless.conf is that you can run /etc/rc.d/rc.inet1 eth1_start or /etc/rc.d/rc.inet1 eth1_restart after the machine has booted and your script will be called.

So this might be a sample rc.wireless.conf script that would allow adding more interfaces later:


config_eth1() {
iwconfig eth1 essid name key [1] XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX

case "$1" in

Note that I did not put the DHCP call in here. This can actually be handled in /etc/rc.d/rc.inet1 by editting /etc/rc.d/rc.inet1.conf and putting USE_DHCP[1]="yes". /etc/rc.d/rc.wireless.conf is called just before DHCP in rc.inet1. And if you're only going to have the one wireless interface, instead of the case statement and function, you could just do an if statement with string compare on the $1 parameter.
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.