5

Suppose I have the following configuration:

  • Router A: WAN port connected to the Internet, LAN = 192.168.1.0/24
  • Computer A: Connected to router A as 192.168.1.101
  • Router B: WAN port connected to router A as 192.168.1.102, LAN = 192.168.2.0/24
  • Computer B: Connected to router B as 192.168.2.101

Now I want computer A to communicate with computer B seamlessly (e.g. can establish a TCP connection by running nc 192.168.2.101 <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 192.168.2.0/24 go through gateway 192.168.1.102, but I would prefer an automatic way if it exist.

6
  • 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, 2010 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? Mar 8, 2010 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, 2010 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. Mar 8, 2010 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, 2010 at 3:20

4 Answers 4

3

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

4
  • 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, 2010 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, 2010 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. Mar 8, 2010 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, 2010 at 3:52
2

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:

192.168.2.0 net mask 255.255.255.0 gateway 192.168.1.102. 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).

JF

1

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 192.168.2.0/24 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 192.168.0.0/16 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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .