Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hostapd Error (cannot connect to wifi)
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
divago
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jun 2010
Posts: 84

PostPosted: Thu Sep 09, 2010 5:02 pm    Post subject: Hostapd Error (cannot connect to wifi) Reply with quote

hi all, again
i need to create a wireless to connect my smartphone to wired network
already tried with iwconfig but does'nt work :\

now i try with hostapd;
i followed this wiki: http://en.gentoo-wiki.com/wiki/Atheros_Ath5k_Wireless_Access_Point

i emerged hostapd and bind and dhcp and all in this guide :)
kernel is ok (save for ethernet bridging atm off, and i don't use modules

this is my /etc/conf.d/net
Code:
 modules_eth0=( "wpa_supplicant")
 wpa_supplicant_eth0="-Dwired" # For generic wired

# ETH0
 config_eth0=( "dhcp" )
 dhcpcd_eth0="-N"

# WLAN
modules_wlan0=( "iwconfig" )
essid_wlan0="workfabio"
config_wlan0=( "10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255" )

this is hostapd.conf
Code:
interface=wlan0
#bridge=br0                         (optional, if you want bridging remove the #)
driver=nl80211
ssid=workfabio
channel=1
wpa=3
wpa_passphrase=paroladordine
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=1
debug=0
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
accept_mac_file=/etc/hostapd/hostapd.accept
deny_mac_file=/etc/hostapd/hostapd.deny
auth_algs=1

and this is dhcpd.conf
Code:
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.10 10.0.0.100;
option domain-name-servers 10.0.0.1;
option domain-name "hostname.domain.tld";
option routers 10.0.0.1;
option broadcast-address 10.0.0.255;
default-lease-time 10000;
max-lease-time 20000;
}


then i started it
Code:
# /etc/init.d/hostapd start
 * Caching service dependencies ...                                                         [ ok ]
 * Starting wlan0
 *   Configuring wireless network for wlan0
 *   Failed to configure wireless for wlan0                                                 [ !! ]
 * ERROR:  cannot start hostapd as net.wlan0 could not start

seems to me wlan0 are not starting in AP mode but is searching for a wireless net called "workfabio". or something similar
where's the problem? why wlan0 is not starting?
Back to top
View user's profile Send private message
divago
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jun 2010
Posts: 84

PostPosted: Thu Sep 09, 2010 6:12 pm    Post subject: Reply with quote

i reply to myself just to explain how i solved first problem

i had to put
Code:

mode_wlan0="ad-hoc"
in /etc/conf.d/net to start ad-hoc wifi
now wifi is starting and is working :)

btw i got another problem:
i tried connecting some device:
my android smartphone, my workmate iphone and my workmate laptop

all are connected with static ip
(atm need to create wireless network; when wifi is working, i'll start working on dhcp server...)
all are using different ip, ie 10.0.0.2 10.0.0.3 and 10.0.0.4

they found wifi on scan (even with a net discovery program) and connect with it
but does'nt surf, neither connect with samba server on my pc etc
(but, i can connect with ssh to my sshd server)

seems to me a problem with routing; what i can add and how to my configuration?
iptables atm is stopped so i got no problem with firewall btw...

Edit
ok ok, i know
without iptables it can'nt do nat :)
so i configured iptables following this guide
http://www.gentoo.org/doc/it/home-router-howto.xml

and this is my iptables -L -v
Code:
# iptables -L -v
Chain INPUT (policy ACCEPT 586 packets, 147K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere           
  904 70637 ACCEPT     all  --  wlan0  any     anywhere             anywhere           
   85 27880 REJECT     udp  --  !wlan0 any     anywhere             anywhere            udp dpt:bootps reject-with icmp-port-unreachable
    0     0 REJECT     udp  --  !wlan0 any     anywhere             anywhere            udp dpt:domain reject-with icmp-port-unreachable
    0     0 DROP       tcp  --  !wlan0 any     anywhere             anywhere            tcp dpts:0:1023
 6438  924K DROP       udp  --  !wlan0 any     anywhere             anywhere            udp dpts:0:1023
    0     0 LOG        all  --  any    any     10.0.0.10            anywhere            LOG level warning

Chain FORWARD (policy DROP 66 packets, 3960 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DROP       all  --  wlan0  any     anywhere             10.0.0.0/24         
    0     0 ACCEPT     all  --  wlan0  any     anywhere             10.0.0.0/24         
    0     0 ACCEPT     all  --  eth0   any     anywhere             10.0.0.0/24         

Chain OUTPUT (policy ACCEPT 597 packets, 91619 bytes)
 pkts bytes target     prot opt in     out     source               destination         

btw problem is stil present:
my pc (router) ping my smartphone
smartphone connect in ssh in my pc (router)
smartphone found (discovery with netdiscovery app) other devices (ie my workmate iphone)
smartphone does'nt surf nor connect to samba server

Code:
# tail -f /var/log/messages
Sep  9 21:46:27 river hostapd: wlan0: STA b4:07:f9:d1:ed:5e IEEE 802.11: deauthenticated due to local deauth request
Sep  9 21:46:45 river hostapd: wlan0: STA b4:07:f9:d1:ed:5e IEEE 802.11: authenticated
Sep  9 21:46:45 river hostapd: wlan0: STA b4:07:f9:d1:ed:5e IEEE 802.11: associated (aid 1)
Sep  9 21:46:45 river hostapd: wlan0: STA b4:07:f9:d1:ed:5e RADIUS: starting accounting session 4C893738-00000001
Sep  9 21:46:45 river hostapd: wlan0: STA b4:07:f9:d1:ed:5e WPA: pairwise key handshake completed (RSN)
Sep  9 21:46:46 river dnsmasq-dhcp[8570]: DHCPREQUEST(wlan0) 10.0.0.10 b4:07:f9:d1:ed:5e
Sep  9 21:46:46 river dnsmasq-dhcp[8570]: DHCPACK(wlan0) 10.0.0.10 b4:07:f9:d1:ed:5e
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