Author Topic: Bridge Usb0 And Wlan0  (Read 7026 times)

colin

  • Newbie
  • *
  • Posts: 7
    • View Profile
Bridge Usb0 And Wlan0
« on: May 24, 2007, 06:29:06 pm »
Hi,

I am sure the answer is in the forum somewhere, but I can not find it and I am stuck.

I have C1000 and have installed 3.5.4.1. I am trying to connect to the internet via my laptop using a bridge on the laptop between usb0 and wlan0. The wlan0 connects to my ADSL router.

I think I have followed the procedures on the OZ web site and in the pinned connection topic in this forum.

I have got it to the stage where the C1000 talks to the laptop and the laptop will talk to the world, but the bridge does not seem to forward between usb0 and wlan0 (no ping from the C1000 to anything other than the laptop.)

I am now stuck. The laptop is running slackware, and I will try on the slackware forum if that is the right place to ask.

Hope someone can help.

I have appended the output of some commands below.

Cheers,

Colin

So here what is set up laptop
+++++++++++++++++

// PROMISC is set and there is no IP address on wlan0 and usb0. The br0 bridge has an
// address assigned by dhcpcd

root@slain:/home/colin/Desktop/Zaurus# ifconfig
br0       Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:192.168.123.148  Bcast:192.168.123.255  Mask:255.255.255.0
          inet6 addr: xxxx::xxx:xxxx:xxxx:xxxx/xx Scope:Link
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10477 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6261 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5101013 (4.8 MiB)  TX bytes:707382 (690.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:76 errors:0 dropped:0 overruns:0 frame:0
          TX packets:76 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6500 (6.3 KiB)  TX bytes:6500 (6.3 KiB)

usb0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet6 addr: xxxx::xxx:xxxx:xxxx:xxxx/xx Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:5544 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3139 errors:24 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:432766 (422.6 KiB)  TX bytes:213405 (208.4 KiB)

wlan0     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet6 addr: xxxx::xxx:xxxx:xxxx:xxxx/xx Scope:Link
          UP BROADCAST NOTRAILERS RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:4945 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11351 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4738990 (4.5 MiB)  TX bytes:1067462 (1.0 MiB)
          Interrupt:20 Memory:c0200000-c0202000

// Laptop routing seems correct

root@slain:/home/colin/Desktop/Zaurus# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.123.0   *               255.255.255.0   U     0      0        0 br0
loopback        *               255.0.0.0       U     0      0        0 lo
default         router          0.0.0.0         UG    0      0        0 br0

// bridge claims to be forwarding in dmesg output
br0: port 2(usb0) entering learning state
br0: port 1(wlan0) entering learning state
br0: no IPv6 routers present
br0: topology change detected, propagating
br0: port 2(usb0) entering forwarding state
br0: topology change detected, propagating
br0: port 1(wlan0) entering forwarding state

// no net filtering in for the bridge
root@slain:/home/colin/Desktop/Zaurus# cat /proc/sys/net/bridge/*
0
0
0
0


on the C1000, 192.168.123.55, I have
+++++++++++++++++++++++


// It knows the route to the gateway, the router at  IP address 192.168.123.254.
root@slain:/home/colin/Desktop/Zaurus# ssh 192.168.123.55
root@192.168.123.55's password:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.123.0   *               255.255.255.0   U     0      0        0 usb0
default         192.168.123.254 0.0.0.0         UG    0      0        0 usb0
#

irda0     Link encap:UNSPEC  HWaddr xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx
          NOARP  MTU:2048  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:8
          RX bytes:0 (0.0   TX bytes:0 (0.0

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5999 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5999 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:664986 (649.4 KiB)  TX bytes:664986 (649.4 KiB)

sit0      Link encap:UNSPEC  HWaddr xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0   TX bytes:0 (0.0

usb0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:192.168.123.55  Bcast:192.168.123.255  Mask:255.255.255.0
          inet6 xxxx: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3759 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6580 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:198769 (194.1 KiB)  TX bytes:597037 (583.0 KiB)

//192.168.123.254 is the router and 192.168.123.148 is the latop
//traceroute shows the router is unreachable,

# traceroute 192.168.123.254
traceroute to 192.168.123.254 (192.168.123.254), 30 hops max, 40 byte packets
 1  192.168.123.55 (192.168.123.55)  3026.23 ms !H  3031.38 ms !H  3039.61 ms !H
# traceroute 192.168.123.148
traceroute to 192.168.123.148 (192.168.123.148), 30 hops max, 40 byte packets
 1  192.168.123.148 (192.168.123.148)  2.819 ms  4.624 ms  2.816 ms
#

samac

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Bridge Usb0 And Wlan0
« Reply #1 on: May 26, 2007, 04:46:49 am »
Hi

My setup SL5500 connected via usb to a Slackware 11.0 box.

Cable internet via eth0.

eth0 dhcp
usb0 192.168.0.4
zaurus 192.168.0.5

When I plug in my zaurus I run a small script

Code: [Select]
#!/bin/bash
ifconfig usb0 192.168.0.4 netmask255.255.255.0 up
route add -host 192.168.0.5 usb0

This works for me.

Samac
Zaurus SL5500
Hentges 1.0.x
64mb CF card
256mb SD card
Pocket-top Keyboard
Slackware 11.0 (2.6.17.13)

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3706
    • View Profile
Bridge Usb0 And Wlan0
« Reply #2 on: May 26, 2007, 05:06:53 am »
can you not use masquerading/natting?

--- edit, here's how to do it - assuming that eth0 is the outbound interface on your PC

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
« Last Edit: May 26, 2007, 10:39:34 am by speculatrix »
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

colin

  • Newbie
  • *
  • Posts: 7
    • View Profile
Bridge Usb0 And Wlan0
« Reply #3 on: May 26, 2007, 06:16:03 pm »
Hi,

Thanks for your help guys.

Samac, this is the way I did it in the past. Only, I forgot how to put the gateway on the zaurus. I had put the router address in and I should have put the PC address. This is why I started looking around and saw the bridging solution that seemed simple. Now I have the gateway entry correct in the Zaurus, I can ping router to Zaurus and Zaurus to router. The problem is I can not ping past the router or get web access to the router maintinace page. This, I think, is a router issue.

speculatrix, I have tried the masquerading/natting, but I am missing something from my PC kernal as iptables is complaining that somethng is missing. I started to try to use natting when I read that wlan hardware could not spoof and so bridging would not work.

 Anyway you have both helped move me on a bit so thanks. I wil try not using the masquerading for the moment. Masquerading will be my next step if I get stuck. At least I have managed to find why the iptables was hidden when I was configuring the kernal. I needed the x_tables first.

Cheers,

Colin

Da_Blitz

  • Hero Member
  • *****
  • Posts: 1579
    • View Profile
    • http://www.pocketnix.org
Bridge Usb0 And Wlan0
« Reply #4 on: June 05, 2007, 06:28:59 am »
actually from what i can see there, its a combo of NAT'ing and bridging and its all mixed up

on your laptop i would start from scratch, i bet the problem is there as on the Zaurus you should only have to run "dhclient usb0", "pump usb0" or "udhcp -iusb0" (note no space) and the Z should pick up all the required settings from the router

the Z's route table should have the default entry pointing at the router, as well as the nameserver entry in /etc/resolv.conf, i find that last one gets me when i try and ping yahoo.com instead of an ip

in this case on the laptop i would first bridge the connections (usb0 and wifi0), then run dtclient on br0, make sure that neither wlan0 or usb0 has an IP address and if you can (not required) try to make sure the link in in the "down" state

after reading through it i would bet on the default route is stuffed up on the Z, if you have the gateway for the default path set to the laptop then you will need to set up NAT. try setting the default path to the router instead with

Code: [Select]
route del default
route add default gw

otherwise test what connectivity you have, ie ping teh laptop, then the router then yahoo and post back what works
Personal Blog
Code
Twitter

Gemini Order: #95 (roughly)
Current Device: Samsung Chromebook Gen 3
Current Arm Devices Count: ~30
Looking to acquire: Cavium Thunder X2 Hardware

colin

  • Newbie
  • *
  • Posts: 7
    • View Profile
Bridge Usb0 And Wlan0
« Reply #5 on: July 11, 2007, 05:22:08 pm »
Thanks for the help guys.

I hunted around a bit more. It turns out that ndiswrapper does not support PROMISC, which is required for bridging. I have to use ndiswrapper, as the broadcom support is not quite there yet for bcm43xx.

I will use masquerading for now until the bcm43xx has better support for poor signal strength.

Cheers,

Colin