Fun with home networking. Two WAN IPs, one LAN.

wrt54g.jpgI finally picked up the Linksys WRT54G Wireless Router. Before I even got it out of the box I was thinking up ways to connect it to my network. I’ll be talking about basic networking and configuring 2 routers to talk to each other, creating two separate networks both with internet access. You should be comfortable with router settings, giving your machines static IPs, CAT5, and other basic networking concepts.

A not so unique situation: You have the ability to get multiple IPs from your ISP over the same connection. For example: At my brother’s house they have broadband cable split with a switch into two routers. They want to have 2 internet IPs for several different reasons:
1. They want two servers on the web with different IPs. Both can dish out websites at the same time and still co-exist on the same network.
2. PS2s and other game systems get wonky when they are more then one of them on the LAN. It won’t work correctly if they both are trying to play the same online game as they have “technically” the same IP. Network address translation does a good job, but the online game server still can’t deal with 2 game systems on the same IP.

At my house I have the unique situation – off a college campus network. This means that I have several drops (ethernet jacks) around the house at my disposal. I also believe that they throttle the connection according to “drop” not according to “house” or “account”. Not only do I get the benefits of two separate IP addresses, but I get an added performance benefit as well.*
1. Network upstairs has three computers using file sharing, etc.
2. Network downstairs has a networked PS2 and soon to have some sort of PVR like Tivo.

Now you kids at home can duplicate this setup by splitting your cable connection with a switch or adding a second cable modem (for an additional fee from your cable provider) to your house. You won’t have one huge fat pipe, like multi-home or connection teaming. *The performance will come from the fact that being online with your PS2 won’t tank your music downloads going on upstairs.

The main problem: You have two routers, two separate subnets. How can I send movies to my PC from my PVR if I can’t see it on the LAN. How can I backup my PS2 games (There’s a way you can do that?!) onto my server if I can’t ping my PS2 from my PC.

The answer is static routing and a crossover cable or uplink port. Here is what my network looks like:
net_layout.jpg

First get both of your routers setup and on the internet with separate IP addresses. Leave DHCP on for the time being as it will allow you to connect easily and test this configuration. For simplicity I put my WiFi WRT54G Linksys router #1 in the 10.0.1.X subnet. You could use any subnet in the 10.X.X.X (or 192.168.X.X) range but I don’t plan on connecting more then 254 computers off my LAN. :) I put my Linksys made Network Everywhere NR041 downstairs, setup on the 10.0.2.X subnet. If you are not methodical with the next few steps you may not know WHAT network you are on, etc.

Connect PC to router 1 – test internet. Make sure you are on the 10.0.1.X subnet.
Connect PC to router 2 – test internet. Make sure you are on the 10.0.2.X subnet.
Now connect both routers together with a crossover cable. If you happen to have a NR041 you have a snazzy little button for “uplink” on the router in port 1 and you won’t need a special cable. Take port 1 of router #1 and plug it into port 1 of router #2 with your cable. Apparently port 4 on the Linksys WRT54G can also serve as an “uplink” port – not requiring a special crossover cable. Check out the WRT54G uplink documentation here. You can’t be sure you will need a special cable unless you look up the documentation of your router to see if one of the ports can be used as an uplink port. All else fails, buy the cable.
Connect to router 1 – test internet.
Connect to router 2 – test internet.
No fires? :D Now let�s configure static routing and turn off DHCP on one of those routers. Connect to router #1 and make your first static route to destination 10.0.2.0 (255.255.255.0). Then connect to router #2 and make your second static route to destination 10.0.1.0 (255.255.255.0). Routing all the 10.0.2.X traffic to router 1 and all the 10.0.1.X traffic to router 2. A handshake if you will.

The routing table for router 1 will look like this.
The routing table for router 2 will look like meow.
More on using static routing. I love all the warnings on this page. As if your router will melt if you mess it up. The worst thing that you may have to do is hard reset the router to factory defaults…*gasp.* Hack away! :D

Can’t I have DHCP on both of them? Which one should I drop?
You could leave it ON on both routers, but one of them will beat the other into submission and cause confusion on your network. You should only have ONE DHCP server on your LAN. So which subnet will it be? I chose router #1 to dole out my IP addresses. It has the WiFi and more then likely machines will be coming and going on that router. The second router I have static devices like my PS2 and PVR which I can set with static IPs on the 10.0.2.X range.

Now hook into router #1 and ping 10.0.2.1 (router #2) if your crossover (uplink) and static routes are setup correctly you now have one LAN with two WAN IPs. Go to one of the PC’s hooked into router #2 (that you gave a static 10.0.2.X address) and ping router #1 at 10.0.1.1. That wasn’t so hard now was it? :p

Some wacky stuff to realize: Your router #1 is handing out IP addresses from the 10.0.1.X range all over your LAN now. So when you connect a laptop or PC to router #2 you will be given a 10.0.1.X address, even though you configured that router for the 10.0.2.X range. If you were to then access the net, Peter Packet would route through router #2 to the WAN connected to router #1. Confused yet?

It’s not a redundant connection. If the WAN connected to router #1 goes down and for some reason the WAN connected to router #2 stays up – only computers on the 10.0.2.X subnet will be on the network. This also goes for internet connection teaming. If you are downloading a file from a computer on the 10.0.1.X subnet you will only be downloading it over THAT routers WAN port – NOT simultaneously over 2 networks. In order to do connection teaming or multi home connections you will need expensive network hardware, or a dedicated *nix box with 3 network cards inside.

So now you should be able to see all the computers on your network. It might take a while for “Network Neighborhood” to catch up so I usually rely on Start – Run – “\10.0.0.100″ Sometimes settings in the router block Windows naming to the local subnet only. (I’m at this point not sure why…) Your PC named “compy” at 10.0.2.100 may never show up on the network neighborhood list of a computer with an IP of 10.0.1.50. Not to say you can’t connect or make a map or shortcut to its shares – just that Windows won’t ever find it on its own. This is one of the reasons I never rely on Windows Network Neighborhood to reflect what is “really” going on.

3 thoughts on “Fun with home networking. Two WAN IPs, one LAN.

  1. Do a search for autonomous routing with a Linux-based bastion firewall like SmoothWall. That will allow you to drop multiple (3 or more) NICs into the Linux box and let it figure out the load balancing automatically. You can load balance by IP, MAC, port, protocol, etc. I’ve been running SmoothWall at home for well over a year and it’s a great little project.

    Since you only have one subnet that solves all your weird DHCP problems. :)

  2. Kris,

    You say:
    Some wacky stuff to realize: Your router #1 is handing out IP addresses from the 10.0.1.X range all over your LAN now. So when you connect a laptop or PC to router #2 you will be given a 10.0.1.X address, even though you configured that router for the 10.0.2.X range. If you were to then access the net, Peter Packet would route through router #2 to the WAN connected to router #1. Confused yet?
    *****************************

    But the default route that router#1 gives out should be its own 10.0.1.1 address and therefore Peter Packet would route through router #1 NOT #2 as you stated. The connection should work fine, just going over the crossover and out the other router.

  3. Now I’m confused. :)
    Um – YES
    What I’m trying to explain is the fact that even though you are physically connected to router #2 you will have a 10.0.1.X address and you will be using the WAN connection on router #1

    I never want to be a technical writer :p

Leave a Reply