cavalive has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I have a perl program that sends a signal to a remote computer in the internet, and receives a response signal. When I connect to the internet through another computer, and obtai an IP address of the type 192.168.... the signal sent wont return. I am using a simple server and client program, just like the one proposed on ther perl cookbook. How can I make my client receive the server response inside the home intranet???
Thanks in advance!
  • Comment on Sending a Signal to a computer inside an intranet

Replies are listed 'Best First'.
Re: Sending a Signal to a computer inside an intranet
by phydeauxarff (Priest) on Sep 16, 2003 at 03:47 UTC
    Not really a perl question but rather a networking question....

    As previously described your address 192.168.x.x is an RFC 1918 address and as such, is not routable.

    Your public IP address assigned to you by your ISP is likley being translated into the RFC1918 address via a broadband gateway performing a function known as Network Address Translation or NAT. The gateway is probably configured for one-to-many NAT in that many private addresses are sharing the same public address.

    The net-sum result of this is that you cannot established an unrequested session into any host on your private lan without doing one of two things.

    The first would be to either get another IP address from your ISP and map this directly to the private address of your server. Alternatively, if your gateway supports it you could do port mapping if you only need to map a certain port like port 80. This would allow you to use one IP but have all http requests go to the private host as an example.

    The other, and IMHO the best alternative would be to use IPSEC to establish a VPN session into your private network.

    At any rate, you have some reading to do...good luck

Re: Sending a Signal to a computer inside an intranet
by jasonk (Parson) on Sep 16, 2003 at 02:44 UTC

    The 192.168 address block is known as a private address space (as defined in RFC 1918), it is not routable over the Internet at large unless you connect your computer to the other network using something such as a VPN.


    We're not surrounded, we're in a target-rich environment!
Re: Sending a Signal to a computer inside an intranet
by jdtoronto (Prior) on Sep 16, 2003 at 03:42 UTC
    When you connect to the other computer you are assigned a local address. I would suspect therefore that the other machine is using NAT or a similar sharing/firewall technique. In that case you will need to open a return path for the port that the remote computer is wanting to send the response to. In many NAT systems the firewall functions will block many unusual ports.

    You will need to consult the documentation for the particular sharing/firewall software you are using.

    jdtoronto

Re: Sending a Signal to a computer inside an intranet
by BUU (Prior) on Sep 16, 2003 at 05:18 UTC
    In addition to the many other routes suggested above, it might be simplest/easiest/whatever to just write a tiny socket program that sits on the firewall/gateway that listens for requests from inside, passes it to the outside and then returns it. You can find an extremely simple one in the Cookbook (socket section).
      It's a neat example, but it would be safer and simpler to use SSH for this. It already has port forwarding built in, and is carefully checked for security.
Re: Sending a Signal to a computer inside an intranet
by Dr. Mu (Hermit) on Sep 16, 2003 at 06:33 UTC
    I'm not sure what the real problem is here. If the gateway computer and the computer upon which your Perl program runs (the client computer) are configured properly, the networking internals should direct your signal to the internet computer if you give it that computer's address. Your program shouldn't even have to know the LAN address of the gateway computer to do what you want. This assumes two things:

    1. The gateway computer is properly configured for network address translation.

    2. The client computer's networking is set up to route all requests to the "outside" through the gateway computer.

    Given this, there should be nothing your program needs to know about how its request gets to the internet, nor how the reply gets back. That's the magic of network routing.

Re: Sending a Signal to a computer inside an intranet
by cavalive (Novice) on Sep 23, 2003 at 00:29 UTC
    Actually, my goal is creating a chat program. When a computer is located in an intranet, it wont receive the signals coming from the other person from the internet. Does anyone have any brilliant idea?