LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 11-04-2004, 11:53 PM   #1
Sader
Member
 
Registered: Oct 2004
Location: Kazakhstan
Distribution: Slackware
Posts: 48

Rep: Reputation: 15
Wireless Network interface at startup


Hello,

I've got my wireless card (USB adapter with Atmel chipset) set up & working with slackware 10.1(read: current)
But I have to do a whole lot of typing to get it up & running with commands ifconfig / iwconfig / adding the default gateway.... etc.
Is there any way I can do my wireless card configured at startup/automatically ? Or at least when I'm starting X server..?

Thanks for help,
Sader
 
Old 11-05-2004, 12:01 AM   #2
SocialEngineer
Member
 
Registered: May 2003
Distribution: Slackware
Posts: 236

Rep: Reputation: 31
Yes. Just add the lines you run to rc.local in /etc/rc.d - you'll be fine and dandy then.
 
Old 11-05-2004, 12:24 AM   #3
Sader
Member
 
Registered: Oct 2004
Location: Kazakhstan
Distribution: Slackware
Posts: 48

Original Poster
Rep: Reputation: 15
Thnaks much man, that did the trick....

Chees,
 
Old 11-05-2004, 02:34 AM   #4
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Adding your Gateway and the USE_DHCP variable to rc.init1.conf and then defining your key, info, mode and essid varibles in rc.wireless.conf is how it's meant to be run..... Whatever gets the job done I suppose. rc.local should be called rc.hack.... I used to have that thing jam packed full of crap until I figured out where everything should go...

Last edited by jong357; 11-05-2004 at 02:52 AM.
 
Old 03-11-2005, 04:42 AM   #5
Sader
Member
 
Registered: Oct 2004
Location: Kazakhstan
Distribution: Slackware
Posts: 48

Original Poster
Rep: Reputation: 15
to jong357

But /etc/rc.d/rc.inet1.conf contains just information in regards to eth** devices...

Where should I put my wlan0 to...? The same file ?

Thanks,
Sader
 
Old 03-11-2005, 07:34 AM   #6
killerbob
Member
 
Registered: Oct 2004
Location: Ottawa, ON
Distribution: Slackware
Posts: 662

Rep: Reputation: 31
rc.inet1 will only work if your wireless defaults to ethX. If it's wlanX or athX or wiX, it won't work and you need to do it with scripts in rc.local.

You could modify rc.inet1 to handle wlan0, but it's really a whole lot of trouble for not a whole lot of benefit. On my laptop, I actually changed rc.inet1 and rc.inet2 so they aren't executable and just do my network loading from rc.local.
 
Old 03-11-2005, 07:51 AM   #7
Sader
Member
 
Registered: Oct 2004
Location: Kazakhstan
Distribution: Slackware
Posts: 48

Original Poster
Rep: Reputation: 15
yep, rc.local is the way, I'm doing right now.

but there is one thing that upsets me there.. I've got some windows shares that are required to be mounted at boot, so I put the in /etc/fstab like this:

********************
//192.168.0.X/SharedDocs /usr/local/public/shareddocs smbfs credentials=/home/user/.smbpasswd,uid=user,gid=users 0 0

*********************

but mount comes first, when the network device in not initialized..so it fails & I had to su to root & "mount -a" in order to get it mounted after network interface is initialized.

Sader
 
Old 03-11-2005, 03:25 PM   #8
miguelmmg
LQ Newbie
 
Registered: Nov 2003
Location: México, D.F.
Distribution: Ubuntu
Posts: 9

Rep: Reputation: 0
Post rc.inet1 & rc.inet1.conf for wlanX, ethX, etc...

I've made some changes to rc.inet1 and rc.inet1.conf for configuring network interfaces other than ethX.

Code:
#! /bin/sh
# /etc/rc.d/rc.inet1
# This script is used to bring up the various network interfaces.
#
# @(#)/etc/rc.d/rc.inet1 10.0  Sun Jun  6 23:42:32 PDT 2004  (pjv)

############################
# READ NETWORK CONFIG FILE #
############################

# Get the configuration information from /etc/rc.d/rc.inet1.conf:
. /etc/rc.d/rc.inet1.conf

###########
# LOGGING #
###########

# If possible, log events in /var/log/messages:
if [ /var/run/syslogd.pid -a -x /usr/bin/logger ]; then
  LOGGER=/usr/bin/logger
else # output to stdout/stderr:
  LOGGER=/bin/cat
fi

######################
# LOOPBACK FUNCTIONS #
######################

# Function to bring up the loopback interface.  If loopback is
# already up, do nothing.
lo_up() {
  if grep lo: /proc/net/dev 1> /dev/null ; then
    if ! /sbin/ifconfig | grep "^lo" 1> /dev/null ; then
      echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig lo 127.0.0.1" | $LOGGER
      /sbin/ifconfig lo 127.0.0.1
      echo "/etc/rc.d/rc.inet1:  /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo" | $LOGGER
      /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
    fi
  fi
}

# Function to take down the loopback interface:
lo_down() {
  if grep lo: /proc/net/dev 1> /dev/null ; then
    echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig lo down" | $LOGGER
    /sbin/ifconfig lo down
  fi
}

######################
# ETHERNET FUNCTIONS #
######################

# Function to bring up an Ethernet interface.  If the interface is
# already up or does not yet exist (perhaps because the kernel driver
# is not loaded yet), do nothing.
if_up() {
  VAR_IPADDR="IPADDR_${1}"
  VAR_NETMASK="NETMASK_${1}"
  VAR_USE_DHCP="USE_DHCP_${1}"
  VAR_DHCP_HOSTNAME="DHCP_HOSTNAME_${1}"
  # If the interface isn't in the kernel yet (but there's an alias for it in
  # modules.conf), then it should be loaded first:
  if ! grep ${1}: /proc/net/dev 1> /dev/null ; then # no interface yet
    if /sbin/modprobe -c | grep -w "alias ${1}" | grep -vw "alias ${1} off" > /dev/null ; then
      echo "/etc/rc.d/rc.inet1:  /sbin/modprobe ${1}" | $LOGGER
      /sbin/modprobe ${1}
    fi
  fi
  if grep ${1}: /proc/net/dev 1> /dev/null ; then # interface exists
    if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null || \
      ! /sbin/ifconfig ${1} | grep "inet addr" 1> /dev/null ; then # interface not up or not configured
      if [ -x /etc/rc.d/rc.wireless ]; then
        . /etc/rc.d/rc.wireless ${1} # Initialize any wireless parameters
      fi
      if [ "${!VAR_USE_DHCP}" = "yes" ]; then # use DHCP to bring interface up
        if [ ! "${!VAR_DHCP_HOSTNAME}" = "" ]; then
          echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -d -t 10 -h ${!VAR_DHCP_HOSTNAME} ${1}" | $LOGGER
          /sbin/dhcpcd -d -t 10 -h ${!VAR_DHCP_HOSTNAME} ${1}
        else
          echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -d -t 10 ${1}" | $LOGGER
          /sbin/dhcpcd -d -t 10 ${1}
        fi
      else # bring up interface using a static IP address
        if [ ! "${!VAR_IPADDR}" = "" ]; then # skip unconfigured interfaces
          # Determine broadcast address from the IP address and netmask:
          BROADCAST=`/bin/ipmask ${!VAR_NETMASK} ${!VAR_IPADDR} | cut -f 1 -d ' '`
          # Set up the ethernet card:
          echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} ${!VAR_IPADDR} broadcast ${BROADCAST} netmask ${!VAR_NETMASK}" | $LOGGER
          /sbin/ifconfig ${1} ${!VAR_IPADDR} broadcast ${BROADCAST} netmask ${!VAR_NETMASK}
        else
          if [ "$DEBUG_IF_UP" = "yes" ]; then
            echo "/etc/rc.d/rc.inet1:  ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER
          fi
        fi
      fi
    else
      if [ "$DEBUG_IF_UP" = "yes" ]; then
        echo "/etc/rc.d/rc.inet1:  ${1} is already up, skipping" | $LOGGER
      fi
    fi
  else
    if [ "$DEBUG_IF_UP" = "yes" ]; then
      echo "/etc/rc.d/rc.inet1:  ${1} interface does not exist (yet)" | $LOGGER
    fi
  fi
}

# Function to take down an Ethernet interface:
if_down() {
  VAR_IPADDR="IPADDR_${1}"
  VAR_NETMASK="NETMASK_${1}"
  VAR_USE_DHCP="USE_DHCP_${1}"
  VAR_DHCP_HOSTNAME="DHCP_HOSTNAME_${1}"
  if grep ${1}: /proc/net/dev 1> /dev/null ; then
    if [ "${!VAR_USE_DHCP}" = "yes" ]; then
      echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -k -d ${1}" | $LOGGER
      /sbin/dhcpcd -k -d ${1} || /sbin/ifconfig ${1} down
      sleep 1
    else
      echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} down" | $LOGGER
      /sbin/ifconfig ${1} down
    fi
  fi
}

#####################
# GATEWAY FUNCTIONS #
#####################

# Function to bring up the gateway if there is not yet a default route:
gateway_up() {
  if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
    if [ ! "$GATEWAY" = "" ]; then
      echo "/etc/rc.d/rc.inet1:  /sbin/route add default gw ${GATEWAY} metric 1" | $LOGGER
      /sbin/route add default gw ${GATEWAY} metric 1 2>&1 | $LOGGER
    fi
  fi
}

# Function to take down an existing default gateway:
gateway_down() {
  if /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
    echo "/etc/rc.d/rc.inet1:  /sbin/route del default" | $LOGGER
    /sbin/route del default
  fi
}

############
### MAIN ###
############

case "$1" in
'start') # "start" brings up all available interfaces:
  lo_up
  if_up eth0
  if_up eth1
  if_up wlan0
  if_up wlan1
  gateway_up
  ;;
'stop') # "stop" takes down all existing interfaces:
  gateway_down
  if_down wlan1
  if_down wlan0
  if_down eth1
  if_down eth0
  lo_down
  ;;
*_start) # "eth?_start" will start the specified interface
  INUM=`echo $1 | /bin/cut -f 1 -d_`
  if_up $INUM
  ;;
*_stop) # "eth?_stop" will stop the specified interface
  INUM=`echo $1 | /bin/cut -f 1 -d_`
  if_down $INUM
  ;;
*_start) # "eth?_restart" will take the specified interface down and up again
  INUM=`echo $1 | /bin/cut -f 1 -d_`
  if_down $INUM
  if_up $INUM
  ;;
*) # The default is to bring up all interfaces:
  lo_up
  if_up eth0
  if_up eth1
  if_up wlan0
  if_up wlan1
  gateway_up
esac

# End of /etc/rc.d/rc.inet1
This is the rc.inet1.conf
Code:
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# Config information for eth0:
IPADDR_eth0=""
NETMASK_eth0=""
USE_DHCP_eth0=""
DHCP_HOSTNAME_eth0=""

# Config information for eth1:
IPADDR_eth1=""
NETMASK_eth1=""
USE_DHCP_eth1=""
DHCP_HOSTNAME_eth1=""

# Config information for wlan0:
IPADDR_wlan0=""
NETMASK_wlan0=""
USE_DHCP_wlan0="yes"
DHCP_HOSTNAME_wlan0="e2"

# Config information for wlan1:
IPADDR_wlan1=""
NETMASK_wlan1=""
USE_DHCP_wlan1=""
DHCP_HOSTNAME_wlan1=""

# Default gateway IP address:
GATEWAY=""

# Change this to "yes" for debugging output to stdout.  Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_IF_UP="yes"
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
"wlan0" interface not recognized with NETGEAR WG111 USB Wireless Network Adapter lasindi Slackware 18 04-10-2007 10:18 PM
"wlan0" interface not recognized with NETGEAR WG111 USB Wireless Network Adapter lasindi Slackware - Installation 3 09-24-2005 05:51 PM
Changing the default network interface at startup frandres Linux - Newbie 1 01-16-2005 06:32 PM
Interface with Eth0 in Mandrake Startup kingeric Linux - Hardware 5 06-29-2004 01:06 PM
Need help configuring an old linux box with wireless interface connect to network itrap2003 Linux - Wireless Networking 3 06-25-2004 12:50 PM

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

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