OpenWrt Forum Archive

Topic: true switch

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

Is it possible to have ASUS WL-500g Deluxe configured to behave as a true switch - to have some connected directly to WAN and be able to send DHCP requests to WAN from them, with their physical MAC address ? My idea is to have 2 ports behaving default way ("NAT"), and 2 ports behaving like they were on the switch/hub connected directly to WAN cable.

I was trying to add another interface "switch" and vlan2, like this:

# vlan0ports="1 2 3 4 5*"
vlan0ports="1 2 5*"
vlan2ports="3 4 0*"
vlan2hwname=et0
switch_ifname=vlan2
switch_device=vlan2
switch_proto=none
# (the rest is left as default)

but it does not work as I expected. I am unable to ifup switch, also there are problems connecting to 1, 2 ports.
However, is the configuration correct at least theoretically ?

I've been doing a lot of playing around with the switch lately. Not sure exactly what the setup is on a Deluxe (I've got one but haven't checked the switch settings), but if it's anything like the Premium your setup will work, you simply need to make sure that you include port 5 in each of your VLANs since this is the port that actually connects into the CPU of the router; if you don't include port 5 the router never gets to see the traffic (it only gets switched on the ports of the switch itself rather than into the router).

You probably need to do some bridge setting up as well. Take a look at this post:
http://forum.openwrt.org/viewtopic.php?id=9632

And of course the NetworkInterfaces page explains the whole port 5 thing:
http://wiki.openwrt.org/OpenWrtDocs/NetworkInterfaces

jolouis wrote:

... you simply need to make sure that you include port 5 in each of your VLANs since this is the port that actually connects into the CPU of the router; if you don't include port 5 the router never gets to see the traffic ...

Thats what I want. For those 2 "true switch" ports I don't want CPU to see the traffic.

Oh, it's nice. But 2 + 1 = 3

(Last edited by mykhal on 23 Apr 2007, 21:18)

Okay sorry my misunderstanding; so you end up with 3 ports (WAN plus two others) as just a switch (invisible to router), and 2 ports as actually connected to the router right? If that's the case then there is no way/need to "ifup" the interface since it doesn't actually exist on the router itself logically... the switch is a separate device and operates independantly, so once you set it up there's no need to try and configure IP settings/etc for it, it should just work... that is in theory at least.

I found in my own applications that the easiest thing to do was place each port on it's own VLAN, and then just group together which ever ones I wanted into logical bridges (IP addys/etc are assigned per bridge). This also seemed to be necessary to make Spanning tree work properly, so added bonus!

i.e.
Set all 5 ports to their own VLANs

vlan0hwname="et0"
vlan0ports="0 5*"

vlan1hwname="et0"
vlan1ports="1 5*"

vlan2hwname="et0"
vlan2ports="2 5*"

vlan3hwname="et0"
vlan3ports="3 5*"

vlan4hwname="et0"
vlan4ports="4 5*"

# And create two bridges.. this is the LAN, I include WIFI in mine which is eth2
lan_ifnames="vlan3 vlan4 eth2"
lan_ifname="br0"

# and here's your WAN bridge
wan_ifnames="vlan0 vlan1 vlan2"
wan_ifname="br1"

Of course you don't have to use wan_ for your second bridge, I just use it out of convinience. If you do stick with it, don't forget to clear out the rest of the wan_ settings (i.e. ipaddr, etc).

It seems a bit complicated, but like I said it makes spanning tree work properly and it makes it very easy to move ports around as you desire in the future.

Works nice, it's a nice solution. Thanks.
On my wl-500gd "eth2" needs to be replaced with "eth1"; someone may even happen with this router, that LAN1 port, is port 4, LAN2 is port 3, etc..

I still wonder if there's a way how to ignore port 5 for the wan ports..

actually, the jolouis' solution seems to behave not exactly as I expected - the router itself is unable to reach WAN (so I cannou easily install packages ftom internet) but I'm not sure if it's not my mistake somewhere..

The discussion might have continued from here.