Jeremy C. Reed | 3 Mar 2008 21:40

share one wireless adapter's connection to second device (wireless bridge?)

I am using ral0 which is a USB-based Linksys Wireless-G network adapter. 
(I've been using it for 1.5 years on different NetBSD systems. It works 
well except I have to ping at least once every 170 seconds or it loses 
connection.) My ral0 has an IP assigned and I use it.

I have an external device that uses DHCP to get a connection. I was hoping 
I could just plug it to my NetBSD's unused re0 device (RealTek 8100E/8101E 
PCIe 10/100BaseTX (rev. 0x0)).

My first try was to create a bridge:

sudo ifconfig bridge0 create
sudo brconfig bridge0 add re0 add ral0 up

"brconfig -a" showed the bridge. After I turned on the device, "brconfig 
-a" showed three more entries in the "Address cache".

tcpdump on re0 shows a bunch of SIP, igmp, DHCP traffic from my device. I 
can also see traffic from my DHCP server (the wireless router in the other 
room) on my re0 device (which is not wireless but on the bridge0). (I also 
see 169.254.x.x traffic on re0.) (If you'd like me email this tcpdump 
output to you, let me know.)

But my device never got its networking up. I am guessing that I can't 
share multiple connections on that ral0 adapter. I don't know. (My ral0 
continued to work fine.)

I could easily use ipf/ipnat or pf share the existing address using 
address translation. But I'd prefer to not run a DHCP server for one 
device as I already have DHCPd on this network. I was wondering if I could 
(Continue reading)

Jeremy C. Reed | 4 Mar 2008 01:07

Re: share one wireless adapter's connection to second device (wireless bridge?)

> I could easily use ipf/ipnat or pf share the existing address using 
> address translation. But I'd prefer to not run a DHCP server for one 
> device as I already have DHCPd on this network. I was wondering if I 
> could pass the DHCP requests across, but then the address translation 
> would make it appear from ral0 (which already has its own IP assigned).

Well I can't easily to that either. I enabled IP forwarding and configured 
pf for NAT. I started dhcrelay and it had many lines like:

forwarded BOOTREQUEST for 00:aa:bb:cc:dd:ee to 192.168.1.1
(I replaced hardware address above.)

Those corresponded with the tcpdump lines showing the port 68 to 
255.255.255.255 port 67 DHCP traffic.

Later, I saw:

forwarded BOOTREPLY for 00:aa:bb:cc:dd:ee to 192.168.1.2
forwarded BOOTREPLY for 00:aa:bb:cc:dd:ee to 192.168.1.2

But I don't see traffic the other way. Then I did a tcpdump on my ral0 
interface and did see the return traffic at least to the IP of my re0.

I was already running dhclient on my ral0 device. I am guess that 
conflicts with this.

Also the internal device plugged into re0 would be on same network as the 
ral0.

The device falls back to its previously provided DHCP address, but I can't 
(Continue reading)

Rob Newberry | 4 Mar 2008 00:54
Picon

Re: share one wireless adapter's connection to second device (wireless bridge?)

802.11 doesn't work this way.  The access point you are connecting to  
knows each STAtion that is connected to it; the 802.11 packets has a  
different header with have additional Ethernet addresses to support  
functionality you desire, but it has to be enabled and/or negotiated  
on both sides.

Your "second" device, which is trying to bridge through your NetBSD  
box, has never sent 802.11 AUTH and ASSOC packets to the AP, so the  
AP is simply going to drop any packets that it receives from that MAC  
address -- and indeed, the wireless driver for the Linksys device  
probably drops them before sending them anyway (since the source  
address does not match it's own, and it knows the AP won't accept them).

There are technologies for solving this -- WDS (four-address 802.11  
frames) for example -- but it requires configuration on both the  
client (STA) and access point side.  I don't think the NetBSD 802.11  
layer has built-in support for this right now, but I could be wrong.

Your simplest bet to solving the problem is to use a NAT connection  
over the wireless link.

Rob

On Mar 3, 2008, at 12:40 PM, Jeremy C. Reed wrote:

> I am using ral0 which is a USB-based Linksys Wireless-G network  
> adapter.
> (I've been using it for 1.5 years on different NetBSD systems. It  
> works
> well except I have to ping at least once every 170 seconds or it loses
(Continue reading)

Martijn van Buul | 3 Mar 2008 22:22

Re: share one wireless adapter's connection to second device (wireless bridge?)

* Jeremy C. Reed:
> My first try was to create a bridge:
>
> sudo ifconfig bridge0 create
> sudo brconfig bridge0 add re0 add ral0 up

fwiw, I've succesfully done the *opposite* route, creating an improvised
access point to an existing wired network, using exactly the same
method. This was with -current, about a year ago, with a cardbus-based
ral card and a fxp0 wired nic.

--

-- 
Martijn van Buul - pino <at> dohd.org 

Manuel Bouyer | 3 Mar 2008 22:02

Re: share one wireless adapter's connection to second device (wireless bridge?)

On Mon, Mar 03, 2008 at 02:40:10PM -0600, Jeremy C. Reed wrote:
> I am using ral0 which is a USB-based Linksys Wireless-G network adapter. 
> (I've been using it for 1.5 years on different NetBSD systems. It works 
> well except I have to ping at least once every 170 seconds or it loses 
> connection.) My ral0 has an IP assigned and I use it.
> 
> I have an external device that uses DHCP to get a connection. I was hoping 
> I could just plug it to my NetBSD's unused re0 device (RealTek 8100E/8101E 
> PCIe 10/100BaseTX (rev. 0x0)).
> 
> My first try was to create a bridge:
> 
> sudo ifconfig bridge0 create
> sudo brconfig bridge0 add re0 add ral0 up
> 
> "brconfig -a" showed the bridge. After I turned on the device, "brconfig 
> -a" showed three more entries in the "Address cache".
> 
> tcpdump on re0 shows a bunch of SIP, igmp, DHCP traffic from my device. I 
> can also see traffic from my DHCP server (the wireless router in the other 
> room) on my re0 device (which is not wireless but on the bridge0). (I also 
> see 169.254.x.x traffic on re0.) (If you'd like me email this tcpdump 
> output to you, let me know.)
> 
> But my device never got its networking up. I am guessing that I can't 
> share multiple connections on that ral0 adapter. I don't know. (My ral0 
> continued to work fine.)

Do you see dhcp requests from your device on re0, and dhcp replies to these
requests ? If you see requests but no replies, tcpdump on ral0. If they don't
(Continue reading)

Jeremy C. Reed | 3 Mar 2008 23:18

Re: share one wireless adapter's connection to second device (wireless bridge?)

On Mon, 3 Mar 2008, Manuel Bouyer wrote:

> Do you see dhcp requests from your device on re0, and dhcp replies to 
> these requests ? If you see requests but no replies, tcpdump on ral0. If 
> they don't show up here, either your server didn't reply, or ral0's 
> promiscous mode isn't working.

I only responded to part of this before. I also did the tcpdump on ral0. 
And I do not see the DHCP server's replies. The ral0's promiscous mode is 
working as I can see that I am sniffing wireless traffic on different IPs 
(on a different laptop for example).

Manuel Bouyer | 5 Mar 2008 21:32

Re: share one wireless adapter's connection to second device (wireless bridge?)

On Mon, Mar 03, 2008 at 04:18:42PM -0600, Jeremy C. Reed wrote:
> On Mon, 3 Mar 2008, Manuel Bouyer wrote:
> 
> > Do you see dhcp requests from your device on re0, and dhcp replies to 
> > these requests ? If you see requests but no replies, tcpdump on ral0. If 
> > they don't show up here, either your server didn't reply, or ral0's 
> > promiscous mode isn't working.
> 
> I only responded to part of this before. I also did the tcpdump on ral0. 
> And I do not see the DHCP server's replies. The ral0's promiscous mode is 
> working as I can see that I am sniffing wireless traffic on different IPs 
> (on a different laptop for example).

Are you sure you're not sniffing broadcast or multicast packets ?
If not, then I promiscous mode should be fine, and I suspect the
issue is on the DHCP server side. Is it some embeded device which acts as
DHCP server ? The access point maybe ? Maybe it won't give more than one
ip per wireless device, independant from the number of MAC addresses sent by
this wireless device ?
Ho, and I guess you don't have MAC adress filtering on the acces point ...

--

-- 
Manuel Bouyer <bouyer <at> antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

Jeremy C. Reed | 3 Mar 2008 22:20

Re: share one wireless adapter's connection to second device (wireless bridge?)

On Mon, 3 Mar 2008, Manuel Bouyer wrote:

> Do you see dhcp requests from your device on re0, and dhcp replies to 
> these requests ? If you see requests but no replies, tcpdump on ral0. If 
> they don't show up here, either your server didn't reply, or ral0's 
> promiscous mode isn't working.

I thought so. The device was assigned an IP. It has a menu where I could 
also see that it was assigned a DNS server and also a default router. And 
the wireless router / DHCP server also has a DNS server which has the new 
hostname as provided by the device.

But now I am thinking that was from old settings from when the device was 
plugged directly to the router in the other room. tcpdump doesn't show the 
dhcp going both ways. I can see in my tpcdump output when the device is 
configured with its previous IP.

And from my NetBSD system I can ping the device. (That's how I saw the 
hostname because of reverse lookup. The hostname includes SIP -- the 
device is a phone.)

I found some emails from this on pkgsrc-users in Sept. 2007. I read that 
maybe you can't bridge with any of NetBSD's wireless drivers -- but 
bridge(4) manpage clearly mentions 802.11 and wireless. Also I read that I 
need a card that supports having as many associations to the AP as 
required. I don't know if my ral0 does. It is:

ral0 at uhub5 port 1
ral0: Cisco-Linksys Wireless-G USB Network Adapter, rev 2.00/0.04, addr 2
ral0: MAC/BBP RT2570 (rev 0x03), RF RT2526
(Continue reading)

Martijn van Buul | 4 Mar 2008 08:09
Picon
Favicon

Re: share one wireless adapter's connection to second device (wireless bridge?)

[ I'm terribly sorry if this shows up twice. I tried posting a similar 
  response yesterday through gmane, but that seems to have gotten lost
  somewhere ]

In gmane.os.netbsd.help, you wrote:
> I found some emails from this on pkgsrc-users in Sept. 2007. I read that 
> maybe you can't bridge with any of NetBSD's wireless drivers -- but 
> bridge(4) manpage clearly mentions 802.11 and wireless. 

For what it's worth, I've been going the opposite route just fine - creating
an improvised access point to enable a wireless-only device to access a wired
network. This about a year ago, using the then -current and a cardbus based
ral-card and an fxp wired network card.

All I did was configure the ral0 card (including telling it to go to hostap
mode), and add both network cards to a brige. Worked just fine.

> Also I read that I need a card that supports having as many associations to
> the AP as required. I don't know if my ral0 does. 

I've used another ral0 card (PCI-based) to create a wireless network at home,
for about 2 years or so. Always worked just fine, even with multiple wireless
clients, before I replaced it with a slightly less power-hungry solution. 
However, that was once again in hostap mode.

--

-- 
Martijn van Buul - pino <at> dohd.org 


Gmane