Help bridging eth0 and wlan0

Ask questions about Arch Linux ARM. Please search before making a new topic.

Re: Help bridging eth0 and wlan0

Postby pepedog » Tue Mar 08, 2011 9:52 pm

dhcrelay -i wlan0 192.168.1.1 #<----- the ip address of the dhcp server giving out ip addresses, not the eth0 address.

I just tried giving a static ip address to wlan0 on that sub-net (was fixed but a different sub-net, which I already said failed because of above reasons). Anyway, that failed also, couldn't ssh in and had to unplug plug (actually, plugged in usb keyboard, alt-ctrl-del and turned off when light flashed green)
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Help bridging eth0 and wlan0

Postby pepedog » Wed Mar 09, 2011 12:11 am

I am giving up with dhcrelay, you have to config of dhcpd server on the other machine, which makes it more complicated. Sticking with dnsmasq and shorewall.
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Help bridging eth0 and wlan0

Postby BinaryJay » Wed Mar 09, 2011 5:12 am

$this->bbcode_second_pass_quote('pepedog', 'd')hcrelay -i wlan0 192.168.1.1 #<----- the ip address of the dhcp server giving out ip addresses, not the eth0 address.

I just tried giving a static ip address to wlan0 on that sub-net (was fixed but a different sub-net, which I already said failed because of above reasons). Anyway, that failed also, couldn't ssh in and had to unplug plug (actually, plugged in usb keyboard, alt-ctrl-del and turned off when light flashed green)


I'm giving up on this until we have 2.6.38 and the updated drivers for the device. I gave it a good go buying multiple devices and trying to be adventurous but I think I'm crossing a half built bridge here.
BinaryJay
 
Posts: 87
Joined: Mon Dec 06, 2010 10:27 pm

Re: Help bridging eth0 and wlan0

Postby BinaryJay » Wed Mar 09, 2011 4:10 pm

This looks promising... though I guess I'm a little confused about "adds support" since, technically, it is "working" already at least in client mode from what I could tell. Anyway, please make sure that this driver is in the 2.6.38 release of the Arch Linux ARM kernel.

2.6.38 is very shortly to be released I gather?

Thanks. :P

.config - Linux/x86_64 2.6.38-rc7 Kernel Configuration
─────────────────────────────────────────────────────────────────────────────
┌─────────────── Ralink rt27xx/rt28xx/rt30xx (USB) support ───────────────┐
│ CONFIG_RT2800USB: │
│ │
│ This adds support for rt27xx/rt28xx/rt30xx wireless chipset family. │
│ Supported chips: RT2770, RT2870 & RT3070, RT3071 & RT3072 │
│ │
│ When compiled as a module, this driver will be called "rt2800usb.ko". │
│ │
│ Symbol: RT2800USB [=n] │
│ Type : tristate │
│ Prompt: Ralink rt27xx/rt28xx/rt30xx (USB) support │
│ Defined at drivers/net/wireless/rt2x00/Kconfig:126 │
│ Depends on: NETDEVICES [=y] && WLAN [=y] && RT2X00 [=y] && USB [=y] │
│ Location: │
│ -> Device Drivers │
│ -> Network device support (NETDEVICES [=y]) │
│ -> Wireless LAN (WLAN [=y]) │
│ -> Ralink driver support (RT2X00 [=y]) │
├─────────────────────────────────────────────────────────────────( 79%)──┤
│ < Exit > │
└─────────────────────────────────────────────────────────────────────────┘
BinaryJay
 
Posts: 87
Joined: Mon Dec 06, 2010 10:27 pm

Re: Help bridging eth0 and wlan0

Postby BinaryJay » Tue Apr 19, 2011 3:47 pm

Under 2.6.38 using the plug as a wireless N AP using rt2800usb with WPA2 is working great now.

I haven't played around with it too much yet to know how much of this script I actually need to make it work and how much of it is unnecessary (like, hostapd probably brings up br0 by itself when setting bridge=br0 in config etc.)

Does anybody know why the wireless adapters activity light blinks constantly when hostapd is running even when there are no clients connected and no data being transferred? I thought it might be linked somehow to eth0 activity but even when I close all connections on eth0 it continues. It's slightly annoying since the only spot I have left to plug the adapter in is on a hub vertically right in front of the TV (and, it's just weird and makes me constantly question what's going on with the network). :|

Edit: Below seems to work as a daemon script fine for me... hurrah.

$this->bbcode_second_pass_code('', '
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/hostapd

case "$1" in
start)
stat_busy "Starting hostapd"

ifconfig eth0 0.0.0.0 #remove IP from eth0
ifconfig eth0 down #ensure the interface is up

ifconfig wlan0 0.0.0.0 #remove IP from wlan0
ifconfig wlan0 down #ensure the interface is up

brctl addbr br0 #create br0 node
brctl addif br0 eth0 #add eth0 to bridge br0
brctl setfd br0 0

/usr/bin/hostapd -B -P ${HOSTAPD_PID} ${HOSTAPD_CONF} &> /dev/null

sleep 5
#brctl addif br0 eth0 #add eth0 to bridge br0
#brctl addif br0 wlan0 #add wlan0 to bridge br0

ifconfig br0 192.168.1.150 netmask 255.255.255.0 #ip for bridge

ifconfig eth0 up
ifconfig br0 up #bring up interface

route add default gw 192.168.1.1 # gateway

if [ $? -gt 0 ]; then
stat_fail
else
stat_done
add_daemon hostapd
fi
;;
stop)
stat_busy "Stopping hostapd"
[ -f ${HOSTAPD_PID} ] && kill `cat ${HOSTAPD_PID}` &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
stat_done
rm_daemon hostapd
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac

')
BinaryJay
 
Posts: 87
Joined: Mon Dec 06, 2010 10:27 pm

Re: Help bridging eth0 and wlan0

Postby BinaryJay » Thu Apr 21, 2011 7:52 pm

I have a question... ever since I've started running the above script on bootup the plug seems to lose it's grip on the nameserver of my router and can no longer resolve hostnames.

I can fix it by editing /etc/resolv.conf and adding:
nameserver 192.168.1.1

But, it keeps getting overwritten back to it's default empty values every boot. Is there any way you guys know of to either fix it so that I don't need to modify resolv.conf or to stop it from getting changed?
BinaryJay
 
Posts: 87
Joined: Mon Dec 06, 2010 10:27 pm

Re: Help bridging eth0 and wlan0

Postby pepedog » Thu Apr 21, 2011 8:26 pm

Is there a note at the bottom of resolve.conf about creating a file resolve.conf.tail for such a thing?
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Help bridging eth0 and wlan0

Postby BinaryJay » Thu Apr 21, 2011 8:54 pm

$this->bbcode_second_pass_quote('pepedog', 'I')s there a note at the bottom of resolve.conf about creating a file resolve.conf.tail for such a thing?


Jeez... I don't know how I didn't notice that. Thanks. Any idea about how I can eliminate the need altogether though? I assume it's because I am not using DHCP to assign an IP to the bridge but I'm not sure how I can manually supply the nameserver.
BinaryJay
 
Posts: 87
Joined: Mon Dec 06, 2010 10:27 pm

Re: Help bridging eth0 and wlan0

Postby pepedog » Thu Apr 21, 2011 9:13 pm

How is the device on the local side of the plug getting an address? If you have it as dhcp the when it gets the address the server supplies it (if it's set to)
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Help bridging eth0 and wlan0

Postby BinaryJay » Thu Apr 21, 2011 10:25 pm

Here is where I get confused. The wireless clients could not get an IP address until I changed dhcpd.conf to have this:

$this->bbcode_second_pass_code('', '
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.20;
option routers 192.168.1.1;
option ip-forwarding off;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
}

')

So, I assume at the end of the day the plug is providing the IP and hostapd is not going to my router for DHCP and I can't find any way to tell it to do so. Regardless of my resolv.conf contents, the wireless clients have a correct nameserver (probably supplied by dhcpd - option routers (192.168.1.1 is my gateway). It is just the bridge (which is what I must use to access the plug itself on my network) which needs the resolv.conf nameserver specification.
BinaryJay
 
Posts: 87
Joined: Mon Dec 06, 2010 10:27 pm

PreviousNext

Return to User Questions

Who is online

Users browsing this forum: No registered users and 18 guests