3

I have an Apache server running on a Raspberry P and it works just fine in the local network. And after forwarding port 80 and trying to connect using the public IP, Chrome says ERR_CONNECTION_REFUSED. But the strange thing is that I CAN reach the server when using VPN and using the same IP. What can I do?

   -telnet 80.***.***.78 80

    Trying 80.***.***.78...
    telnet: connect to address 80.***.***.78: Connection refused
    telnet: Unable to connect to remote host

   -route -n

    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
    192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0


   -sudo netstat -lapute:

            Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
    tcp        0      0 *:http                  *:*                     LISTEN      root       6137        2051/apache2
    tcp        0      0 *:ssh                   *:*                     LISTEN      root       6367        2249/sshd
    tcp        0      0 pi.local:ssh            nmb.local:65535         ESTABLISHED root       8669        2565/sshd: pi [priv
    udp        0      0 *:9949                  *:*                                 root       5918        1809/dhclient
    udp        0      0 *:mdns                  *:*                                 avahi      6293        2184/avahi-daemon:
    udp        0      0 *:54070                 *:*                                 avahi      6295        2184/avahi-daemon:
    udp        0      0 *:bootpc                *:*                                 root       5946        1809/dhclient
    udp        0      0 pi.local:ntp            *:*                                 root       6310        2200/ntpd
    udp        0      0 localhost:ntp           *:*                                 root       6309        2200/ntpd
    udp        0      0 *:ntp                   *:*                                 root       6304        2200/ntpd

1 Answers1

2

This is normal. Port forwarding only works for connections from the outside in. Port forwarding will not allow servers on a LAN to connect to machines on that same LAN using the router's public IP address. That requires a form of dual NAT (NAT both before routing and after routing) called hairpinning.

Some routers do hairpinning when you configure port forwarding, which confuses some people into thinking port forwarding does this. But it does not.

I explained it in more detail here.