SlackwareThis Forum is for the discussion of Slackware 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.
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.
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..?
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...
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.
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:
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.
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"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.