OpenWrt Forum Archive

Topic: Setting up an OpenWRT router to act as a switch behind another router

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello gentlemen,

First of all, i'd like to congratulate any OpenWRT dev that might be reading this for the work they've done, i'm really amazed of how nice everything looks.
I've been trying to tweak my openWRT router (good ol' linksys WRT54G v3) for a couple of tasks... with some various level of sucess.

Now here's the deal: I set up a PLC link between my "box" (french term for router-modem) and another remote room in my house, and I'd like to plug my old  linksys router on it, and act as both an Wifi access-point and a regular ethernet "switch" concerning the LAN ports. In other word, i'd like openwrt to act as an enhanced "switch", kindof the way this kind of thing does:
http://www.devolo.com/consumer/106_dlan … .html?l=en

The router would be connected to the PLC using the WAN plug of the router, and i'd like the adressing to be transparent to the upstream "master" router.

I've seen a couple of threads and documentation articles talking about this kind of set up, but always not exactly what I want, for instance :
- http://wiki.openwrt.org/doc/recipes/routedclient works kind of the same way, but here the wifi-interface is used to act as a bridge between the master router and the open-wrt router... no wan port!
- https://forum.openwrt.org/viewtopic.php?id=16783 i tried this on backfire... didn't work.

Any link you could point out to me, or help provided, would be great,
hadware.

Ok.  I'm going to assume we're starting from a stock flash on Openwrt, and we're talking Kamikaze or newer.

You're going to want to do a couple things. From your description I gather you're wanting a 5 Port WiFi switch & Access Point.  Not hard to do.


#1.  Change the switch configuration in /etc/config/network to reflect everything being on a single vlan. (This will make it so you can use your Wan port)  Typically your Wan port is on a separate vlan.

#2.   Either disable dnsmasq, or go to your /etc/config/dhcp file and add the option 'ignore' '1' to your DHCP for the lan network. (Insuring you don't have (2) sources of DHCP)

#3.  Probably going to want to put this routers LAN IP on the same segment as your other main router, assuming you want to be able to access both from your lan network.

Ex.  Main 192.168.1.1/24

This WiFi switch.  192.168.1.2/24

That's it.  You configure the WiFi just like you normally would, and it is bridging to the lan interface by default which is now a (5) port switch.

(Last edited by hoovey316 on 21 Jul 2013, 17:25)

Hey, thanks for the very short response time,

i'm running backfire on a WRT54G v3 , http://wiki.openwrt.org/toh/linksys/wrt … 54gs.v1.v2

So I have a very hard time figuring out what everything means in the /etc/config/network file (it's easier for wireless).

I've made this draft for now, using the default "stock" config as a base...  really don't get how the whole virtual-lan (VLAN) thing works in openwrt, and a lot of lines in the config are still unclear to me, so if you feel like explaining stuff, go ahead, i'll be very thankful.

#### VLAN configuration 
config switch eth0
    option enable   1

config switch_vlan eth0_0
    option device   "eth0"
    option vlan     0
    option ports    "0 1 2 3 4 5"

#### Loopback configuration
config interface loopback
    option ifname    "lo"
    option proto    static
    option ipaddr    127.0.0.1
    option netmask    255.0.0.0


#### LAN configuration
config interface lan
    option type     bridge
    option ifname    "eth0.0"
    option proto    static
    option ipaddr    192.168.1.100
    option netmask    255.255.255.0

Another question I have is: since apparently the wlan interface is refered to as "eth1" (http://wiki.openwrt.org/toh/linksys/wrt … 54gs.v1.v2), do I have to add a bridge between those two?

The vlan config in /etc/config/network looks good to me now.


To answer your question, yes you need to bridge between the (2) but it is already done because of (2) options.

/etc/config/network

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'   <<    This setting
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

/etc/config/wireless

config wifi-iface
        option device   radio0
        option network  lan  <<  This setting
        option mode     ap
        option ssid     'yourssid'
        option encryption none


Next add this.

/etc/config/dhcp

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option ignore '1'  <<  This setting

(Last edited by hoovey316 on 21 Jul 2013, 21:05)

Okay great. I'll figure out how to use the default "reset" button to actually be a functionnal "reset" button on my router if I mess up (since the whole "recovery boot" thing is a bit annoying), and try these settings out.

Do you think I should make a small documentation article about it or it's already there and I juste wasn't able to find it?

Thanks, pretty straightforward article... And about my question? Should I make one?

There's already "dumb ap" recipe, with perfect description, I use this config on 90% of my routers.

nozombian wrote:

There's already "dumb ap" recipe, with perfect description, I use this config on 90% of my routers.

Wiki: Dumb AP

Works perfectly!

the weird thing is that I don't "see" the openWRT router on my "master" router as a host (on this router's admin interface)... but I can access it via its static IP (here 192.168.1.100)... so I guess it's a problem with the master router.

(Last edited by hadware on 23 Jul 2013, 13:35)

I've been trying to turn a WRT54 into a switch and the dumb ap recipe isn't working for me.  Could you post your config files?  Many thanks!

The discussion might have continued from here.