LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-22-2009, 10:36 AM   #1
datadriven
Member
 
Registered: Jun 2003
Location: Holly Hill, Florida
Distribution: Slackware 10.1
Posts: 317

Rep: Reputation: 30
dhcp wlan0 before eth0?


Is there a way to change the order that the devices are checked by rc.inet1 so that it tries wireless before ethernet?
 
Old 01-22-2009, 11:54 AM   #2
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-14.1 on a Lenovo T61 6457-4XG
Posts: 3,950

Rep: Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930
AFAIK rc.inet1 is supposed to bring up or down either one interface or all (the latter being the default).

You could make this file non executable and put in another file (possibly rc.local) a script who will source rc.inet1 (or copy its functions) and do something like:
- try to bring up wlan0
- if not successful try to bring up eh0
 
Old 01-22-2009, 12:26 PM   #3
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
I think you may be able to adjust /etc/rc.d/rc.inet1.conf to allow this by using the IFNAME[n] value. As far as I know /etc/rc.d/rc.inet1 goes through the value arrays from /etc/rc.d/rc.inet1/conf in numerical order so if you set up IFNAME[0]="wlan0" and IFNAME[1]="eth0" then wlan0 will be tried before eth0.

You'll have to add the IFNAME[0] and IFNAME[1] lines to /etc/rc.d/rc.inet1.conf as they aren't in standard Slackware installs. There is, however, an IFNAME[4] which is what made me think of it. You'll need to setup the rest of the values as well.

Looking at /etc/rc.d/rc.inet1 seems to bear this out with this bit being relevant - after sourcing the values from /etc/rc.d/rc.inet1.conf we have :

Code:
MAXNICS=6
i=0
while [ $i -lt $MAXNICS ];
do
  IFNAME[$i]=${IFNAME[$i]:=eth${i}}
  i=$(($i+1))
done
which looks like the IFNAME array is evaluated in numerical order. The interfaces are brought up like this :
Code:
  for i in ${IFNAME[@]} ; do
    if_up $i
  done
This means changing the order should work. Here's an example /etc/rc.d/rc.inet1.conf - adjust to suit :

Code:
# Config information for wlan0:
IFNAME[0]="wlan0"
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""

# Config information for eth0:
IFNAME[1]="eth0"
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]="yes"
DHCP_HOSTNAME[1]=""

I've not tried this but it should work I think. Note that if both interfaces get ther IP information via DHCP then the DNS and Gateway information will be overwritten by the last interface brought up. You may change this with these values :
Code:
DHCP_KEEPRESOLV[1]="yes"
DHCP_KEEPGW[1]="yes"
This stops the settings being overwritten. Note how the stanzas in /etc/rc.d/rc.inet1.conf are grouped together - the array index being a means of identifying the values for a particular interface.
 
  


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
Eth0 using DHCP and eth1 using static ip: eth0 receive internal ip not the router ip geraldomanaus Linux - Networking 3 04-23-2008 03:00 PM
ignoring dhcp requests on eth0 and wlan0 define subnet mask? Person_1873 Linux - Server 1 12-15-2007 05:58 AM
Remapping wlan0 to eth0 Berhanie Linux - Networking 1 02-17-2005 07:59 AM
Starting wlan0 instead of eth0 eo697 Linux - Networking 2 10-12-2003 05:02 PM
route wlan0 to eth0 hwood7587 Linux - Networking 1 07-13-2003 06:47 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration