# /etc/conf.d/net script doesn't work with my Wireless Card.

## Spicerun

Ok, maybe someone can help me with this.  I had to switch over to pcmciautils to make my wireless card work with the latest kernels, and now I'm having trouble making the network card work.  Specifically, it comes up, but dhcpcd won't assign it an id.  However, when I run my own script, The wireless comes up fully and dhcpcd works just fine with it.  Can someone clue me in to what is wrong.  I have a netgear v2 card that uses the prism54 driver.  I use WEP, and do not use WPA supplicant (I have reasons for using WEP, so please don't tell me I have to convert to WPA).

Here's what my /etc/conf.d/net file looks like:

```

##############################################################################

# QUICK-START

#

# The quickest start is if you want to use DHCP.

# In that case, everything should work out of the box, no configuration

# necessary, though the startup script will warn you that you haven't

# specified anything.

#

# WARNING :- some examples have a mixture of IPv4 (ie 192.168.0.1) and IPv6

# (ie 4321:0:1:2:3:4:567:89ab) internet addresses. They only work if you have

# the relevant kernel option enabled. So if you don't have an IPv6 enabled

# kernel then remove the IPv6 address from your config.

#

#

# If you want to use a static address or use DHCP explicitly, jump

# down to the section labelled INTERFACE HANDLERS.

#

# If you want to do anything more fancy, you should take the time to

# read through the rest of this file.

##############################################################################

# MODULES

#

# We now support modular networking scripts which means we can easily

# add support for new interface types and modules while keeping

# compatability with existing ones.

# 

# Modules load by default if the package they need is installed.  If

# you specify a module here that doesn't have it's package installed

# then you get an error stating which package you need to install.

# Ideally, you only use the modules setting when you have two or more

# packages installed that supply the same service.

#

# In other words, you probably should DO NOTHING HERE...

# Prefer ifconfig over iproute2

#modules=( "ifconfig" )

modules=( "ifconfig" )

# You can also specify other modules for an interface

# In this case we prefer udhcpc over dhcpcd

#modules_eth0=( "udhcpc" )

#NOTE:  pcmciautils assigns my wireless card as eth2

modules_eth2=( "dhcpcd" )

# You can also specify which modules not to use - for example you may be

# using a supplicant or linux-wlan-ng to control wireless configuration but

# you still want to configure network settings per ESSID associated with.

#modules=( "!iwconfig" "!wpa_supplicant" )

# IMPORTANT: If you need the above, please disable modules in that order

##############################################################################

# INTERFACE HANDLERS

# 

# We provide two interface handlers presently: ifconfig and iproute2.

# You need one of these to do any kind of network configuration.

# For ifconfig support, emerge sys-apps/net-tools

# For iproute2 support, emerge sys-apps/iproute2

# If you don't specify an interface then we prefer iproute2 if it's installed

# To prefer ifconfig over iproute2

##############################################################################

# OPTIONAL MODULES

# INTERFACE RENAMING

# There is no consistent device renaming scheme for Linux.

# The preferred way of naming devices is via the kernel module directly or

# by using udev (http://www.reactivated.net/udevrules.php)

# If you are unable to write udev rules, then we do provide a way of renaming

# the interface based on it's MAC address, but it is not optimal.

# Here is how to rename an interface whose MAC address is 00:11:22:33:44:55

# to foo1

#rename_001122334455="foo1"

# You can also do this based on current device name - although this is not

# recommended. Here we rename eth1 to foo2.

#rename_eth1="foo2"

#-----------------------------------------------------------------------------

# DHCP

# DHCP can be provided by dhclient, dhcpcd, pump or udhcpc.

#

# dhclient: emerge net-misc/dhcp

# dhcpcd:   emerge net-misc/dhcpcd

# pump:     emerge net-misc/pump

# udhcpc:   emerge net-misc/udhcp

# If you have more than one DHCP client installed, you need to specify which

# one to use - otherwise we default to dhcpcd if available.

#modules=( "dhclient" ) # to select dhclient over dhcpcd

#

# Notes:

# - All clients send the current hostname to the DHCP server by default

# - dhcpcd does not daemonize when the lease time is infinite

# - udhcp-0.9.3-r3 and earlier do not support getting NTP servers 

# - pump does not support getting NIS servers

# - DHCP tends to erase any existing device information - so add

#   static addresses after dhcp if you need them

# - dhclient and udhcpc can set other resolv.conf options such as "option"

#   and "sortlist"- see the System module for more details

# Regardless of which DHCP client you prefer, you configure them the

# same way using one of following depending on which interface modules

# you're using.

#config_eth0=( "dhcp" )

config_eth2=( "dhcp" )

# For passing custom options to dhcpcd use something like the following.  This

# example reduces the timeout for retrieving an address from 60 seconds (the

# default) to 10 seconds.

#dhcpcd_eth1="-t 10"

dhcpcd_eth2="-t 10"

# dhclient, udhcpc and pump don't have many runtime options

# You can pass options to them in a similar manner to dhcpcd though

#dhclient_eth0="..."

#udhcpc_eth0="..."

#pump_eth0="..."

# GENERIC DHCP OPTIONS

# Set generic DHCP options like so

#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"

#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"

# This tells the dhcp client to release it's lease when it stops, not to

# overwrite dns, ntp and nis settings, not to set a default route and not to

# send the current hostname to the dhcp server and when it starts.

# You can use any combination of the above options - the default is not to

# use any of them.

##############################################################################

# ADVANCED CONFIGURATION

# 

# Four functions can be defined which will be called surrounding the

# start/stop operations.  The functions are called with the interface

# name first so that one function can control multiple adapters. An extra two

# functions can be defined when an interface fails to start or stop.

#

# The return values for the preup and predown functions should be 0

# (success) to indicate that configuration or deconfiguration of the

# interface can continue.  If preup returns a non-zero value, then

# interface configuration will be aborted.  If predown returns a

# non-zero value, then the interface will not be allowed to continue

# deconfiguration.

#

# The return values for the postup, postdown, failup and faildown functions are

# ignored since there's nothing to do if they indicate failure.

#

# ${IFACE} is set to the interface being brought up/down

# ${IFVAR} is ${IFACE} converted to variable name bash allows

#preup() {

#   # Test for link on the interface prior to bringing it up.  This

#   # only works on some network adapters and requires the mii-diag

#   # package to be installed.

#   if mii-tool "${IFACE}" 2> /dev/null | grep -q 'no link'; then

#      ewarn "No link on ${IFACE}, aborting configuration"

#      return 1

#   fi 

#

#   # Test for link on the interface prior to bringing it up.  This

#   # only works on some network adapters and requires the ethtool

#   # package to be installed.

#   if ethtool "${IFACE}" | grep -q 'Link detected: no'; then

#      ewarn "No link on ${IFACE}, aborting configuration"

#      return 1

#   fi

#

#

#   # Remember to return 0 on success

#   return 0

#}

#predown() {

#   # The default in the script is to test for NFS root and disallow

#   # downing interfaces in that case.  Note that if you specify a

#   # predown() function you will override that logic.  Here it is, in

#   # case you still want it...

#   if is_net_fs /; then

#      eerror "root filesystem is network mounted -- can't stop ${IFACE}"

#      return 1

#   fi

#

#   # Remember to return 0 on success

#   return 0

#}

#postup() {

#   # This function could be used, for example, to register with a

#   # dynamic DNS service.  Another possibility would be to

#   # send/receive mail once the interface is brought up.

#   # Here is an example that allows the use of iproute rules

#   # which have been configured using the rules_eth0 variable.

#   #rules_eth0=(

#   #   "from 24.80.102.112/32 to 192.168.1.0/24 table localnet priority 100"

#   #   "from 216.113.223.51/32 to 192.168.1.0/24 table localnet priority 100"

#   #)

#   local x="rules_${IFVAR}[@]"

#   local -a rules=( "${!x}" )

#   if [[ -n ${rules} ]] ; then

#      einfo "Adding IP policy routing rules"

#      eindent

#      # Ensure that the kernel supports policy routing

#      if ! ip rule list | grep -q "^" ; then

#         eerror "You need to enable IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES)"

#         eerror "in your kernel to use ip rules"

#      else

#         for x in "${rules[@]}" ; do

#            ebegin "${x}"

#            ip rule add ${x} dev "${IFACE}"

#            eend $?

#         done

#      fi

#      eoutdent

#      # Flush the cache

#      ip route flush cache dev "${IFACE}"

#   fi

#}

#postdown() {

#   # Enable Wake-On-LAN for every interface except for lo

#   # Probably a good idea to set RC_DOWN_INTERFACE="no" in /etc/conf.d/rc

#   # as well ;)

#   [[ ${IFACE} != "lo" ]] && ethtool -s "${IFACE}" wol g

#   Automatically erase any ip rules created in the example postup above

#   if interface_exists "${IFACE}" ; then

#      # Remove any rules for this interface

#      local rule

#      ip rule list | grep " iif ${IFACE}[ ]*" | {

#         while read rule ; do

#            rule="${rule#*:}"   

#            ip rule del ${rule}

#         done

#      }

#      # Flush the route cache

#      ip route flush cache dev "${IFACE}"

#   fi

#   # Return 0 always

#   return 0

#}

#failup() {

#       # This function is mostly here for completeness... I haven't

#       # thought of anything nifty to do with it yet ;-)

#}

#faildown() {

#       # This function is mostly here for completeness... I haven't

#       # thought of anything nifty to do with it yet ;-)

#}

##############################################################################

# FORCING MODULES

# The Big Fat Warning :- If you use module forcing do not complain to us or

# file bugs about it not working!

#

# Loading modules is a slow afair - we have to check each one for the following

# 1) Code sanity

# 2) Has the required package been emerged?

# 3) Has it modified anything?

# 4) Have all the dependant modules been loaded?

# Then we have to strip out the conflicting modules based on user preference

# and default configuration and sort them into the correct order.

# Finally we check the end result for dependancies.

# This, of course, takes valuable CPU time so we provide module forcing as a

# means to speed things up. We still do *some* checking but not much.

# It is essential that you force modules in the correct order and supply all

# the modules you need. You must always supply an interface module - we

# supply ifconfig or iproute2.

# The Big Fat Warning :- If you use module forcing do not complain to us or

# file bugs about it not working!

# Now that we've warned you twice, here's how to do it

#modules_force=( "ifconfig" )

#modules_force=( "iproute2" "dhcpcd" )

# We can also apply this to a specific interface

#modules_force_eth1=( "iproute2" )

# The below will not work

#modules_force=( "dhcpcd" )

# No interface (ifconfig/iproute2)

#modules_force=( "ifconfig" "essidnet" "iwconfig" )

# Although it will not crash, essidnet will not work as it has to come after

# iwconfig

#modules_force=( "iproute2" "ifconfig" )

# The interface will be setup twice which will cause problems

# /etc/conf.d/wireless:

# Global wireless config file for net.* rc-scripts

##############################################################################

# IMPORTANT

# linux-wlan-ng is not supported as they have their own configuration program

# ensure that /etc/conf.d/net has the entry "!iwconfig" in it's modules line

# Try and use an alternative driver if you need to use this - hostap-driver

# supports non-usb linux-wlan-ng driven devices

##############################################################################

##############################################################################

# HINTS

##############################################################################

# Remember to change eth0 to your wireless interface which may be

# eth0, eth1, wlan0, ath0 - you get the idea. If you're not sure

# you can type "iwconfig" at the command prompt and it will tell you which

# interfaces are wireless.

# Say that your wireless interface is ath0 - the line

#      #essid_eth0="any"

# becomes

#      #essid_ath0="any"

#

# Remember to change ESSID to your ESSID.

# Say that your ESSID is My NET - the line

#      #key_ESSID="s:passkey"

# becomes

#      #key_My_NET="s:passkey"

# Notice that the space has changed to an underscore - do the same with all

# characters not in a-z A-Z (english alphabet) 0-9. This only applies to

# variables and not values.

#

# Any ESSID's in values like essid_eth0="My NET" may need to be escaped

# This means placing the character \ before the character

# \" need to be escaped for example

# So if your ESSID is

#      My "\ NET

# it becomes

#      My \"\\ NET

# for example

#      #essid_eth0="My\"\\NET"

#

# So using the above we can use

#      #dns_domain_My____NET="My\"\\NET"

# which is an invalid dns domain, but shows the how to use the variable

# structure

#

# As a final note, most users will just need to set the following options

# key_ESSID1="s:yourkeyhere enc open" # s: means a text key

# key_ESSID2="aaaa-bbbb-cccc-dd"      # no s: means a hex key

# preferred_aps=( "ESSID1" "ESSID2" )

#

# Clear? Good. Now configure your wireless network below

#########################################################

##############################################################################

# SETTINGS

##############################################################################

# Hard code an ESSID to an interface - leave this unset if you wish the driver

# to scan for available Access Points

# Set to "any" to connect to any ESSID - the driver picks an Access Point

# This needs to be done when the driver doesn't support scanning

# This may work for drivers that don't support scanning but you need automatic

# AP association

# I would only set this as a last resort really - use the preferred_aps

# setting at the bottom of this file

# However, using ad-hoc (without scanning for APs) and master mode

# do require the ESSID to be set - do this here

#essid_eth0="any"

essid_eth2="myessid"

# Set the mode of the interface (managed, ad-hoc, master or auto)

# The default is auto

# If it's ad-hoc or master you also may need to specify the channel below

#mode_eth0="auto"

mode_eth2="Managed"

# If managed mode fails, drop to ad-hoc mode with the below ESSID?

#adhoc_essid_eth0="WLAN"

#Channel can be set (1-14), but defaults to 3 if not set.

#

# The below is taken verbatim from the BSD wavelan documentation found at

# http://www.netbsd.org/Documentation/network/wavelan.html

# There are 14 channels possible; We are told that channels 1-11 are legal for

# North America, channels 1-13 for most of Europe, channels 10-13 for France,

# and only channel 14 for Japan. If in doubt, please refer to the documentation

# that came with your card or access point. Make sure that the channel you

# select is the same channel your access point (or the other card in an ad-hoc

# network) is on. The default for cards sold in North America and most of Europe

# is 3; the default for cards sold in France is 11, and the default for cards

# sold in Japan is 14.

#channel_eth0="3"

#channel_eth1="4"

channel_eth2="4"

# Setup any other config commands. This is basically the iwconfig argument

# without the iwconfig $iface

#iwconfig_eth0=""

# Set private driver ioctls. This is basically the iwpriv argument without

# the iwpriv $iface

#iwpriv_eth0=""

# Seconds to wait before scanning

# Some drivers need to wait until they have finished "loading"

# before they can scan - otherwise they error and claim that they cannot scan

# or resource is unavailable. The default is to wait zero seconds

#sleep_scan_eth0="1"

sleep_scan_eth2="5"

# Seconds to wait until associated. The default is to wait 10 seconds

#sleep_associate_eth0="5"

sleep_associate_eth2="15"

# By default a successful association in Managed mode sets the MAC

# address of the AP connected to. However, some drivers (namely

# the ipw2100) don't set an invalid MAC address when association

# fails - so we need to check on link quality which some drivers

# don't report properly either.

# So if you have connection problems try flipping this setting

# Valid options are MAC, quality and all - defaults to MAC

#associate_test_eth0="MAC"

# Some driver/card combinations need to scan in Ad-Hoc mode

# After scanning, the mode is reset to the one defined above

#scan_mode_eth0="Ad-Hoc"

# Below you can define private ioctls to run before and after scanning

# Format is the same as the iwpriv_eth0 above

# This is needed for the HostAP drivers

#iwpriv_scan_pre_eth0="host_roaming 2"

#iwpriv_scan_post_eth0="host_roaming 0"

# Define a WEP key per ESSID or MAC address (of the AP, not your card)

# The encryption type (open or restricted) must match the

# encryption type on the Access Point

# You can't use "any" for an ESSID here

#key_ESSID="1234-1234-1234-1234-1234-1234-56"

key_myessid="XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX enc restricted"

# or you can use strings. Passphrase IS NOT supported

# To use a string, prefix it with s:

# Note - this example also sets the encryption method to open

# which is regarded as more secure than restricted

#key_ESSID="s:foobar enc open"

#key_ESSID="s:foobar enc restricted"

# If you have whitespace in your key, here's how to set it and use other

# commands like using open encryption.

#key_ESSID="s:'foo bar' enc open"

# WEP key for the AP with MAC address 001122334455

#key_001122334455="s:foobar"

# Here are some more examples of keys as some users find others work

# and some don't where they should all do the same thing

#key_ESSID="open s:foobar"

#key_ESSID="open 1234-5678-9012"

#key_ESSID="s:foobar enc open"

#key_ESSID="1234-5678-9012 enc open"

# You may want to set muliple keys - here's an example

# It sets 4 keys on the card and instructs to use key 2 by default

#key_ESSID="[1] s:passkey1 key [2] s:passkey2 key [3] s:passkey3 key [4] s:passkey4 key [2]"

# You can also override the interface settings found in /etc/conf.d/net

# per ESSID - which is very handy if you use different networks a lot

#config_ESSID=( "dhcp" )

#dhcpcd_ESSID="-t 5"

#routes_ESSID=()

#fallback_ESSID=()

# Setting name/domain server causes /etc/resolv.conf to be overwritten

# Note that if DHCP is used, and you want this to take precedence then

# please put -R in your dhcpcd options

#dns_servers_ESSID=( "192.168.0.1" "192.168.0.2" )

#dns_domain_ESSID="some.domain"

#dns_search_path_ESSID="search.this.domain search.that.domain"

# Please check the man page for resolv.conf for more information

# as domain and search (searchdomains) are mutually exclusive and

# searchdomains takes precedence

# You can also set any of the /etc/conf.d/net variables per MAC address

# incase you use Access Points with the same ESSID but need different

# networking configs. Below is an example - of course you use the same

# method with other variables

#config_001122334455=( "dhcp" )

#dhcpcd_001122334455="-t 10"

#dns_servers_001122334455=( "192.168.0.1" "192.168.0.2" )

# Map a MAC address to an ESSID

# This is used when the Access Point is not broadcasting it's ESSID

# WARNING: This will override the ESSID being broadcast due to some

# Access Points sending an ESSID even when they have been configured

# not too!

# Change 001122334455 to the MAC address and ESSID to the ESSID

# it should map to

#essid_001122334455="ESSID"

essid_XXXXXXXXXXXX="myessid"

# This lists the preferred ESSIDs to connect to in order

# ESSID's can contain any characters here as they must match the broadcast

# ESSID exactly.

# Surround each ESSID with the " character and seperate them with a space

# If the first ESSID isn't found then it moves onto the next

# If this isn't defined then it connects to the first one found

#preferred_aps=( "ESSID 1" "ESSID 2" )

# You can also define a preferred_aps list per interface

#preferred_aps_eth0=( "ESSID 3" "ESSID 4" )

preferred_aps_eth2=( "myessid" )

# You can also say whether we only connect to preferred APs or not

# Values are "any", "preferredonly", "forcepreferred", "forcepreferredonly" and "forceany"

# "any" means it will connect to visible APs in the preferred list and then any

# other available AP

# "preferredonly" means it will only connect to visible APs in the preferred list

# "forcepreferred" means it will forceably connect to APs in order if it does not find

# them in a scan

# "forcepreferredonly" means it forceably connects to the APs in order and does not bother

# to scan

# "forceany" does the same as forcepreferred + connects to any other available AP

# Default is "any"

#associate_order="any"

#associate_order_eth0="any"

associate_order_eth2="forcepreferred"

# You can define blacklisted Access Points in the same way

#blacklist_aps=( "ESSID 1" "ESSID 2" )

#blacklist_aps_eth0=( "ESSID 3" ESSID 4" )

# If you have more than one wireless card, you can say if you want

# to allow each card to associate with the same Access Point or not

# Values are "yes" and "no"

# Default is "yes"

#unique_ap="yes"

#unique_ap_eth0="yes"

# IMPORTANT: preferred_only, blacklisted_aps and unique_ap only work when

# essid_eth0 is not set and your card is capable of scanning

# NOTE: preferred_aps  list ignores blacklisted_aps - so if you have

# the same ESSID in both, well, you're a bit silly :p

```

Here's what my prism54 script look like:

```

#!/bin/bash

# script name:  prism54script

# script location: /etc/hotplug/pci

# replace the script name to:  prism54

# and:  chmod a+x prism54

# description:  myprism54 autostart script

# auth:  beastmaster

# for restart:  /etc/hotplug/pci/prism54

# version: 0.2

# /etc/init.d/net.eth2 start

# optional, it's for eth0 auto start

# you can always just do dhcpcd eth0 later

ifconfig eth2 up # wake up eth2 (wireless network slot)

sleep 1

#echo "---Setting WL Card Mode:-------------------------"

echo "iwconfig eth2 mode Managed"

#iwconfig eth2 mode "Managed" # as client mode

#echo "---I AM EXECUTING:-------------------------"

#echo "iwlist eth2 scan"

iwlist eth2 scan

# just to see what essid access points are available there

# you can change access point network manually later.

# just do iwconfig eth2 essid nameofessidofyourchoice

 sleep 1

#echo "---Setting WL Node and Security:-------------------------"

# with static wireless network

# should manually add your own key (for accessing encrypted wireless network) here:

iwconfig eth2 key XXXXXXXXXXXXXXXXXXXXXXXXXX [1]

iwconfig eth2 key XXXXXXXXXXXXXXXXXXXXXXXXXX [2]

iwconfig eth2 key XXXXXXXXXXXXXXXXXXXXXXXXXX [3]

iwconfig eth2 key XXXXXXXXXXXXXXXXXXXXXXXXXX [4]

iwconfig eth2 essid "myessid"

iwconfig eth2 channel "4"

# above, should replace name OfThe Essid to your choice

# or just do: dhcpcd, let it auto-start/configure

sleep 1

#echo "dhcpcd eth2"

dhcpcd eth2

```

----------

## UberLord

Try posting a new thread, but this time comment strip your files as it's too hard to diagnose like it is.

----------

