Using a router as a switch/hub

The ability to use a router as a hub is probably common knowledge in some circles, but Google yielded surprisingly little useful information on the topic. So here’s my weekly contribution to the geek knowledge base…

Your average home computer user will eventually find themselves using a router to take better advantage of their broadband connection. These little black boxes add tremendous value compared to their measly -0 price tag. On of the key features is switching – i.e. the ability to support multiple computers on the same connection. Most of these boxes have 4 ports to plug stuff into, which often leads to a problem: What do you do once you’ve plugged in your PVR, desktop computer, network printer, and docking station for the laptop?

There are a couple obvious solutions – you can buy another router with more ports, or you can buy a dedicated switch. But such devices can be a bit pricey, and if you’re like me, you already have an extra router sitting around. So, why not use that and avoid the guilt-trip involved in chucking a perfectly good networking box in the landfill! Here’s how…

The First Router

One of the nice things about this approach is that you get to leave your existing router alone. It’s probably configured more or less as follows, which’ll work fine for what we want:

WAN IP: dynamically assigned
WAN Subnet Mask: 255.255.255.0
LAN IP: 192.168.1.1
DHCP: Enabled

The 2nd Router

Adding the 2nd router to the network is where things can get confusing. The most common mistake is to set up the 2nd router just like the first, and plug it into one of the LAN ports of the first router. If this works at all (and often it will to a degree) the results are less than desireable. What you’ve actually done here is create a 2nd sub-network, rather than extending the first. Devices on the 2nd network may have access to the internet, but they’ll be walled off from the first network. You’ll be able to browse the web on that new computer you just plugged in, but you won’t be able to share a printer with your first computer, or share files. This is inconvenient and unnecessary.

Instead, the better solution is to dumb down your 2nd router to just it’s essential switch capabilities.

Start by connecting the 2nd router’s “Uplink” port to one of the LAN ports on the first router. (The location of the uplink port varies by manufacturer, and may place restrictions on whether or not you can use the port next to it, so be sure to refer to the manual.) With that done, configure the 2nd router as follows:

WAN Settings (IP, Subnet Mask, DNS Servers, etc.): n/a
LAN IP: Statically assign to an IP on your first router’s LAN. E.g. if your first router’s LAN is 192.168.1.*, give the 2nd router an IP of 192.168.1.123 (making sure you use an address outside the range reserved for DHCP clients on the first router).
DHCP: Disabled

The most important thing here is to disable DHCP – having more than one DHCP server on a network is just never a good thing. Similarly, if both routers are wi-fi enabled, you’ll should disable the wi-fi feature on the second router to keep the two wireless networks from interferring.

Assigning a static LAN IP let’s you access the 2nd router if you need to administer it (not that there’s much left to administer). It also means that if it has print server support, you can access the printer connected to it.

Finally, all the WAN Settings are moot here since there shouldn’t be anything plugged into the WAN port.

That’s pretty much it. Good luck, and if this was useful, feel free to drop a comment.

7/27/07 update: While the above setup worked fine for me, I ran out of ports again. My long(ish) term solution is to install a 16-port switch from SMC. At ~$40 it’s easy on the pocket book, and this particular box is also compact and, more importantly, fanless, so it doesn’t add to the noise in the office – an important consideration since it’s installed about two feet from where I work. It’s only minor drawback is that it’s not a gigabit switch – it won’t maximize the throughput of newer computers with gigabit network cards. But this has little practical impact for me, and shaves ~$150 off the cost.

Oh… and my old hub? I’ll be donating that to a friend of mine who’s signing up for cable broadband.

8/20/07 update: Minor edits to reflect the fact that most of these devices are switches not hubs, as pointed out by Harry, below. (See Hubs, Switches, Routers – A Hands On How To for more info). I also removed the suggestion that the 2nd router might be usable as a wireless relay point. This just isn’t in the scope of this article, and in all likelihood isn’t possible with most routers.)

13 Replies to “Using a router as a switch/hub”

  1. thanks! pretty simple, but as you said, this info was kind of hard to find on google!

  2. Could just go a bit deeper into configuring the second router to use it as a wireless relay point

  3. Asish, it looks like I might have been a bit hasty in implying that any wireless router could be used as a relay. I’m afraid it depends mostly on whether or not your particular brand of router is capable of that.

  4. how would i know if mine is capable of it?
    it is a netgear 54Mbps ADSL Modem Router DG834G v3

    PS: It worked perfectly as a hub though 😉

  5. Your scheme will actually configure most routers as a switch, not a hub. While that is good for extending your network, it not that same as a hub.

    I wanted to configure my extra router as a hub so that I could evesdrop on traffic with ethereal, but since it acts as a switch only the ARP traffic makes it to all ports, thus unlike a hub, there no evesdropping ability.

  6. Harry, great point!

    It hadn’t occured to me to make this distinction in my post, and my use of the word “hub” is simply a relic of the days when these devices were routinely marketed as “router/firewal/hubs”.

    I’m pretty sure the hub .vs. switch behavior is built into the device’s hardware design. I suppose there might be a product out there that lets you configure this, but I’ve never seen that option in any of the SMC/LinkSys/Belkin products I have personal experience with.

  7. I tried to add a Netgear RP614v2 to an existing network that was using a netgear WR624. I followed the instructions here exactly, and found that it would not work. I did read the help file with the 614 and found that it auto senses the need to be a router, switch or hub. Also, the provided software has a setting for the addition of multiple routers. If you select the the numbe rof routers you are using, it will auto configure and the network is set.

    After hours of the instructions here, and no luck, it took less than 15 minutes with the help file.

    Not saying the instructions here won’t work, but may not be needed in all cases. At least in mine it wasn’t.

  8. A big thank you from a recent expat arrival in Bangalore, India! I was sure there was a simple way to do this and with your help I was up and running in 5 min. This is after 1 week of arguing with the phone company, who insisted it was not possible! My local Airtel installation engineer swore that my router could not be set up to work with their ADSL modem and that I would definitely have to buy a so called “Airtel” router. All my colleagues have also been fooled into buying the Airtel routers just because they were convinced by the sales man that it was not possible! I refused to buy it and finaly came across your article so thanks again!

  9. Hi, just a suggestion (or question) can u still turn on the wi-fi on both the routers and let your devices connect(wirelessly) to the routers manually, instead of turning the auto-connect, or will this affect the assigning ip address to the devices? The reason why i want to do 2 routers cos every time im in the basement i always get poor signal. I got a long ethernet cable going to the basement(for my desktop) where i can hook up the 2nd router. i have an extra router lying around my house, too. Might as well use it. 🙂

  10. @paul: That’s a great question, and I’m not 100% sure of the answer. From what little reading I’ve done, this is definitely “the deep end of the pool” in terms of how wi-fi networks work.

    What you’re describing is a “wireless bridge” or “wireless repeater”, a device that relays wireless signal to/from your your primary network/router. You can get dedicated hardware that does this for well under $100 (e.g. the Linksys WRT-11), but that sorta defeats the purpose of this post. 🙂

    I suppose you could statically assign IP addresses to your clients on the 2nd network and see what happens, but I’m skeptical that will work. (I don’t think your suggestion of switching them from auto-connect to manual connect will make a difference, btw – what you care about is how a clients IP address is assigned, not when it’s assigned).

    But honestly, the best I can do here is suggest you read up on this subject – google for “wireless bridge” and “wireless repeater” – and just play around. Also be sure to check out the DD-WRT project since there’s a chance one or both of your router’s are supported. This project provides a firmware upgrade for many routers that, among other things, enables WDS Repeater Mode.

    Definitely drop a comment here if you figure this out – I’ll be curious to know what solution you end up with.

  11. What if i have a wireless network set up in another part of the house and i have 2 computers with wireless cards installed and want to use the wireless router only as a way to transfer files and backup a computer? when i plug both computers into the router it makes my internet connection go slow and then stop working? any info would be greatly appreciated.
    scott

  12. show as more picture of a networked computers using hub,switch, and router…… thank you!!!!

Comments are closed.