# ? setting up /etc/conf.d/net

## Phr34K

this is my '/etc/conf.d/net' file:

```
# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

#iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"

# For DHCP set iface_eth? to "dhcp"

# For passing options to dhcpcd use dhcpcd_eth?

#

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 5"

#iface_eth1="dhcp"

#dhcpcd_eth1="-t 5"

#wireless connection config:

# set modules

modules=( "iwconfig" )

# set preferred networks

preferred_aps_eth1=( "default" )

associate_order_eth1="forceany"

# wireless @ home

essid_eth1="default"

key_default="??????????"

config_default=( "dhcp" )

dhcpcd_default="-t 5"

# wireless @ anywhere

essid_eth1="any"

config_any=( "dhcp" )

dhcpcd_any="-t 5"
```

my problem is that it won't connect to 'default' when I'm booting, it connects to other random networks that aren't listed.  I know that I have "any" listed, but shouldn't it try to connect to my preferred aps first?  Thus far, I have to manually connect to my home network (iwconfig eth1 essid default key ??????????).  

Anyone know what I'm doing wrong??  Thnx for any help.

----------

## TheRAt

As I see that config file:

You set: essid_eth1="default"

Then  you change this: essid_eth1="any"

The key is then ignored.. as essid_eth1 is set to "any"

Try adding:

```
key_any=??????????
```

I use the /etc/conf.d/wireless file to set my parameters for the wireless card... You may wish to explore that.. I use ndiswrapper though, so this might not apply to your setup...

----------

## nichocouk

According to this HOWTO http://gentoo-wiki.com/HOWTO_Wireless_Configuration_and_Startup it seems easier to set up Wireless access to several APs by using wpa_supplicant. Although I have only one AP at the moment, I found it easier to set up my wireless connection using wpa_supplicant than with iwconfig. You might try it, it doesn't cost anything  :Smile: 

----------

## Phr34K

here are my files:

```
# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 5"

modules=( "wpa_supplicant" )

wpa_supplicant_eth1="-Dipw2100"

wpa_timeout_eth1=5
```

```
# /etc/conf.d/wireless

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/wireless,v 1.7 2002/11/18 19:39:22 azarah Exp $

# set preferred networks

preferred_aps_eth1=( "default" )

associate_order_eth1="any"

# wireless @ home

essid_eth1="default"

key_default="??????????"

config_default=( "dhcp" )

dhcpcd_default="-t 5"

# wireless @ anywhere

config_any=( "dhcp" )

dhcpcd_any="-t 5"
```

```
# /etc/conf.d/wpa_supplicant

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/files/wpa_supplicant-0.2.7-conf.d,v 1.1 2005/02/14 14:20:15 brix Exp $

# List of interfaces

INTERFACES="eth1"

# Common arguments to all wpa_supplicant instances

ARGS="-w"

# Interface specific arguments

ARGS_eth1="-Dipw2100"
```

```
# /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

eapol_version=1

ap_scan=1

network={

   ssid="default"

   psk="??????????"

   priority=9

}

network={

   ssid="any"

   priority=1

}   

```

I get this error when trying '/etc/init.d/net.eth1 start' :

```
 * Starting eth1

 *    Starting wpa_supplicant on eth1 ...

Line 15: WPA-PSK accepted for key management, but no PSK configured.

Line 15: failed to parse network block.

Failed to read configuration file '/etc/wpa_supplicant.conf'.                              [ !! ]
```

the WEP key (??????????) for default is just a 10 character Hex number.  I don't know whats going on.

Would both of you mind posting your /etc/conf.d/net & /etc/conf.d/wireless & /etc/conf.d/wpa_supplicant & /etc/wpa_supplicant.conf ?  

Thnx for the help.

----------

## UberLord

Heh - you're doing too much.

You either use wpa_supplicant or iwconfig (conf.d/wireless) but not both!

You haven't specified the need for WPA - which is good as wpa_supplicant can only connect to defined SSIDs - you cannot include a generic one afaik.

Here's a config for iwconfig

/etc/conf.d/net

```

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 5"

```

/etc/conf.d/wireless

```

preferred_aps=( "default" )

key_default="??????????"

```

As to the error you're getting, you need to define a psk OR specify no key management in each network block in /etc/wpa_supplicant.conf

----------

## Phr34K

You are exactly right, I was doing too much.  

this is the setting that works:

```
# /etc/conf.d/wireless

# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/wireless,v 1.7 2002/11/18 19:39:22 azarah Exp $

# set preferred networks

preferred_aps_eth1=( "default" )

associate_order_eth1="any"

# wireless @ home

#essid_eth1="default"

key_default="??????????"

config_default=( "dhcp" )

dhcpcd_default="-t 3"

# wireless @ UF

config_ufw=( "dhcp" )

dhcpcd_ufw="-t 3"

# wireless @ anywhere

config_any=( "dhcp" )

dhcpcd_any="-t 5"

```

```
# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

#iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"

# For DHCP set iface_eth? to "dhcp"

# For passing options to dhcpcd use dhcpcd_eth?

#

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 3"

#iface_eth1="dhcp"

#dhcpcd_eth1="-t 5"

#wireless connection config:

# set modules

modules=( "iwconfig" )

#modules=( "wpa_supplicant" )

# set preferred networks

preferred_aps_eth1=( "default" )

associate_order_eth1="any"

# wireless @ home

key_default="??????????"

config_default=( "dhcp" )

dhcpcd_default="-t 3"

# wireless @ UF

config_ufw=( "dhcp" )

dhcpcd_ufw="-t 3"

# wireless @ anywhere

config_eth1=( "dhcp" )

dhcpcd_eth1="-t 10"

#wpa_supplicant_eth1="-Dipw2100"

#wpa_timeout_eth1=5

```

Thnx for all the help!

----------

## UberLord

You're still doing too much - either put the wireless settings in /etc/conf.d/net or /etc/conf.d/wireless but not both!

----------

## Phr34K

lol, thnx!

----------

## Phr34K

hey, I'm able to log into networks just fine, but when I restart my computer and it tries running the eth1 stuff it tells me that 'dhcpcd is already running on eth1' and I have to run '/etc/init.d/net.eth1 restart' so I can get an IP.  

any ideas?

----------

## UberLord

https://bugs.gentoo.org/show_bug.cgi?id=78495

----------

## Phr34K

that worked.  Thnx!

----------

