# Connection missed after emerging the new baselayout

## mirek

My  /etc/conf.d/net

```

# /etc/conf.d/net: Global config file for net.* rc-scripts

# $Header: /var/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.11 2004/08/01 22:28:18 agriffis Exp $

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

#

#                      READ THIS COMMENT FIRST

#

# PLEASE PICK ONE of the configuration methods listed below.  If you

# don't know which to pick, use the top one, NEW-STYLE IFCONFIG.

# The other two possible options are OLD-STYLE IFACE and

# IPROUTE2-STYLE.

#

# If you have multiple sections (for example IFCONFIG and IPROUTE2)

# the network scripts will attempt to make reasonable assumptions

# about what to use, but there is no guarantee on the results, so

# PLEASE just use one set of configuration variables.

#

# At the bottom there is an ADVANCED CONFIGURATION section with some

# additional configuration possibilities

#

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

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

#   NEW-STYLE IFCONFIG examples

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

#   This uses /sbin/ifconfig and /sbin/route to set the network up.

#   It is suitable for most home users.

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

# To use DHCP on eth0, simply uncomment the following line:

ifconfig_eth0=( "dhcp" )

ifconfig_eth1=( "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.  Note that this might be too short for some servers,

# so the default is encouraged unless you know what you're doing.

dhcpcd_eth0="-R -t 10"

dhcpcd_eth1="-R -t 10"

# For a static configuration, use something like this.  This sets the primary

# eth0 address to 192.168.0.2 and adds two aliases, eth0:1 and eth0:2

#ifconfig_eth0=(

#   "192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

#   "192.168.0.3 broadcast 192.168.0.255 netmask 255.255.255.0"

#   "192.168.0.4 broadcast 192.168.0.255 netmask 255.255.255.0"

#)

# This is just like setting the gateway config option in the old-style iface

# config, but allows one to add custom routes.  This should not be needed if you

# are obtaining an address via DHCP since the default route should be set

# automatically.

#routes_eth0=(

#   "default gw 192.168.0.1"

#)

# VLAN support - emerge net-misc/vconfig 

# Please ensure your VLAN IDs are NOT zero-padded

#vlans_eth0="1 2"

#ifconfig_eth0_1=( "dhcp" )

#ifconfig_eth0_2=( "172.16.2.1 broadcast 172.16.3.255 netmask 255.255.254.0" )

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

#   OLD-STYLE IFACE examples (deprecated)

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

#   This uses /sbin/ifconfig and /sbin/route to set the network up,

#   but is not as flexible as the IFCONFIG method above or the

#   IPROUTE2 method below.

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

# To use DHCP on eth0, simply uncomment the following line:

#iface_eth0="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.  Note that this might be too short for some servers,

# so the default is encouraged unless you know what you're doing.

#dhcpcd_eth0="-t 10"

# To set a static IP address use a line similar to this

#iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

# For setting the default gateway.  You should not need to do this if you use

# DHCP since the default gateway should be set automatically.

#gateway="eth0/192.168.0.1"

# For adding aliases to a interface, specify them space-separated in the

# following string

#alias_eth0="192.168.0.3 192.168.0.4"

# To add a custom netmask/broadcast address to created aliases, specify them in

# the same order as the alias_eth0 string.  If you find yourself doing this, you

# might consider switching to the new-style

#broadcast_eth0="192.168.0.255 192.168.0.255"

#netmask_eth0="255.255.255.0 255.255.255.0"

# VLAN support - emerge net-misc/vconfig

# Please ensure your VLAN IDs are NOT zero-padded

#vlans_eth0="1 2"

#iface_eth0_1="dhcp"

#iface_eth0_2="172.16.2.1 broadcast 172.16.3.255 netmask 255.255.254.0"

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

#   IPROUTE2-STYLE CONFIGURATION

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

#   This makes use of the /sbin/ip command to set routes and ip

#   addresses.  This style is very useful if you are building an

#   advanced linux router or using VRRP For more information on how to

#   use the iproute2 command have a look at the ip(8) man page.

#

#   NOTE: You must emerge sys-apps/iproute2 to use this configuration

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

# To use DHCP on eth0, simply uncomment the following line:

#ipaddr_eth0=( "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.  Note that this might be too short for some servers,

# so the default is encouraged unless you know what you're doing.

#dhcpcd_eth0="-t 10"

# For a static configuration, use something like this.  This sets the primary

# eth0 address to 192.168.0.2 and adds two aliases, eth0:1 and eth0:2.

# You may also pass advanced ip addr commands via this option.

#ipaddr_eth0=(

#   "192.168.0.2/24 brd 192.168.0.255"

#   "192.168.0.3/24 brd 192.168.0.255"

#   "192.168.0.4/24 brd 192.168.0.255"

#)

# The following will set up the default gateway. You can also pass advanced

# route configs via this option.

#iproute_eth0=(

#   "default via 192.168.0.1"

#)

# VLAN support - emerge net-misc/vconfig

# Please ensure your VLAN IDs are NOT zero-padded

#vlans_eth0="1 2"

#ipaddr_eth0_1=( "dhcp" )

#ipaddr_eth0_2=( "172.16.2.1/23 brd 172.16.3.255" )

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

#   ADVANCED CONFIGURATION

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

#   The items in this section can be combined with one of the sections

#   above to create a complete network configuration.  None of the

#   items in this section are necessary to configure for most users.

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

# 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.

#

# 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 and postdown functions are ignored

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

#preup() {

#   # Uncomment this function below if you want to check for link

#   # Remember to uncomment the preup_linkdetect function!

#   #preup_linkdetect $1

#

#   # Enable this function with this next line if you want to change your 

#   # MAC address. Remember to uncomment the preup_macchanger function!

#   #preup_macchanger $1

#

#   # Remember to return 0 on success

#   return 0

#}

#predown() {

#   # Test to make sure the root filesystem is not mounted via NFS.

#   # Interface ($1) is ignored but could also be tested.

#   #if grep -q ' / nfs ' /proc/mounts; then

#   #   ewarn "Root is NFS mounted, aborting deconfiguration of $1"

#   #   return 1

#   #fi

#

#   # Bonding support

#   #predown_bonding $1

#

#   # 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.

#

#   # Enable this function with the next line if you want to use bonding.

#   # Remember to uncomment the preup_bonding function!

#   #postup_bonding $1

#

#   # Return 0 for success (ignored)

#   return 0

#}

#postdown() {

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

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

#

#   # Return 0 for success (ignored)

#   return 0

#}

# For changing MAC addresses - emerge net-analyzer/macchanger

# - to set a specific MAC address

#mac_eth0="00:11:22:33:44:55"

# - to randomize the last 3 bytes only

#mac_eth0="random-ending"

# - to randomize between the same physical type of connection (eg fibre, copper, wireless) , all vendors

#mac_eth0="random-samekind"

# - to randomize between any physical type of connection (eg fibre, copper, wireless) , all vendors

#mac_eth0="random-anykind"

# - full randomization - WARNING: some MAC addresses generated by this may NOT act as expected

#mac_eth0="random-full"

# custom - passes all parameters directly to net-analyzer/macchanger

#mac_eth0="some custom set of parameters"

# uncomment this function for support for changing MAC addresses

# also uncomment it's invocation in preup() above

#preup_macchanger() {

#   eval mac_IFACE=\"\$\{mac_${IFACE}\}\"

#   if [ -n "${mac_IFACE}" ]; then

#      if [[ -x /sbin/macchanger ]]; then

#         local macchanger_opts=""

#         case "${mac_IFACE}" in

#            # specific mac-addr, i wish there were a shorter way to specify this 

#            [0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]) macchanger_opts="${macchanger_opts} --mac=${mac_IFACE}" ;;

#            # increment MAC address, default macchanger behavior

#            increment) macchanger_opts="${macchanger_opts}" ;;

#               # randomize just the ending bytes

#               random-ending) macchanger_opts="${macchanger_opts} -e" ;;

#               # keep the same kind of physical layer (eg fibre, copper)

#               random-samekind) macchanger_opts="${macchanger_opts} -a" ;;

#               # randomize to any known vendor of any physical layer type

#               random-anykind) macchanger_opts="${macchanger_opts} -A" ;;

#               # fully random bytes

#               random-full) macchanger_opts="${macchanger_opts} -r" ;;

#               # default case is just to pass on all the options

#            *) macchanger_opts="${macchanger_opts} ${mac_IFACE}" ;;

#         esac

#           #echo "/sbin/macchanger ${macchanger_opts} ${IFACE}"

#           /sbin/macchanger ${macchanger_opts} ${IFACE} >/dev/null 

#         retval=$?

#         if [ $retval -gt 0 ]; then

#            eerror "Failed to set MAC address"

#            return 1

#         fi

#      else   

#         eerror "For changing MAC addresses, emerge net-analyzer/macchanger"

#         return 1

#      fi

#   fi

#   return 0 #important

#}

# For link bonding/trunking - emerge net-misc/ifenslave

# if you are using any of the slave interfaces, it is important that you remove

# configurations for them and take them down first!

#slaves_bond0="eth2"

#ipaddr_bond0=( "172.16.2.1/23 brd 172.16.3.255" )

#postup_bonding() {

#   # return silently if this is not a bonding interface

#   if [ -n "${IFACE/bond*/}" ]; then

#      return 0

#   fi

#   eval slaves_IFACE=\"\$\{slaves_${IFACE}\}\"

#   if [[ -n "${slaves_IFACE}" ]]; then

#      if [[ -x /sbin/ifenslave ]]; then

#         # must force the slaves to a particular state before adding them

#         for slaveiface in ${slaves_IFACE}; do

#            ifconfig ${slaveiface} 0.0.0.0 up

#         done

#         # now force the master to up

#         ifconfig ${IFACE} up

#         # finally add in slaves

#         /sbin/ifenslave ${IFACE} ${slaves_IFACE}

#      else

#         eerror "For link aggregation (bonding), emerge net-misc/ifenslave"

#         return 1

#      fi

#   fi

#   return 0 #important

#}

#predown_bonding() {

#   # return silently if this is not a bonding interface

#   if [ -n "${IFACE/bond*/}" ]; then

#      return 0

#   fi

#   # don't trust the config, get the active list instead

#   slaves_IFACE=$(awk '/^Slave Interface:/ { printf $3" " }' /proc/net/bonding/${IFACE})

#   if [[ -n "${slaves_IFACE}" ]]; then

#      # remove all slaves

#      echo /sbin/ifenslave -d ${IFACE} ${slaves_IFACE}

#      /sbin/ifenslave -d ${IFACE} ${slaves_IFACE}

#      # reset all slaves

#      for slaveiface in ${slaves_IFACE}; do

#         ifconfig ${slaveiface} 0.0.0.0 down

#      done

#   fi

#   return 0

#}

#preup_linkdetect() {

#   # 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 $1 | grep -q 'Link detected: no'; then

#      ewarn "No link on $1, aborting configuration"

#      return 1

#   fi

#}

RC_VERBOSE="yes"

key_lan="myWEPkey"

```

/etc/init.d/net.eth1 restart

```

Caching service dependencies …

Starting eth1

Loading networking modules for eth1

Modules: iwconfig essidnet iptunnel ifconfig dhcpcd apipa

iwconfig provides wireless

ifconfig provides interface

dhcpcd provides dhcpcd

Configuring wireless network for eth1

Scanning for access points

Found “lan” at 00:04:ED:05:2D:36 (WEP required)

WEP key is not set for “lan” – not connecting

Couldn’t associate with any access points on eth1

Failed to configure wireless for eth1
```

My WEP key was configured in /etc/hotplug/pci/prism54 before

----------

## rwgeorge

This happened to me, and I was able to connect by using iwconfig and manually entering my info...I connected once, and then after reboot, it works automatically each time.

----------

## UberLord

Your config can be trimmed down to this

```
RC_VERBOSE="yes"

config_eth0=( "dhcp" )

dhcpcd_eth0="-R -t 10"

config_eth1=( "dhcp" )

dhcpcd_eth1="-R -t 10" 

key_lan="myWEPkey"
```

----------

## mirek

@UberLord

OK, I have trimmed my config, but you now it not changed anything.

@rwgeorge

What do you mean as " manually entering my info..."

Could you explain a little more?

----------

## UberLord

http://dev.gentoo.org/~uberlord/baselayout/iwconfig

Save that to /lib/rcscripts/net.modules.d/iwconfig

Try again  :Smile: 

----------

## mirek

YES!! It works with the new iwconfig

Thanks a lot

What I have to do in the future. Have I do the same with iwconfig?

Can I unmask now

```

=sys-apps/baselayout-1.12.0_pre3

=sys-apps/baselayout-1.12.0_pre3-r1

=sys-apps/baselayout-1.12.0_pre3-r2

=net-wireless/wireless-tools-28_pre8-r1

=net-wireless/wireless-tools-27-r1
```

----------

## mirek

I have unmasked sys-apps/baselayout-1.12.0_pre3-r2 and missed my connection again. It is samething wrong with the new baselayouts. I am back on sys-apps/baselayout-1.11.13.

----------

## UberLord

You'll need to use the same iwconfig file from my dev area with both 1.11.13 and 1.12.0_pre3-r2

----------

## mirek

I have tied but it not worked

----------

## mirek

I emerged the new sys-apps/baselayout-1.12.0_pre5 yesterday, and missed my connection again. 

@UberLord

I used the same iwconfig file from your dev area but it not worked correctly.

I am back on sys-apps/baselayout-1.11.13.

----------

## mirek

Not working with sys-apps/baselayout-1.12.0_pre6 either.

----------

## mirek

I have changed

key_lan="myWEPkey"

to

iwconfig eth1 key myWEPkey

in my /etc/conf.d/net and now the wireless card is working well. It can be only temporary solution, because it makes trouble with my cable setup.

What I have to put here to get it working correctly?

----------

## UberLord

```
Found âlanâ at 00:04:ED:05:2D:36 (WEP required)

WEP key is not set for âlanâ â not connecting

Couldnât associate with any access points on eth1
```

Is that still the same error?

----------

## mirek

I have got this error

```
WEP key is not set for lan  not connecting 

Couldnt associate with any access points on eth1 

Failed to configure wireless for eth1
```

----------

## UberLord

Create a file - say called weptest in /root. Put this into it

```
#!/bin/bash

source /sbin/functions.sh

source /etc/conf.d/net

source /etc/conf.d/wireless

source /lib/rcscripts/net.modules.d/iwconfig

ESSID="lan"

ESSIDVAR=$( bash_variable "${ESSID}" )

iwconfig_get_wep_key

```

chmod +x /root/weptest

/root/weptest

And post the results

----------

## mirek

I have got:

```
# /root/weptest

/root/weptest: line 5: /etc/conf.d/wireless: No such file or di                           rectory

off
```

Because my WEP key is configured in /etc/hotplug/pci/prism54 I have changed weptest to:

```
#!/bin/bash 

source /sbin/functions.sh 

source /etc/conf.d/net 

#source /etc/conf.d/wireless 

source /etc/hotplug/pci/prism54

source /lib/rcscripts/net.modules.d/iwconfig 

ESSID="lan" 

ESSIDVAR=$( bash_variable "${ESSID}" ) 

iwconfig_get_wep_key
```

and now the result is:

```
# /root/weptest

off
```

My  /etc/hotplug/pci/prism54

```
#!/bin/bash 

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

iwconfig eth1 mode Managed 

iwconfig eth1 key MyKeyHere 

iwconfig eth1 essid "lan"

```

----------

## UberLord

 *mirek wrote:*   

> I have got:
> 
> ```
> # /root/weptest
> 
> ...

 

We don't use /etc/hotplug/pci/prism54 - who or what document told you to configure there is wrong.

Put the key in /etc/conf.d/net or /etc/conf.d/wireless

----------

## mirek

I have one SMC2835 prism54 card and hava use this disciption to setup it:

http://prism54.org/forums/viewtopic.php?t=253

----------

## UberLord

I have a prism54 card as well.

I am the principal developer of networking in Gentoo's baselayout.

I wrote the documentation for Gentoo networking.

Given the above, I can tell you that the forum thread to prism54 is old and a poster there called robpatriot even mentions me saying that I have way integrated into Gentoo.

So, when I say that setting anyting in /etc/hotplug/pci/prism54 will not work I mean it.

Try using official Gentoo documentation or from the non-official Gentoo wiki instead of non-official documentation.

----------

