OpenWrt Forum Archive

Topic: Router to Switch

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

Some maybe thinking why I would want to turn the WRT to a switch.  My network has *real* IP addresses and when I use the routing function on the WRT it takes away access from the local network because the router runs its own intranet.  So I want to turn the WRT into a switch and have the wireless just work as an accesspoint. 

How would I go about doing this?

Basically, if you're using the original Linksys firmware, then just ignore the WAN port configuration.  If you're using OpenWRT and need ipkg, then replace the default route to point at the same gateway as your other machines (otherwise you won't be able to get packets out on the Internet from the router itself).

Aside from that, basically all you need to do is plug one of the LAN ports into your existing switch (or use the box as the only switch on your LAN, and plug one of the 4 LAN ports into your router).

I have a similar setup, except that all the devices on this LAN have private IPs.  I'm not using the box as a router either, though, so I just plugged LAN port 1 into my main switch (edit: and set the default gateway).

From what I am reading, there is a setting for a gateway that I just have to change to the gateway of my other machines. 

For example, say the default gateway on the WRT is 192.168.1.1  and my other gateway that I use *WITHOUT* using the NAT functions and routing on the WRT is 10.0.1.1....  I need to chance a setting in the WRT to 10.0.1.1 enable for my router(WRT) to just act as a switch?

Wouldn't it still give IP address to each machine via DCHP or would static then have to be in order?

What commands to do all this?

From what I am reading, there is a setting for a gateway that I just have to change to the gateway of my other machines.

Yep, pretty much.

For example, say the default gateway on the WRT is 192.168.1.1  and my other gateway that I use *WITHOUT* using the NAT functions and routing on the WRT is 10.0.1.1....  I need to chance a setting in the WRT to 10.0.1.1 enable for my router(WRT) to just act as a switch?

So if you don't have the WRT plugged in, your default gateway is 10.0.1.1, am I reading that right?

If so, yeah, you need to change the default gateway on the WRT to match.  (But only if you need ipkg; otherwise, the default gateway setting on the WRT isn't really used.)

Wouldn't it still give IP address to each machine via DCHP or would static then have to be in order?

I believe it will still run a DHCP server, yes.  If you want to disable that, edit whichever init script starts up dnsmasq, and comment out the line that actually starts it.  (Assuming you don't need DNS either -- if you need it to do DNS, you can edit the dnsmasq.conf file to disable DHCP, I think.)

What commands to do all this?

To set the default gateway:

route del default
route add default gw 10.0.1.1

The rest is done by editing files, so you need to know how to use vi.  (Unless there's another editor installed in OpenWRT?  I don't think so, though.)

The discussion might have continued from here.