My setup:
DSL Broadcom Atheros
LAN - OpenWrt - - - - wifi - - - OpenWrt2 - LAN
Wifi 192.168.1.1 192.168.2.1
aka 192.168.1.2 (to OpenWrt)
I have DHCP for both handled by OpenWrt, and wol on OpenWrt can wake hosts on both.
Basic setup:
OpenWrt
/etc/config/network lan section:
#### LAN configuration
config interface lan
option type bridge
option ifname "eth0.0"
option proto static
option ipaddr 192.168.1.1
option netmask 255.255.255.0
config route OpenWrt2
option interface lan
option target 192.168.2.0
option netmask 255.255.255.0
option gateway 192.168.1.2
/etc/config/dhcp lan section
config dhcp
option interface lan
option start 100
option limit 150
option leasetime 12h
# Give DHCP addresses to OpenWrt2 clients
option 'options' '-F lan,192.168.2.100,192.168.2.150,255.255.255.0,12h'
/etc/config/wireless is unchanged from original (AP mode, wds2).
OpenWrt2:
/etc/config/network lan and wan section:
config 'interface' 'lan'
option 'type' 'bridge'
option 'ifname' 'eth0.0'
option 'proto' 'static'
option 'ipaddr' '192.168.2.1'
option 'netmask' '255.255.255.0'
config 'interface' 'wan'
option 'ifname' 'eth0.1'
option 'type' 'bridge'
option 'proto' 'dhcp'
option 'hostname' 'OpenWrt2'
/etc/config/wireless:
config wifi-device wifi0
option type atheros
option channel '2'
option disabled '0'
config wifi-iface
option device wifi0
option network wan
option mode sta
option ssid ssid
option encryption 'psk2'
option key 'key'
/etc/config/firewall:
config defaults
option syn_flood 1
option input DROP
option output ACCEPT
option forward DROP
config zone
option name lan
option input ACCEPT
option output ACCEPT
option forward ACCEPT
option masq 1
config zone
option name wan
option input ACCEPT
option output ACCEPT
option forward ACCEPT
option masq 1
DHCP is off:
/etc/init.d/dnsmasq disable
Two new files:
/etc/init.d/dhcrelay:
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=60
start () {
dhcrelay -i br-lan -i br-wan OpenWrt
}
stop() {
killall dhcrelay
sleep 1
killall -9 dhcrelay
}
/etc/init.d/udp-proxy: (for WOL proxy from OpenWrt when LAN host is connected to OpenWrt2)
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50
start () {
udp-proxy 40000 192.168.2.255
}
stop() {
killall udp-proxy
sleep 1
killall -9 udp-proxy
}
udp-proxy C program is available here http://www.vttoth.com/tunnel.htm
Hope this helps someone
Misha