Access my router's gateway network?

0

2

I have two routers in my place.

Main router (connected to the Internet) - 192.168.1.1

Secondary router (connected to the main router) - 192.168.0.1

I have a Network storage device and a few shared directories connected to the main router.

(Network storage - 192.168.1.16)

How can I access one of them using a PC connected to the secondary router?

Home Network diagram:

Home Network

I currently have access to the internet using both laptop and main PC, but I want to get access from my laptop to the storage and to my shared directories.

The problem is the my main router always forwards all packets straight to the WAN.. (Internet)

Danpe

Posted 2012-03-23T09:47:44.317

Reputation: 1 131

Do you kbow, that DuobleNATing is very bad idea? – Lazy Badger – 2012-03-24T05:29:13.677

Answers

7

How can i acces one of them using a PC connected to the Secondery Router?

Make sure both the routers are properly configured. Each should have a routing table entry for both LANs (192.168.1.x and 192.168.0.x). Such routes can be statically configured or dynamic (using a routing protocol such as RIP).

Properly configured routers will let PCs know what to do when PCs contact the wrong router (typically by issuing ICMP redirects).


Here's a scenario using one router to support two LANs and Internet access

  (Internet)
       |       
   +---o-----+     +------+     +------+
   |DSL Modem|     |switch|     |switch|
   +---O-----+     +-OOOO-+     +-OOOO-+
       |             |  |         |  |
   +---O--+          | +O-+       | +O-+
   |Router|          | |PC|       | |PC|
   +-O-O--+          | +--+       | +--+
     | |             |            |
     | `-------------'            |
     `----------------------------'

                 |<--------->|   |<--------->|
                  192.168.1.x     192.168.0.x

The router connects both LANs to the INternet and allows all PCs on both LANs to contact each other. The router provides DHCP service to both LANs, That DHCP service tells PCs in each LAN the "gateway address" is the IP-address of the router's interface on that PC's LAN.


Here's a scenario using a second router to link the two LANs

  (Internet)
       |       
   +---o-----+     +------+     +------+
   |DSL Modem|     |switch|     |switch|
   +---O-----+     +-OOOO-+     +-OOOO-+
       |             || |         |  |
   +---O--+          || `-.       | +O-+
   |Router|          ||   |       | |PC|
   +---O--+          ||  +O-+     | +--+
       |             ||  |PC|     |      
       `-------------'|  +--+     |     
                      |           |          
                      `----. .----'   
                           | |
                        +--O-O--+
                        |Router2|
                        +-------+

                |<--------->|<--------->|
                 192.168.1.x 192.168.0.x

This is more complicated. Router2 will have a default gateway pointing to the Internet router but will have interfaces in both LANs. If the Internet Router provides DHCP service for the 192.168.1.x LAN, we must make sure that Router2 is configured so it does not also try to provide DHCP service for that LAN. Router 2 should provide DHCP service for 192.168.0.x. Administratively it might be better to make Router 2 provide DHCP service for both LANS and disable DHCP service on the Internet Router - but this may be a less resilient configuration.

If a PC in 192.168.1.x tries to use Router2 to contact the Internet, Router2 will redirect the PC by sending back an ICMP redirect. If a PC in 192.168.1.x tries to use the Internet router to contact the PC in 192.168.0.x, the Internet router will issue a redirect but to do this it has to first be configured to know that router2 is the nearest route to that LAN. I'd typically do this by static config but you could let the routers communicate using RIP or another routing protocol and work it out for themselves.


Update:

You have routers with built-in ethernet switches (pretty common nowadays for small-office/home routers). So you can probably use the "secondary router" as a dumb switch and save yourself a lot of problems.

 (Internet)
     |
  +--o--+  +--------+     +--------+
  |DSL  |  | Router |     | Router |
  |modem|  | .------|     | .------|
  +--O--+  | |switch|     | |Switch|
     |     +O--OOOO-+     +O--OOOO-+
     |      |  | ||        |  | ||
     `------'  | ||        x  | ||
               | ||           | |`-----.
             ,-' |`-----------' |      |
             |   `--.           |      |
            +O-+    |          +O-+   +O-+
            |PC|  +-O-+        |PC|   |PC|
            +--+  |NAS|        +--+   +--+
                  +---+

      |<---------------------------------->|
                 all 192.168.1.x

I added another PC on the right hand side, as there's no need for a second switch to serve a single PC. In fact with only four PCs/NAS, you probably have enough LAN ports on the main router alone. But perhaps the right-hand-side PCs are in another room and you only have provision for one cable between rooms.

RedGrittyBrick

Posted 2012-03-23T09:47:44.317

Reputation: 70 632

What should i configure in my router, i'm currently on a PC connected to the main router, when im trying to access 192.168.0.1 (Secondery) i get no response. (Request timed out) – Danpe – 2012-03-23T10:05:58.863

1@RedGrittyBrick Kind of Interest, did you use a program for your nice network layout, or was it created manual? I assume you draw it by yourself. If it so, well done :) – JohannesM – 2012-03-23T10:14:16.200

@Danpe, it depends on how your LANs and router's are connected - draw us a network diagram and update your question. Specific instructions depend on make and model of routers. – RedGrittyBrick – 2012-03-23T10:35:02.317

2@JohannesM: The program I used was Notepad :-) It's kind of a little challenge I set myself. – RedGrittyBrick – 2012-03-23T10:35:41.177

@RedGrittyBrick So you say it's impossible with my current setup? i cant tell the main router to forward by address and not by port? I Added my home network diagram, I'm not notepad elite as you so :P – Danpe – 2012-03-23T10:46:55.507

@Danpe: I'm saying it should all just work. Are the routers linked by 100-BaseT cable or is WLAN bridging involved? What are the routing tables on the routers? – RedGrittyBrick – 2012-03-23T11:01:17.167

@RedGrittyBrick They all connected 100-BaseT cable. Where can i check the routing tables ? – Danpe – 2012-03-23T11:10:13.170

2@Danpe: You can check roting tables in your router's configuration/administration interface (usually a web-page for home routers). My best guess at the cause of the current problem is that the main router doesn't have a route entry for the LAN segment hidden behind your secondary router. HOWEVER - I suspect you would be better off reconfiguring the secondary router as a plain old dumb Ethernet switch. This might mean moving a cable from a port labelled "WAN" to a port labelled "LAN" and disabling all it's DHCP and other services. Two routers and two LANs seems overkill for the average home. – RedGrittyBrick – 2012-03-23T11:24:19.867

@RedGrittyBrick - and double NAT promises many "pleasant" moments :-) except routing – Lazy Badger – 2012-03-24T05:38:38.033

So it solved by turning the Secondery Router to a dumb switch, by disabling the DHCP and switching from WAN to LAN Thanks! :) – Danpe – 2012-03-24T11:52:49.357

2

You may be better off using a single network instead and configuring the second router as a regular switch. If you need seperate LANs however, there is an alternate setup that provides basic functionality but requires less configuration and is available on routers where routing tables are not or hardly manageable.

Connect the second router's WAN interface to the main router's LAN and enable DHCP on both. Make sure both are using the correct LAN IP-addresses and subnets, 192.168.1.1 and 192.168.1.0/24 for the first, 192.168.0.1 and 192.168.0.0/24 for the second. Hosts on seperate networks will probably not be able to see each other, but hosts on the second network can connect to machines on the first.

For instance, the laptop can connect to the network share using \\192.168.1.16\share. It will not know how to reach this host directly, thus passing on the request to the standard gateway, the second router. The second router will pass it on to its standard gateway, being the main router, which will in turn connect to the known host 192.168.1.16.

The same connection cannot be initiated from the main network, as those machines have no way of reaching the 192.168.0.0/24 subnet without forwarding ports on the second router.

Marcks Thomas

Posted 2012-03-23T09:47:44.317

Reputation: 5 749

"enable DHCP on both" you forgot about (possible) collateral damage - slave router may act as DCHP-relay and transfer DHCP requests on master. I'll not predict exact results (environment- and HW-dependent) – Lazy Badger – 2012-03-24T05:35:09.457

A DHCP relay would be trouble, but that's exactly why the second network needs a DHCP server of its own, unless you're going for static IP settings. The main router will not properly traverse the second in handing out IPs. – Marcks Thomas – 2012-03-24T10:25:01.357

2

Simplest way is to use only 1 LAN: disable DHCP on 2nd router and plug the cable that come from main router into a LAN port instead of WAN port. All your IPs will be in same subnet and you'll be able to reach everything from everywhere.

laurent

Posted 2012-03-23T09:47:44.317

Reputation: 4 166