Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here's my situation:

On my network, most of the clients are on an outside router.

Router 1 192.168.1.1
   |
   | - Client
   |
Router 2 192.168.1.2 to router 1,
   |      192.168.2.1 to clients within
   |
Samba server - 192.168.2.25

I cannot figure out how to get clients under router 1 to access the Samba shares in router 2. I have forwarded ports 139 and 445 to the appropriate machine in router 2 but machines in router 1 still cannot access the server.

How would I set this up?

share|improve this question
2  
Is router 2 doing NAT/PAT? –  Zoredache Nov 19 '10 at 2:21
add comment

2 Answers

Router2 doesn't need to do port forwarding, it needs to do routing.

If client has address 192.168.1.123 say and default gateway 192.168.1.1 then all you need to do is set a static route on router 1 that directs traffic for 192.168.2/24 to Router 2 (192.168.1.2).

When client sends traffic to router1 for the file-server, Router1 will reply with an ICMP redirect and the clients will thus learn of the appropriate router for the address of the file server.

It is far better to have the routers manage routing than to set static routes on clients.

Port forwarding is the wrong tool for this job. Port forwarding is mainly useful when an external client is attempting to access resources in an unrouteable LAN. Within one organisation's use of 192.168 block of private addresses, all subnets are routeable. Of course it is possible to mess up address allocation to subnets but port forwarding is not the answer to that either.

share|improve this answer
add comment

your clients have to be configured to use 192.168.1.2 as the gateway for all packets going to 192.168.2.0/24. Given that their default route is 192.168.1.1, then:

Linux:

route add -net 182.168.2.0/24 gw 192.168.1.2

Windows:

route add 192.168.2.0 mask 255.255.255.0 192.168.1.2 metric 2

Cisco router:

conf t
ip route 192.168.2.0 255.255.255.0 192.168.1.2

...etc.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.