# /etc/conf.d/net, hidden essid with static ip

## lucapost

This is my wpa_supplicant.conf:

```
 ~/> cat /etc/wpa_supplicant/wpa_supplicant.conf 

ap_scan=2

network={

        ssid="AAAA"     # hidden, static config

        scan_ssid=1

        key_mgmt=NONE

        wep_key0=xxxxxxxxxxxxxxxxxxxxx

        #wep_tx_keyidx=0 

        priority=1

        auth_alg=SHARED

}

network={

   ssid="BBBBB"                  # dhcp

   scan_ssid=1

   key_mgmt=WPA-PSK

   psk="bbbbb"

   priority=2

}

network={

   key_mgmt=NONE             #for all! only dhcp

   priority=-9999

}
```

and /etc/conf.d/net:

```
###########################################################

###########     WIRELESS WLA0      ########################

###########     WPA_SUPPLICANT     ########################

ctrl_interface_group=0

modules_wlan0="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext"

ap_scan=2

config_AAAAA="192.168.1.92 netmask 255.255.255.0"

routes_AAAAA="default via 192.168.1.1"

dns_servers_AAAAA="xxx.xxx.xxx.xxx"

wpa_timeout_wlan0=60

config_BBBBB="dhcp"
```

My problem is that the AAAAA is a hidden essid and I need set ip, gateway and dns with static configuration.

If I set 

```
config_wlan0="192.168.1.92"

routes_wlan0="default via 192.168.1.1"

dns_servers="xxx.xxx.xxx.xxx"

```

config works with essid AAAAA, but overwrite the config for AP whit dynamic config.

Can I solve this problem?

----------

## lucapost

up

----------

## lucapost

up

----------

## UberLord

mac_essid_001122334455="SSID"

Change 001122334455 to the MAC address of the AP and SSID to the actual name of it.

----------

## lucapost

My new /etc/conf.d/net:

```
ctrl_interface_group=0

modules_wlan0="!iwconfig"

modules_wlan0="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext"

ap_scan=2

wpa_timeout_wlan0=60

mac_essid_XXXXXXXXXXXX="AAAAA"

config_AAAAA="192.168.1.92 netmask 255.255.255.0"

routes_AAAAA="default via 192.168.1.1"

dns_servers_AAAAA="xxx.xxx.xxx.xxx"
```

I'm sure that I set mac and essid right, but my interface have not ip:

```
 ~> wpa_cli status

Selected interface 'wlan0'

bssid=XX:XX:XX:XX:XX:XX

ssid=AAAAA

id=0

pairwise_cipher=WEP-104

group_cipher=WEP-104

key_mgmt=NONE

wpa_state=COMPLETED
```

if I change my /etc/conf.d/net in:

```
ctrl_interface_group=0

modules_wlan0="!iwconfig"

modules_wlan0="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext"

ap_scan=2

wpa_timeout_wlan0=60

config_wlan0="192.168.1.92 netmask 255.255.255.0"

routes_wlan0="default via 192.168.1.1"

dns_servers_wlan0="xxx.xxx.xxx.xxx"
```

wpa_cli said:

```
 ~> wpa_cli status

Selected interface 'wlan0'

bssid=XX:XX:XX:XX:XX:XX

ssid=AAAAA

id=0

pairwise_cipher=WEP-104

group_cipher=WEP-104

key_mgmt=NONE

wpa_state=COMPLETED

ip_address=192.168.1.92   
```

and my wifi connection go up.

Other info:

```
 ~> eix ndiswrapp -cI ; eix baselayout -cI

[I] net-wireless/ndiswrapper (1.50_rc2@12/06/2007): Wrapper for using Windows drivers for some wireless cards

[I] sys-apps/baselayout (2.0.0_rc6@11/17/2007): Filesystem baselayout and init scripts
```

----------

## UberLord

OK, the chances are that your SSID entry is infact wrong. As you're masking it we can't tell you what is wrong with it.

You're also using an experimental baselayout version. To check that it really is getting the ssid correctly from wpa_cli do this once it has connected

```
 ( . /lib/rc/net/wpa_supplicant.sh; IFACE=wlan0; _get_ssid )

( . /lib/rc/net/iwconfig.sh; IFACE=wlan0; _get_ssid )
```

The brackets ARE important. You should see exactly the same SSID echoed twice. If not, we have a problem and you need to do this instead

```
 ( . /lib/rc/net/wpa_supplicant.sh; IFACE=wlan0; set -x; _get_ssid )

( . /lib/rc/net/iwconfig.sh; IFACE=wlan0; set -x; _get_ssid )
```

and email me the exact contents to roy@marples.name, or post them here.

----------

## lucapost

I start my initscpript whit this options:

```

~/>cat /etc/conf.d/net

...

config_wlan0="192.168.1.92 netmask 255.255.255.0"

routes_wlan0="default via 192.168.1.1"

dns_servers_wlan0="xxx.xxx.xxx.xxx"
```

and the connection is up, wlan0 have ip:

```
 ~> ifconfig wlan0

wlan0     Link encap:Ethernet  HWaddr 00:17:31:3D:FB:7D  

          inet addr:192.168.1.92  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1155 errors:0 dropped:0 overruns:0 frame:0

          TX packets:706 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:449079 (438.5 Kb)  TX bytes:115586 (112.8 Kb)

          Interrupt:19 Memory:df7fc000-df7fe000
```

and i get the same essid:

```

root@jarod 

 ~>  ( . /lib/rc/net/wpa_supplicant.sh; IFACE=wlan0; _get_ssid ) 

AAAAA

root@jarod 

 ~> ( . /lib/rc/net/iwconfig.sh; IFACE=wlan0; _get_ssid )

AAAAA
```

If i start initscript whit this options:

```
mac_essid_XXXXXXXXXXXX="AAAAA"

config_AAAAA="192.168.1.92 netmask 255.255.255.0"

routes_AAAAA="default via 192.168.1.1"

dns_servers_AAAAA="xxx.xxx.xxx.xxx"
```

i get:

```

root@jarod 

 ~>  ( . /lib/rc/net/wpa_supplicant.sh; IFACE=wlan0; _get_ssid ) 

AAAAA

root@jarod 

 ~> ( . /lib/rc/net/iwconfig.sh; IFACE=wlan0; _get_ssid )

AAAAA
```

but no ip is set for wlan0:

```
 ~> ifconfig wlan0

wlan0     Link encap:Ethernet  HWaddr 00:17:31:3D:FB:7D  

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1181 errors:0 dropped:0 overruns:0 frame:0

          TX packets:766 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:451624 (441.0 Kb)  TX bytes:128606 (125.5 Kb)

          Interrupt:19 Memory:df7fc000-df7fe000 
```

----------

## UberLord

Post the output of this

IN_BACKGROUND=true /etc/init.d/net.wlan0 restart

----------

## lucapost

whit this config:

```
ctrl_interface_group=0

modules_wlan0="!iwconfig"

modules_wlan0="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext"

ap_scan=2

wpa_timeout_wlan0=60

mac_essid_XXXXXXXXXXXXX="AAAAA"

config_AAAAA="192.168.1.92 netmask 255.255.255.0"

routes_AAAAA="default via 192.168.1.1"

dns_servers_AAAAA="xxx.xxx.xxx.xxx"
```

the output is:

```
root@jarod 

 ~> IN_BACKGROUND=true /etc/init.d/net.wlan0 restart

net.wlan0     | * Bringing up interface wlan0

net.wlan0     | *   Loaded modules: apipa arping tuntap ccwgroup macchanger macnet wpa_supplicant ssidnet ifconfig pppd system dhcpcd ip6to4

net.wlan0     | *   Configuring wlan0 for MAC address 00:17:31:3D:FB:7D ...                                                                              [ ok ]

net.wlan0     | *   No configuration specified; defaulting to DHCP

net.wlan0     | *   dhcp ...

net.wlan0     | *     Running dhcpcd ...

net.wlan0     |Error, wlan0: timed out                                                                                                                   [ ok ]

net.wlan0     | *     received address 169.254.99.236/16 
```

with random ip.

If I set parameters with config_wlan0, routes_wlan0 and dns_servers_wlan0, network go up and i get this:

```
 ~> IN_BACKGROUND=true /etc/init.d/net.wlan0 restart

net.wlan0     | * Bringing up interface wlan0

net.wlan0     | *   Loaded modules: apipa arping tuntap ccwgroup macchanger macnet wpa_supplicant ssidnet ifconfig pppd system dhcpcd ip6to4

net.wlan0     | *   Configuring wlan0 for MAC address 00:17:31:3D:FB:7D ...                                                                              [ ok ]

net.wlan0     | *   192.168.1.92 netmask 255.255.255.0 ...

net.wlan0     |SIOCSIFADDR: File exists

net.wlan0     |SIOCSIFNETMASK: Cannot assign requested address                                                                                           [ ok ]

net.wlan0     | *   Adding routes

net.wlan0     | *     default via 192.168.1.1 ... 
```

----------

## UberLord

OK, with the config you expect to work, do this

```
/etc/init.d/net.wlan restart

# wait for wpa_cli to report a valid connection

IN_BACKGROUND=true /etc/init.d/net.wlan0 restart &>/tmp/debug
```

And email the file /tmp/debug to roy@marples.name and I should be able to see where it's going wrong.

----------

## lucapost

this is the output:

```
root@jarod 

 ~> /etc/init.d/net.wlan0 restart

net.wlan0     | * Bringing down interface wlan0

net.wlan0     | *   Loaded modules: ip6to4 dhcpcd udhcpc dhclient system pppd ifconfig ssidnet wpa_supplicant iwconfig netplugd ipppd ifplugd macnet macchanger ccwgroup tuntap br2684ctl arping apipa

net.wlan0     | *   Stopping dhcpcd on wlan0 ...                                                                                                         [ ok ]

net.wlan0     | *   Removing addresses

net.wlan0     | *     169.254.189.156/16

net.wlan0     | *     Stopping wpa_cli on wlan0 ...

net.wlan0     | *     Will stop PID in pidfile `/var/run/wpa_cli-wlan0.pid'

net.wlan0     | *     Will stop processes of `/usr/bin/wpa_cli'

net.wlan0     | *     Sending signal 15 to PID 2005 ...                                                                                                  [ ok ]

net.wlan0     | *     Stopping wpa_supplicant on wlan0 ...

net.wlan0     | *     Will stop PID in pidfile `/var/run/wpa_supplicant-wlan0.pid'

net.wlan0     | *     Will stop processes of `/usr/sbin/wpa_supplicant'

net.wlan0     | *     Sending signal 15 to PID 1998 ...                                                                                                  [ ok ]

net.wlan0     | * Caching service dependencies ...                                                                                                       [ ok ]

net.wlan0     | * Bringing up interface wlan0

net.wlan0     | *   Loaded modules: apipa arping tuntap ccwgroup macchanger macnet wpa_supplicant ssidnet ifconfig pppd system dhcpcd ip6to4

net.wlan0     | *   Configuring wlan0 for MAC address 00:17:31:3D:FB:7D ...                                                                              [ ok ]

net.wlan0     | *   Starting wpa_supplicant on wlan0 ...

net.wlan0     | *   Detaching to start `/usr/sbin/wpa_supplicant' ...                                                                                    [ ok ]

net.wlan0     | *   Starting wpa_cli on wlan0 ...

net.wlan0     | *   Detaching to start `/usr/bin/wpa_cli' ...                                                                                            [ ok ]

net.wlan0     | *   Backgrounding ... ...

net.wlan0     | * WARNING: net.wlan0 has started, but is inactive

root@jarod 

 ~> wpa_cli status

Selected interface 'wlan0'

bssid=00:0f:3d:04:06:47

ssid=INFIS

id=0

pairwise_cipher=WEP-104

group_cipher=WEP-104

key_mgmt=NONE

wpa_state=COMPLETED

ip_address=169.254.189.156

root@jarod 

 ~> IN_BACKGROUND=true /etc/init.d/net.wlan0 restart &> debug

root@jarod 

 ~> cat debug 

 * Bringing down interface wlan0

 *   Loaded modules: ip6to4 dhcpcd udhcpc dhclient system pppd ifconfig ssidnet wpa_supplicant iwconfig netplugd ipppd ifplugd macnet macchanger ccwgroup tuntap br2684ctl arping apipa

 *   Stopping dhcpcd on wlan0 ... [ ok ]

 *   Removing addresses

 * Bringing up interface wlan0

 *   Loaded modules: apipa arping tuntap ccwgroup macchanger macnet wpa_supplicant ssidnet ifconfig pppd system dhcpcd ip6to4

 *   Configuring wlan0 for MAC address 00:17:31:3D:FB:7D ... [ ok ]

 *   No configuration specified; defaulting to DHCP

 *   dhcp ... *     Running dhcpcd ...Error, wlan0: timed out

 [ ok ]

 *     received address 169.254.189.156/16

 [ ok ]
```

----------

## UberLord

Gah, you need to add the --debug flag!

```
/etc/init.d/net.wlan restart 

# wait for wpa_cli to report a valid connection 

IN_BACKGROUND=true /etc/init.d/net.wlan0 --debug restart &>/tmp/debug
```

----------

## lucapost

Ok, i realize the question...

Now I can't have access to wifi area. I will sent to you debug file next monday.

Thanks for help.

----------

