Suppose I have the following configuration:

  • Router A: WAN port connected to the Internet, LAN =
  • Computer A: Connected to router A as
  • Router B: WAN port connected to router A as, LAN =
  • Computer B: Connected to router B as

Now I want computer A to communicate with computer B seamlessly (e.g. can establish a TCP connection by running nc <port>) by means of routing, rather than merging the two networks into one (which can be easily accomplished using router B as a switch).

Most routers are shipped with NAT turned on, of which I definitely need to turn off in router B. But what other steps do I need to take so that packets from computer A to computer B would go through router B?

I could manually add a routing table entry in computer A so that all packets targeted to go through gateway, but I would prefer an automatic way if it exist.

  • Why do you have two routers? The simplest solution, as you mentioned, is to remove Router B from the LAN because Computer B's traffic is double NAT'ed. – goblinbox Mar 8 '10 at 2:47
  • @goblinbox NAT is not the most important reason for router. Useful reading: en.wikipedia.org/wiki/Broadcast_domain, @netvope is it theoretical or practical question? If practical what routers do You have? – Maciek Sawicki Mar 8 '10 at 2:56
  • @Maciek Sawicki In this case, Computer B is behind two routers, both (if I read the question correctly) NAT enabled. I was wondering what the purpose of this configuration was. The NATing on Router B will make his LAN behave as if Computer A and Computer B are on different subnets, won't it? – goblinbox Mar 8 '10 at 3:07
  • "ost routers are shipped with NAT turned on, of which I definitely need to turn off in router B. " and that is correct solution to avoid double NATing. However he wants to have computer B in different subnets, and that is whole point of doing this. – Maciek Sawicki Mar 8 '10 at 3:12
  • @Maciek It is a theoretical question :), but I think there are several possible reasons for doing these. e.g. To selectively allow traffic between the two networks by using the built-in firewall of router B. – netvope Mar 8 '10 at 3:20

In this case static routing is probably the best option. If You looking for more general solution it think this could be good starting point: http://en.wikipedia.org/wiki/Routing_Information_Protocol.

For 100% automatic configuration You should have two routers with some routing protocol enabled by default but I think You should configure them anyway fore example fore security reasons. Also You probably want to use rip v2 because rip v1 doesn't support VLSM

| improve this answer | |
  • Great answer. I find that Windows Vista/7 support RIP too! To turn on RIP Listener: (1.) Open Programs and Features. (2.) Click Turn Windows features on or off. (3.) Select the RIP Listener check box, and then click OK. – netvope Mar 8 '10 at 3:05
  • To check my understanding: If I turn on RIP on both routers but computer A does not support RIP, packets from computer A to computer B would be first sent to router A (the default gateway), then forwarded to router B, right? – netvope Mar 8 '10 at 3:07
  • Exactly. For direct route You need entry in computer A routing table. You can add it manually or using some routing configuration protocol. – Maciek Sawicki Mar 8 '10 at 3:16
  • For the record, here is a list of commonly used adapter routing protocol: * RIP * OSPF * IS-IS * IGRP/EIGRP – netvope Mar 8 '10 at 3:52

Some routers will allow you to enter supplemental routes in the routing table. So in the Router A, you could enter a route that would say something like: net mask gateway The first answer is also covering this, and although the automatic way of doing this might work, I would rather check this, and hope there is a possible manual routing table entry feature in your router. Sometime, "It's Better Manually" (IBM).


| improve this answer | |

You said you want the route to be discovered automatically. For a small network like this, the RIP protocol is most appropriate to make this happen. If RIP is properly enabled on both routers, router B will send an advertisement periodically saying that it knows how to reach the network. Router A will hear this, and learn the route.

This assumes that both routers support RIP, and can be configured properly. Router A needs to be configured to accept RIP on its LAN interface, while Router B needs to be configured to send advertisements on its WAN interface.

One possible issue: the network is defined as "non-routeable", meaning that packets addressed to that network should never be routed on the general internet. For example, your ISP's routers would drop any such packet. Routers may be configured by default to not route that network. But, they may be smart enough to allow routing of such packets as long as they are still within a private network.

| improve this answer | |

Based on the OP's spec, the Repeater bridge offers wired and wireless connectivity at the remote router and maintain all devices on the same LAN https://www.dd-wrt.com/wiki/index.php/Repeater_Bridge

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.