You are not logged in.

#1 2010-10-20 18:18:41

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

Creating a bridge between to wireless interfaces

I was wondering if I could create a bridge between two wireless interfaces. So that when there is a WAN that filters MAC's, 2 different computers which aren't in the WAN whitelist can connect to the WAN via me.
Is that possible? And how?
Thanks!

Offline

#2 2010-10-20 21:31:53

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

Re: Creating a bridge between to wireless interfaces

Well, one solution I see would be to:

  1. set up one of your wireless interface to create an ad-hoc network (or as an AP, but it's fairly more complex to setup from my experience).

  2. then set-up your computer to NAT the traffic coming from the ad-hoc network

  3. the other computers would then connect to the ad-hoc wireless network

  4. you would then need to configure these computers to route their traffic through your computer

Step 1 is doable with iwconfig.
Step 2 is doable with iptables...
Step 3 is doable with iwconfig (if the other computers are running Linux)
Step 4 is doable with ipconfig/route (or you could set up a DHCP server listening on the ad-hoc wireless interface to simplify the configuration on the remote host).

Note that it won't be a really secure solution since you can only use WEP or no encryption on ad-hoc wireless network.

Offline

#3 2010-10-21 05:04:06

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

Re: Creating a bridge between to wireless interfaces

Thanks for the reply, but I am looking for something that looks like an acces point, so that cellphones, ipod's, etc can connect to it too.
Is that possible?

Last edited by rayman (2010-10-21 05:18:40)

Offline

#4 2010-10-21 06:08:16

kazuo
Member
From: São Paulo/Brazil
Registered: 2008-03-18
Posts: 413
Website

Re: Creating a bridge between to wireless interfaces

rayman wrote:

Thanks for the reply, but I am looking for something that looks like an acces point, so that cellphones, ipod's, etc can connect to it too.
Is that possible?

This is dependent of how much dumb is your cellphones (note: I have a symbian, so I think that all cellphones are dumb =]).

If you put a adhoc+dhcp server probably the cellphone/ipod will use it as AP transparently as if its not a adhoc, my Nokia 5530 (a symbian s60v5) do this. Windows too (I used to play Counter Strike over adhoc with Windows friends), and Windows is more dumb than my cellphone XD

I'm posting a small 'script' I use

#!/bin/sh
if [[ $1 == 'start' ]]; then
   ip link set down dev wlan0
   iwconfig wlan0 mode ad-hoc
   iwconfig wlan0 channel 3
   iwconfig wlan0 essid adhoc-net key s:pass
   ip link set up dev wlan0
   ip addr add 192.168.0.50/24 dev wlan0
   /etc/rc.d/dnsmasq start
   iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
elif [[ $1 == 'stop' ]]; then
   iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
   /etc/rc.d/dnsmasq stop
   ip addr del 192.168.0.50/24 dev wlan0
   ip link set down dev wlan0
   iwconfig wlan0 essid off
   iwconfig wlan0 mode managed
fi

In this case ppl connected to the adhoc network (at wlan0 with the creative ESSID of "adhoc-net") get the network of the eth0 connection

EDIT: To give the answer credit this is exact the outline that hexanol give, but I migrated to iproute2 from net-tools because the later is deprecated

Last edited by kazuo (2010-10-21 06:20:42)

Offline

#5 2010-10-21 08:06:17

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

Re: Creating a bridge between to wireless interfaces

Thanks!
My cellphone can see the access point. But, how do I bridge the interface instead of from eth0 to wlan0 from wlan1 to wlan0?
By just changing "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" into "iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE"?
Thanks
[EDIT]"iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE" yields "Operation not supported".
Is there any other way?

Last edited by rayman (2010-10-21 19:24:22)

Offline

#6 2010-10-21 20:56:05

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

Re: Creating a bridge between to wireless interfaces

I don't know much about iptables, so I couldn't tell you exactly why you are getting this error, but I suspect this to be easily fixable.

Offline

Board footer

Powered by FluxBB