You are not logged in.

#1 2010-12-02 17:17:29

rayman
Member
Registered: 2010-09-09
Posts: 37

Hostapd bridge wireless to wireless

I want to create an SoftAP(using hostapd) that bridges one wireless network to the other. I have WPA secured network, and sometimes need an open network for some hardware. But, when I am connected to my WPA network, and run hostapd, I get this output:

Configuration file: /etc/hostapd/hostapd.conf
Could not set channel for kernel driver
wlan0: Unable to setup interface.
rmdir[ctrl_interface]: No such file or directory

,

while when I run it without my WPA network connected, it works and my device sees the softAP.
I created my wlan1 device, with which I connect to the WPA network, using this command:

iw dev wlan0 interface add wlan1 type managed

When I do

iwconfig wlan0 channel 2

, I get this output:

Error for wireless request "Set Frequency" (8B04) :
    SET failed on device wlan0 ; Device or resource busy.

.
Now my question, how can I create an (soft)AP that other devices can connect to, and that is bridged to my own WPA network?

Thanks in advance.

Last edited by rayman (2010-12-02 17:24:40)

Offline

#2 2010-12-02 22:31:00

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Re: Hostapd bridge wireless to wireless

Now my question, how can I create an (soft)AP that other devices can connect to, and that is bridged to my own WPA network?

You probably can't. Most, if not all, wireless interface can't be bridged when they are in managed mode.

You could do routing though. This is not as convenient depending on what you want to do, especially if you must throw NAT in, but this is sometime the only solution.

Offline

#3 2010-12-03 12:14:22

rayman
Member
Registered: 2010-09-09
Posts: 37

Re: Hostapd bridge wireless to wireless

Thanks. I now have wlan0 in managed mode connected to my WPA network, and airbase-ng as AP on mon0(and at0). I followed this guide: http://www.backtrack-linux.org/forums/b … ffing.html, only I skipped the last part with sniffing. Now I have internet on my computer(the server), but it keeps disconnecting after some time, especially if I generate some traffic. Also, the client with which I try to connect to it cannot get internet(I tried it with an Ipod Touch 4g). I followed everything the guide said, except I changed the "ddns-update-style" from "ad-hoc" to "none", because dhcpd says it's no longer supported.
This is the output so far from

dhcpd -d -f -cf ./dhcpd.conf -pf /var/run/dhcpd/dhcpd.pid at0:
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 0 leases to leases file.
Listening on LPF/at0/00:15:af:e3:25:84/192.168.2.128/25
Sending on   LPF/at0/00:15:af:e3:25:84/192.168.2.128/25
Sending on   Socket/fallback/fallback-net
DHCPREQUEST for 145.102.178.128 from d8:30:62:25:99:a1 via at0: wrong network.
DHCPNAK on 145.102.178.128 to d8:30:62:25:99:a1 via at0
DHCPREQUEST for 145.102.178.128 from d8:30:62:25:99:a1 via at0: wrong network.
DHCPNAK on 145.102.178.128 to d8:30:62:25:99:a1 via at0
DHCPREQUEST for 145.102.178.128 from d8:30:62:25:99:a1 via at0: wrong network.
DHCPNAK on 145.102.178.128 to d8:30:62:25:99:a1 via at0
DHCPREQUEST for 145.102.178.128 from d8:30:62:25:99:a1 via at0: wrong network.
DHCPNAK on 145.102.178.128 to d8:30:62:25:99:a1 via at0
DHCPDISCOVER from d8:30:62:25:99:a1 via at0
DHCPOFFER on 192.168.2.130 to d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPDISCOVER from d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPOFFER on 192.168.2.130 to d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPDISCOVER from d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPOFFER on 192.168.2.130 to d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPDISCOVER from d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPOFFER on 192.168.2.130 to d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPREQUEST for 192.168.2.130 (192.168.2.129) from d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPACK on 192.168.2.130 to d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPREQUEST for 192.168.2.130 (192.168.2.129) from d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPACK on 192.168.2.130 to d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPREQUEST for 192.168.2.130 (192.168.2.129) from d8:30:62:25:99:a1 (iPod-Touch) via at0
DHCPACK on 192.168.2.130 to d8:30:62:25:99:a1 (iPod-Touch) via at0

 

So, how can I make it work? This is my first time I'm playing around with servers.
Thanks in advance.

[EDIT]Is it possible to do this with only one network card?

Last edited by rayman (2010-12-03 14:17:20)

Offline

#4 2010-12-04 13:07:04

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Re: Hostapd bridge wireless to wireless

I don't know if it's possible to do this with only one wireless network card. I've never done such a thing.

That said, the guide you are following is less or more 'routing with NAT', so you can also follow the Internet share page. That said, this page doesn't talk about setting up a DHCP server; you can take a look at dnsmasq to do this, or at the ISC DHCP server, but you might find dnsmasq simpler.

Offline

#5 2010-12-05 11:16:02

rayman
Member
Registered: 2010-09-09
Posts: 37

Re: Hostapd bridge wireless to wireless

Thanks!
At last, it works. I forgot to set ip_forward to 1(echo "1" > /proc/sys/net/ipv4/ip_forward). So it is possible using only one network card, and multiple interfaces(I used iw to create a new interface, which I connected to the internet, while the other one served as AP). One interface needs to have it's mac adress changed, since otherwise you'll get an error saying the name is not unique on the network.

Last edited by rayman (2010-12-05 11:30:37)

Offline

#6 2010-12-05 15:58:43

ctarwater
Member
Registered: 2009-02-05
Posts: 300
Website

Re: Hostapd bridge wireless to wireless

Ok, I tried following that tutorial you posted and I'm curious about step 3 where he says to configure dhcpd.conf.  but I don't have a dhcpd.conf.  I do have a dhcpcd.conf in /etc.  Is that where you put it?

(thanks by the way, I've been looking into this for awhile now)

**Edit

Also, neither mon0 or wifi0 are ever created regardless of how I start my wireless interface.  I'm guessing it's due to the dhcpd.conf thing though.

Last edited by ctarwater (2010-12-05 16:14:25)


I'm married to an author.  This is shameless self-promotion.  www.backthatelfup.com

Offline

#7 2011-02-10 20:02:15

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: Hostapd bridge wireless to wireless

Hi Rayman

Can you share with us exactly how you did it, maybe on the wiki? I'm trying to do the exact same thing.

Offline

Board footer

Powered by FluxBB