Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
wpa_supplicant don't give IP (nor via dhcp nor static)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
firepol
n00b
n00b


Joined: 04 Dec 2006
Posts: 15
Location: Switzerland

PostPosted: Sun Jan 28, 2007 4:25 pm    Post subject: wpa_supplicant don't give IP (nor via dhcp nor static) Reply with quote

Hi,

I have a laptop with 2 linux installations. Ubuntu and Gentoo. With ubuntu I can make my wireless card work.

With ubuntu the configuration wad reletively easy. That's the file I had in my ubuntu box under /etc/network/interfaces:
Quote:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
iface eth1 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1

#wireless
auto eth0
iface eth0 inet dhcp
netmask 255.255.255.0
gateway 192.168.1.1
wpa-driver wext
wpa-conf managed
wpa-ssid MYSSID
wpa-ap-scan 1
wpa-proto WPA
wpa-pairwise TKIP
wpa-group TKIP
wpa-key-mgmt WPA-PSK
wpa-psk thekeygeneratedwith_wpa_passphrase


Under ubuntu by issuing /etc/init.d/networking restart I could have wireless and wired working.

I have a Broadcom wireless card. From lspci:
Quote:

06:05.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)


Now, coming back to Gentoo...

I followed this Gentoo Wireless Networking Howto. I've created a symbolic link called /etc/init.d/net.wlan0; I've installed ndiswrapper.

My /etc/conf.d/net looks like this:

Quote:

config_eth0=( "192.168.1.3 netmask 255.255.255.0 brd 192.168.1.255" )
#config_eth0=( "dhcp" )
routes_eth0=( "default gw 192.168.1.1" )

iwconfig_eth0="mode managed"
modules=( "wpa_supplicant" )
#wpa_supplicant_wlan0="-Dndiswrapper"
wpa_supplicant_wlan0="-Dwext"
config_wlan0=( "dhcp" )
#config_wlan0=( "192.168.1.4 netmask 255.255.255.0 brd 192.168.1.255" )
routes_wlan0=( "default gw 192.168.1.1" )


My /etc/wpa_supplicant.conf looks like this:
Quote:

# The below line not be changed otherwise we refuse to work
ctrl_interface=/var/run/wpa_supplicant

# Ensure that only root can read the WPA configuration
ctrl_interface_group=0

# Let wpa_supplicant take care of scanning and AP selection
ap_scan=1

# poli network
network={
ssid="MYSSID"
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
psk=hekeygeneratedwith_wpa_passphrase
# The higher the priority the sooner we are matched
priority=5
}


If I do /etc/init.d/net.wlan0 restart I get this:

Quote:

* Stopping wlan0
* Bringing down wlan0
* Shutting down wlan0 ... [ ok ]
* Stopping wpa_cli on wlan0 ... [ ok ]
* Stopping wpa_supplicant on wlan0 ... [ ok ]
* Starting wlan0
* Starting wpa_supplicant on wlan0 ... [ ok ]
* Starting wpa_cli on wlan0 ... [ ok ]
* Backgrounding ...


and finally if I do ifconfig:

Quote:

eth0 Link encap:Ethernet HWaddr 00:0A:E4:F4:47:F9
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29584 errors:0 dropped:0 overruns:0 frame:0
TX packets:16689 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40457547 (38.5 Mb) TX bytes:1787967 (1.7 Mb)
Interrupt:19 Base address:0x3000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:200 (200.0 b) TX bytes:200 (200.0 b)

wlan0 Link encap:Ethernet HWaddr 00:16:CE:12:4A:91
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:17 Memory:b0100000-b0102000


Of course wireless doesn't work, else I wouldn't be here.

What's wrong in my configuration? How can I get it working considering that under Ubuntu it works with the configuration mentioned above?

Thanks to enlighten me
Back to top
View user's profile Send private message
bernied
n00b
n00b


Joined: 03 Apr 2006
Posts: 50
Location: UK

PostPosted: Sun Jan 28, 2007 11:28 pm    Post subject: Reply with quote

Maybe wlan0 isn't coming up because eth0 is up.

What happens when you do this:
Code:
ifconfig eth0 down
ifconfig wlan0 up
dhcpd wlan0
(One of the last two commands may be redundant, or they might be better switched)

I don't know how to make this a permanent thing, without disabling eth0, which you don't want, right. Giving eth0 a static address might be the problem, if it were dhcp then it wouldn't come up, so wlan0 would take over.

If that doesn't work, what is the output of
Code:
iwconfig

Are you connected?
Back to top
View user's profile Send private message
Chris W
l33t
l33t


Joined: 25 Jun 2002
Posts: 972
Location: Brisbane, Australia

PostPosted: Mon Jan 29, 2007 11:46 am    Post subject: Reply with quote

Quote:
My /etc/conf.d/net looks like this:

Quote:

config_eth0=( "192.168.1.3 netmask 255.255.255.0 brd 192.168.1.255" )
#config_eth0=( "dhcp" )
routes_eth0=( "default gw 192.168.1.1" )

iwconfig_eth0="mode managed"
modules=( "wpa_supplicant" )
#wpa_supplicant_wlan0="-Dndiswrapper"
wpa_supplicant_wlan0="-Dwext"
config_wlan0=( "dhcp" )
#config_wlan0=( "192.168.1.4 netmask 255.255.255.0 brd 192.168.1.255" )
routes_wlan0=( "default gw 192.168.1.1" )
Did you mean: iwconfig_wlan0="mode managed"
_________________
Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein
Back to top
View user's profile Send private message
bernied
n00b
n00b


Joined: 03 Apr 2006
Posts: 50
Location: UK

PostPosted: Mon Jan 29, 2007 1:34 pm    Post subject: Reply with quote

iwconfig is like ifconfig, but is meant for use with wireless network adapters and gives you more information about wireless connections, specifically it will tell you if a connection has been established with your access point - you can have an established connection without having an IP address assigned.

It seems that iwconfig is in the wireless-tools ebuild. Is this installed?

As you can see from the man page iwconfig on its own will list all adapters and show any wireless attributes, I think this would include a list of available networks, if the adapter did not have an established connection.

Did you try the 'eth0 down, wlan0 up' thing?
Back to top
View user's profile Send private message
bernied
n00b
n00b


Joined: 03 Apr 2006
Posts: 50
Location: UK

PostPosted: Mon Jan 29, 2007 1:35 pm    Post subject: Reply with quote

Maybe I should have mentioned that you will have to run iwconfig as root. It will not be seen by a normal user.
Back to top
View user's profile Send private message
firepol
n00b
n00b


Joined: 04 Dec 2006
Posts: 15
Location: Switzerland

PostPosted: Mon Jan 29, 2007 4:14 pm    Post subject: Reply with quote

Thanks for your answers guys.

Chris W: yep I meant iwconfig_wlan0="mode managed"

bernied: dhcpd doesn't work to me, i didnt configure /etc/dhcp/dhcpd.conf ... i use dhclient instead...
i stopped eth0 and did: ifconfig wlan0 up; dhclient wlan0
i get this:

Quote:
dhclient wlan0
Internet Systems Consortium DHCP Client V3.0.5-Gentoo
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/wlan0/00:16:ce:12:4a:91
Sending on LPF/wlan0/00:16:ce:12:4a:91
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 18
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
No DHCPOFFERS received.
No working leases in persistent database - sleeping.


iwconfig gives me this:
Quote:

iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wlan0 IEEE 802.11g ESSID:off/any
Mode:Managed Frequency:2.462 GHz Access Point: Not-Associated
Bit Rate:54 Mb/s Tx-Power:24 dBm
RTS thr:2347 B Fragment thr:2346 B
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0


How can I verify if I'm connected to the wireless router?

I tried to use also a static configuration:

Quote:

modules=( "wpa_supplicant" )
wpa_supplicant_wlan0="-Dwext"
#config_wlan0=( "dhcp" )
config_wlan0=( "192.168.1.4 netmask 255.255.255.0 brd 192.168.1.255" )
routes_wlan0=( "default gw 192.168.1.1" )


it still doesn't work.

By the way, please note that my wireless access point has this IP: 192.168.1.10
But the default gateway of my network is a wired zyxel router, with IP 192.168.1.1 and DHCP enabled...

I repeat, from ubuntu it works, I will check under ubuntu what I get with iwconfig and which one is the default route...

Thanks for helping, I really want to solve this.
Back to top
View user's profile Send private message
firepol
n00b
n00b


Joined: 04 Dec 2006
Posts: 15
Location: Switzerland

PostPosted: Mon Jan 29, 2007 4:33 pm    Post subject: Reply with quote

I don't know why but i have the impression that there is a problem selecting my AP, but I've checked the SSID name is correct.

Under ubuntu this line shows MYSSID instead of "Not-Associated" if I do iwconfig:

Quote:
Mode:Managed Frequency:2.462 GHz Access Point: Not-Associated


I don't know... really, I'm getting crazy because of this.
Back to top
View user's profile Send private message
Chris W
l33t
l33t


Joined: 25 Jun 2002
Posts: 972
Location: Brisbane, Australia

PostPosted: Mon Jan 29, 2007 10:40 pm    Post subject: Reply with quote

You could try manually configuring the interface and then checking that it is working in gross terms:
Code:
... config interface stuff...
ifconfig wlan0 up
iwlist wlan0 scan
ifconfig wlan0 down
(you should see your AP) then running wpa_supplicant with debug output:
Code:
wpa_supplicant -dd -D wext  -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf  2>&1 | tee wpa_supplicant.log
One thing to look out for is how you have entered the key in the config file; quotes around string keys, and no quotes if the key is a hex string.
_________________
Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein
Back to top
View user's profile Send private message
firepol
n00b
n00b


Joined: 04 Dec 2006
Posts: 15
Location: Switzerland

PostPosted: Tue Jan 30, 2007 3:00 pm    Post subject: Reply with quote

thanks Chris W... if I do modprobe ndiswrapper, the interface is up (no need to to ifconfig wlan0 up); next step:

Quote:
iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: APMACADDRESS
ESSID:"MYSSID"
Protocol:IEEE 802.11g
Mode:Managed
Frequency:2.462 GHz (Channel 11)
Quality:100/100 Signal level:-31 dBm Noise level:-96 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Extra:atim=0
IE: WPA Version 1
Group Cipher : WEP-40
Pairwise Ciphers (1) : WEP-40
Authentication Suites (1) : PSK


in my wpa_supplicant.conf I configured pairwise and group to be TKIP, could this be the problem? With the scanning I see WEP-40... I will try to change these parameters and let you know...

Quote:
One thing to look out for is how you have entered the key in the config file; quotes around string keys, and no quotes if the key is a hex string.
I entered the hex key without doublequotes (")...
Back to top
View user's profile Send private message
Chris W
l33t
l33t


Joined: 25 Jun 2002
Posts: 972
Location: Brisbane, Australia

PostPosted: Tue Jan 30, 2007 10:22 pm    Post subject: Reply with quote

Excellent, the card is working.
firepol wrote:
...
in my wpa_supplicant.conf I configured pairwise and group to be TKIP, could this be the problem? With the scanning I see WEP-40... I will try to change these parameters and let you know...
TKIP is a layer on top of the same encryption system used in WEP (constantly changing the keys). I don't think this is the issue. You could grab a copy of the wpa_supplicant.conf that Ubuntu writes on your behalf, but I'm fairly sure you'll find that it lists TKIP too.

I think the debug output from wpa_supplicant (see my last post) will be more diagnostic.
_________________
Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein
Back to top
View user's profile Send private message
XAvAX
n00b
n00b


Joined: 31 Dec 2004
Posts: 24

PostPosted: Sun Feb 04, 2007 12:37 am    Post subject: Reply with quote

This might help: I have wpa_supplicant on my wired (eth0) and wireless (eth1) interfaces, and both automatically acquire IP's. Posting configs:

/etc/conf.d/net
Code:
modules_eth0=( "wpa_supplicant" )
wpa_supplicant_eth0="-D wired"
wpa_timeout_eth0=60
config_eth0=( "dhcp" )
dhcp_eth0="-t 10"

modules_eth1=( "wpa_supplicant" )
wpa_supplicant_eth1="-D wext"
wpa_timeout_eth1=60
config_eth1=( "dhcp" )
dhcp_eth1="-t 10"


/etc/wpa_supplicant/wpa_supplicant-eth0.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=users
ap_scan=0

# Connect to anything unsecured ... Wired, remember?
network={
   ssid=""
   scan_ssid=1
   key_mgmt=NONE
   priority=-999999
}


/etc/wpa_supplicant/wpa_supplicant-eth1.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=users
ap_scan=1

network={
        ssid="ElsayedHome"
        scan_ssid=1
        key_mgmt=WPA-PSK
   pairwise=TKIP
        psk="my_secret_psk"
}

network={
        ssid="marlinspike"
        scan_ssid=1
        key_mgmt=WPA-PSK
        psk="my_friend's_secret_psk"
}


Try those settings, from /etc/conf.d/net and eth1, and see if it works.

The only quirk I've had is that if wireless and wired are both started, you're connected to wireless, and you plug in ethernet, the disconnect it you have to stop eth0 before any apps'll use the right interface.
_________________
That which we do not ask will never be learned
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum