LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (http://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   hostapd not going into master mode (http://www.linuxquestions.org/questions/linux-wireless-networking-41/hostapd-not-going-into-master-mode-748745/)

gregnorc 08-19-2009 10:16 AM

hostapd not going into master mode
 
I'm trying to set up an eee as a wireless access point using hostapd.

Right now, when I try and run it, I get this error:
Quote:

rmdir[ctrl_interface]: No such file or directory
Configuration file: /etc/hostapd.conf
Failed to set interface wlan0 to master mode.
nl80211 driver initialization failed.
ELOOP: remaining socket: sock=5 eloop_data=0x9dc1e00 user_data=(nil) handler=0x807ac90
I have read that the kernel I'm running should allow me to put ath5k into master mode if I use hostapd.

Quote:

Linux localhost.localdomain 2.6.29.4-167.fc11.i586 #1 SMP Wed May 27 17:14:37 EDT 2009 i686 i686 i386 GNU/Linux
I googled a bit but couldn't find any solutions.

This is my hostapd.cof file's contents:

Code:

##### hostapd configuration file ##############################################
# Empty lines and lines starting with # are ignored

# AP netdevice name (without 'ap' prefix, i.e., wlan0 uses wlan0ap for
# management frames)
interface=wlan0

# Driver interface type (hostap/wired/madwifi/prism54; default: hostap)
driver=nl80211

# hostapd event logger configuration
#
# Two output method: syslog and stdout (only usable if not forking to
# background).
#
# Module bitfield (ORed bitfield of modules that will be logged; -1 = all
# modules):
# bit 0 (1) = IEEE 802.11
# bit 1 (2) = IEEE 802.1X
# bit 2 (4) = RADIUS
# bit 3 (8) = WPA
# bit 4 (16) = driver interface
# bit 5 (32) = IAPP
#
# Levels (minimum value for logged events):
#  0 = verbose debugging
#  1 = debugging
#  2 = informational messages
#  3 = notification
#  4 = warning
#
#logger_syslog=-1
#logger_syslog_level=2
#logger_stdout=-1
#logger_stdout_level=1

# Debugging: 0 = no, 1 = minimal, 2 = verbose, 3 = msg dumps, 4 = excessive
debug=0

# Dump file for state information (on SIGUSR1)
dump_file=/tmp/hostapd.dump

# Interface for separate control program. If this is specified, hostapd
# will create this directory and a UNIX domain socket for listening to requests
# from external programs (CLI/GUI, etc.) for status information and
# configuration. The socket file will be named based on the interface name, so
# multiple hostapd processes/interfaces can be run at the same time if more
# than one interface is used.
# /var/run/hostapd is the recommended directory for sockets and by default,
# hostapd_cli will use it when trying to connect with hostapd.
ctrl_interface=/var/run/hostapd

# Access control for the control interface can be configured by setting the
# directory to allow only members of a group to use sockets. This way, it is
# possible to run hostapd as root (since it needs to change network
# configuration and open raw sockets) and still allow GUI/CLI components to be
# run as non-root users. However, since the control interface can be used to
# change the network configuration, this access needs to be protected in many
# cases. By default, hostapd is configured to use gid 0 (root). If you
# want to allow non-root users to use the contron interface, add a new group
# and change this value to match with that group. Add users that should have
# control interface access to this group.
#
# This variable can be a group name or gid.
#ctrl_interface_group=wheel
#ctrl_interface_group=0


##### IEEE 802.11 related configuration #######################################

# SSID to be used in IEEE 802.11 management frames
ssid=songwhale_test

# Station MAC address -based authentication
# 0 = accept unless in deny list
# 1 = deny unless in accept list
# 2 = use external RADIUS server (accept/deny lists are searched first)
macaddr_acl=0

# Accept/deny lists are read from separate files (containing list of
# MAC addresses, one per line). Use absolute path name to make sure that the

# files can be read on SIGHUP configuration reloads.
#accept_mac_file=/etc/hostapd/hostapd.accept
#deny_mac_file=/etc/hostapd/hostapd.deny

# IEEE 802.11 specifies two authentication algorithms. hostapd can be
# configured to allow both of these or only one. Open system authentication
# should be used with IEEE 802.1X.
# Bit fields of allowed authentication algorithms:
# bit 0 = Open System Authentication
# bit 1 = Shared Key Authentication (requires WEP)
auth_algs=1

# Associate as a station to another AP while still acting as an AP on the same
# channel.
#assoc_ap_addr=00:12:34:56:78:9a


##### IEEE 802.1X (and IEEE 802.1aa/D4) related configuration #################

# Require IEEE 802.1X authorization
#ieee8021x=0

# Use integrated EAP authenticator instead of external RADIUS authentication
# server
#eap_authenticator=0

# Path for EAP authenticator user database
#eap_user_file=/etc/hostapd/eap_user

# CA certificate (PEM or DER file) for EAP-TLS/PEAP/TTLS
#ca_cert=/etc/hostapd/ca.pem

# Server certificate (PEM or DER file) for EAP-TLS/PEAP/TTLS
#server_cert=/etc/hostapd/server.pem

# Private key matching with the server certificate for EAP-TLS/PEAP/TTLS
# This may point to the same file as server_cert if both certificate and key
# are included in a single file. PKCS#12 (PFX) file (.p12/.pfx) can also be
# used by commenting out server_cert and specifying the PFX file as the
# private_key.
#private_key=/etc/hostapd/server.prv

# Passphrase for private key
#private_key_passwd=secret passphrase

# Configuration data for EAP-SIM database/authentication gateway interface.
# This is a text string in implementation specific format. The example
# implementation in eap_sim_db.c uses this as the file name for the GSM
# authentication triplets.
#eap_sim_db=/etc/hostapd/sim_db

# Optional displayable message sent with EAP Request-Identity
#eap_message=hello

# WEP rekeying (disabled if key lengths are not set or are set to 0)
# Key lengths for default/broadcast and individual/unicast keys:
# 5 = 40-bit WEP (also known as 64-bit WEP with 40 secret bits)
# 13 = 104-bit WEP (also known as 128-bit WEP with 104 secret bits)
#wep_key_len_broadcast=5
#wep_key_len_unicast=5
# Rekeying period in seconds. 0 = do not rekey (i.e., set keys only once)
#wep_rekey_period=300

# EAPOL-Key index workaround (set bit7) for WinXP Supplicant (needed only if
# only broadcast keys are used)
#eapol_key_index_workaround=0

# EAP reauthentication period in seconds (default: 3600 seconds; 0 = disable
# reauthentication).
#eap_reauth_period=3600


##### IEEE 802.11f - Inter-Access Point Protocol (IAPP) #######################

# Interface to be used for IAPP broadcast packets
#iapp_interface=eth0


##### RADIUS configuration ####################################################
# for IEEE 802.1X with external Authentication Server, IEEE 802.11
# authentication with external ACL for MAC addresses, and accounting

# The own IP address of the access point (used as NAS-IP-Address)
#own_ip_addr=127.0.0.1

# Optional NAS-Identifier string for RADIUS messages. When used, this should be
# a unique to the NAS within the scope of the RADIUS server. For example, a
# fully qualified domain name can be used here.
#nas_identifier=ap.example.com

# RADIUS authentication server
#auth_server_addr=127.0.0.1
#auth_server_port=1812
#auth_server_shared_secret=secret

# RADIUS accounting server
#acct_server_addr=127.0.0.1
#acct_server_port=1813
#acct_server_shared_secret=secret

# Secondary RADIUS servers; to be used if primary one does not reply to
# RADIUS packets. These are optional and there can be more than one secondary
# server listed.
#auth_server_addr=127.0.0.2
#auth_server_port=1812
#auth_server_shared_secret=secret2
#
#acct_server_addr=127.0.0.2
#acct_server_port=1813
#acct_server_shared_secret=secret2

# Retry interval for trying to return to the primary RADIUS server (in
# seconds). RADIUS client code will automatically try to use the next server
# when the current server is not replying to requests. If this interval is set,
# primary server will be retried after configured amount of time even if the
# currently used secondary server is still working.
#radius_retry_primary_interval=600

# Interim accounting update interval
# If this is set (larger than 0) and acct_server is configured, hostapd will
# send interim accounting updates every N seconds. Note: if set, this overrides
# possible Acct-Interim-Interval attribute in Access-Accept message. Thus, this
# value should not be configured in hostapd.conf, if RADIUS server is used to
# control the interim interval.
# This value should not be less 600 (10 minutes) and must not be less than
# 60 (1 minute).
#radius_acct_interim_interval=600

# hostapd can be used as a RADIUS authentication server for other hosts. This
# requires that the integrated EAP authenticator is also enabled and both
# authentication services are sharing the same configuration.

# File name of the RADIUS clients configuration for the RADIUS server. If this
# commented out, RADIUS server is disabled.
#radius_server_clients=/etc/hostapd/radius_clients

# The UDP port number for the RADIUS authentication server
#radius_server_auth_port=1812


##### WPA/IEEE 802.11i configuration ##########################################

# Enable WPA. Setting this variable configures the AP to require WPA (either
# WPA-PSK or WPA-RADIUS/EAP based on other configuration). For WPA-PSK, either
# wpa_psk or wpa_passphrase must be set and wpa_key_mgmt must include WPA-PSK.
# For WPA-RADIUS/EAP, ieee8021x must be set (but without dynamic WEP keys),
# RADIUS authentication server must be configured, and WPA-EAP must be included
# in wpa_key_mgmt.
# This field is a bit field that can be used to enable WPA (IEEE 802.11i/D3.0)
# and/or WPA2 (full IEEE 802.11i/RSN):
# bit0 = WPA
# bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
#wpa=1

# WPA pre-shared keys for WPA-PSK. This can be either entered as a 256-bit
# secret in hex format (64 hex digits), wpa_psk, or as an ASCII passphrase
# (8..63 characters) that will be converted to PSK. This conversion uses SSID
# so the PSK changes when ASCII passphrase is used and the SSID is changed.
# wpa_psk (dot11RSNAConfigPSKValue)
# wpa_passphrase (dot11RSNAConfigPSKPassPhrase)
#wpa_psk=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
#wpa_passphrase=yoursecretpassphrase

# Optionally, WPA PSKs can be read from a separate text file (containing list
# of (PSK,MAC address) pairs. This allows more than one PSK to be configured.
# Use absolute path name to make sure that the files can be read on SIGHUP
# configuration reloads.
#wpa_psk_file=/etc/hostapd/wpa_psk

# Set of accepted key management algorithms (WPA-PSK, WPA-EAP, or both). The
# entries are separated with a space.
# (dot11RSNAConfigAuthenticationSuitesTable)
#wpa_key_mgmt=WPA-PSK WPA-EAP
#wpa_key_mgmt=WPA-PSK

# Set of accepted cipher suites (encryption algorithms) for pairwise keys
# (unicast packets). This is a space separated list of algorithms:

# CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]
# TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]
# Group cipher suite (encryption algorithm for broadcast and multicast frames)
# is automatically selected based on this configuration. If only CCMP is
# allowed as the pairwise cipher, group cipher will also be CCMP. Otherwise,
# TKIP will be used as the group cipher.
# (dot11RSNAConfigPairwiseCiphersTable)
#wpa_pairwise=TKIP CCMP

# Time interval for rekeying GTK (broadcast/multicast encryption keys) in
# seconds. (dot11RSNAConfigGroupRekeyTime)
#wpa_group_rekey=600

# Rekey GTK when any STA that possesses the current GTK is leaving the BSS.
# (dot11RSNAConfigGroupRekeyStrict)
#wpa_strict_rekey=1

# Time interval for rekeying GMK (master key used internally to generate GTKs
# (in seconds).
#wpa_gmk_rekey=86400

# Enable IEEE 802.11i/RSN/WPA2 pre-authentication. This is used to speed up
# roaming be pre-authenticating IEEE 802.1X/EAP part of the full RSN
# authentication and key handshake before actually associating with a new AP.
# (dot11RSNAPreauthenticationEnabled)
#rsn_preauth=1
#
# Space separated list of interfaces from which pre-authentication frames are
# accepted (e.g., 'eth0' or 'eth0 wlan0wds0'. This list should include all
# interface that are used for connections to other APs. This could include
# wired interfaces and WDS links. The normal wireless data interface towards
# associated stations (e.g., wlan0) should not be added, since
# pre-authentication is only used with APs other than the currently associated
# one.
#rsn_preauth_interfaces=eth0

Any help is greatly appreciated.

gregnorc 08-22-2009 02:03 PM

anyone?

gregnorc 08-23-2009 10:18 AM

here's the output of lsmod, maybe this will help?

Code:

Module                  Size  Used by
aes_i586                7492  0
aes_generic            26940  1 aes_i586
fuse                  49748  2
sco                    9356  2
bridge                41488  0
stp                    1944  1 bridge
llc                    4780  2 bridge,stp
bnep                  10888  2
l2cap                  18884  3 bnep
bluetooth              44776  5 sco,bnep,l2cap
sunrpc                152364  1
ip6t_REJECT            3160  2
nf_conntrack_ipv6      11368  2
ip6table_filter        3136  1
ip6_tables            10728  1 ip6table_filter
ipv6                  232324  20 ip6t_REJECT,nf_conntrack_ipv6
p4_clockmod            4208  0
dm_multipath          13512  0
uinput                  6496  0
pcspkr                  2156  0
joydev                  8972  0
i2c_i801                8056  0
iTCO_wdt              10448  0
iTCO_vendor_support    2736  1 iTCO_wdt
usb_storage            82508  0
arc4                    1584  2
ecb                    2452  2
snd_hda_codec_realtek  189436  1
ath5k                117160  0
mac80211              164592  1 ath5k
snd_hda_intel          23920  2
cfg80211              30616  2 ath5k,mac80211
snd_hda_codec          54264  2 snd_hda_codec_realtek,snd_hda_intel
snd_hwdep              6580  1 snd_hda_codec
atl2                  23364  0
snd_pcm                62520  2 snd_hda_intel,snd_hda_codec
snd_timer              17896  1 snd_pcm
snd                    49044  10 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer
soundcore              5404  1 snd
snd_page_alloc          7572  2 snd_hda_intel,snd_pcm
eeepc_laptop          10772  0
hwmon                  2148  1 eeepc_laptop
ata_generic            4312  0
pata_acpi              3668  0
i915                  144488  2
drm                  166212  2 i915
i2c_algo_bit            4836  1 i915
i2c_core              18056  4 i2c_i801,i915,drm,i2c_algo_bit
video                  17360  1 i915
output                  2364  1 video


business_kid 08-25-2009 09:36 AM

I am taking it everything basically works. The first question is - is the wifi already _in_ a network connection? It would be difficult to change modes then. If you stop the wifi, then can hostapd play with it? you may need to run pkill for dhcpcd or dhclient and also ifconfig wlan0 down, then start from there. You can also probably do it with iwconfig wlan0 mode master. Personally, I am quite happy to stay with managed as a client. I take it you are running a server?

gregnorc 08-26-2009 11:03 AM

Quote:

Originally Posted by business_kid (Post 3656845)
I am taking it everything basically works. The first question is - is the wifi already _in_ a network connection? It would be difficult to change modes then. If you stop the wifi, then can hostapd play with it? you may need to run pkill for dhcpcd or dhclient and also ifconfig wlan0 down, then start from there. You can also probably do it with iwconfig wlan0 mode master. Personally, I am quite happy to stay with managed as a client. I take it you are running a server?

Yes - I'm trying to eventually make it so I can serve content wirelessly from the eee, but for right now I'd like to just get it working as an ap.

From what I read, you can't simply set it to mastermode with ifconfig (see http://acx100.erley.org/stable.html#add_iwconfig)

I tried doing this (all as root):

iwconfig wlan0 down
/etc/init.d/dhcpd stop
hostapd -dd /etc/hostapd.conf

But I get this error:

[root@localhost songwhale]# hostapd /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
Failed to set interface wlan0 to master mode.
nl80211 driver initialization failed.
rmdir[ctrl_interface]: No such file or directory
ELOOP: remaining socket: sock=5 eloop_data=0x907c830 user_data=(nil)
handler=0x807ad60

gregnorc 08-26-2009 07:46 PM

How can I kill network manager? I think I need to turn it off to get hostapd to run.

I tried killing the individual components from the command line (nm-applet, wpa-supplicant, and nm-system-settings but they just immediately come back up again with new PIDs.

business_kid 08-27-2009 03:21 AM

NetworkManager is part of gnome. ps -e And then a kill PID command. It might be handier to use pstree, and kill from the left :-D. Just looking at your commands there, use
ifconfig wlan0 up/down, as I don't think iwconfig does that bit.
[B]TW it may not be NetworkManager at all. If you have stuff in a running inetd or xinetd process, that will restart them 'as needed'.

Your links say the 802.11 stack does not do master mode, but many modems and routers out there _do_ use linux. What do they use? More importantly, what can your actual card do? A quick google on the first question gave me this for you to enjoy.
http://www.myopenrouter.com/

gregnorc 08-27-2009 11:39 PM

Quote:

Originally Posted by business_kid (Post 3659224)
NetworkManager is part of gnome. ps -e And then a kill PID command. It might be handier to use pstree, and kill from the left :-D. Just looking at your commands there, use
ifconfig wlan0 up/down, as I don't think iwconfig does that bit.
[B]TW it may not be NetworkManager at all. If you have stuff in a running inetd or xinetd process, that will restart them 'as needed'.

Your links say the 802.11 stack does not do master mode, but many modems and routers out there _do_ use linux. What do they use? More importantly, what can your actual card do? A quick google on the first question gave me this for you to enjoy.
http://www.myopenrouter.com/

Actually from what I read it will go into AP mode, but only when hostapd triggers it - that doing it manually with iw will simply cause an error.

I'll try and go through all the processes and kill them. I'm guessing anything networking related needs to be killed?

business_kid 08-29-2009 03:49 AM

Think about it logically and all becomes clear.
If the wifi is set up talking somehow, or being 'managed' by something, it won't shut down. If you use root privileges, you may leave orphaned programs running, which can cause issues when another program/instance claims the same device.

JulianTosh 08-29-2009 04:00 AM

Quote:

Originally Posted by gregnorc (Post 3658952)
How can I kill network manager?

For future reference... Try 'service NetworkManager stop' ?

kaatmanduu 09-16-2009 01:31 PM

Perhaps I'm a bit late to the party, but I believe you'll need kernel 2.6.31 so that ath5k will support AP mode. iw phy phy0 info will show you something like:

Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* monitor
* mesh point

Note the above is with 2.6.31


All times are GMT -5. The time now is 04:32 AM.