Establish connection by gateway.

Started by
1 comment, last by qwedcxza 21 years, 7 months ago
I have this problem, there are two LAN, every LAN have a gateway that provide Internet access for hosts in LAN, The gateway have a legal IP( suppose as follow ): LAN1 gateway IP: 61.100.100.99 ( for external interface ) 192.168.1.1 ( for internal interface ) LAN2 gateway IP: 61.100.100.100 192.168.1.1 The hosts in LAN1 or LAN2 have custom IP: LAN1 -> host1 -> 192.168.1.10 LAN2 -> host2 -> 192.168.1.8 How to establish connection between host1 and host2, we have not intercept server, and can''t modify gateway, we can only make software on host1 and host2. Are you clear about that?
Advertisement
No.

What do you consider a ''custom'' IP? And why do you only give one address per LAN? Or is it that you''re only interested in those two?

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
I understand your problem. Each computer is behind a firewall doing NAT, and the computers are on separate networks. Sorry, but there''s no solution to your problem given your criteria. Without modifying the gateway (like setting up port forwarding), or running a server that both hosts connect to, the two computers will NOT be able to communicate.

The problem is caused by the NAT (network address translation). In case you don''t know how NAT works... Inside the LAN, the computers use "fake" IP addresses - addresses reserved for use in LANs (192.168.x.x). Outside the LAN, all of the computers use the "real" IP address (61.100.100.100). NAT makes it possible to share one "real" IP address amongst several computers. However, one consequence of this sharing is none of the computers on the LAN can act as servers on Internet (well, unless you setup port forwarding on the firewall). Since neither of your hosts can''t act as servers, there''s no way to establish a connection.

This topic is closed to new replies.

Advertisement