3

I'm trying to make a p2p connection from a device outside a private network to a device inside a private network and behind a NAT.

I'm using lib net.sbbi.upnp to add a Port Mapping to my router.

import net.sbbi.upnp.impls.InternetGatewayDevice;
import net.sbbi.upnp.messages.UPNPResponseException;

.....

uPnPPortMapper = new UPnPPortMapper();

try {
    uPnPPortMapper.openRouterPort(externalIP, externalPort,internalIP,internalPort, ApplicationConstants.ADD_PORT_DESCRIPTION);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (UPNPResponseException e) {
        e.printStackTrace();
    }


public boolean openRouterPort(String externalRouterIP,int externalRouterPort, String internalIP,int internalPort, String description) throws IOException, UPNPResponseException {

    /** Upnp devices - router search*/
    if(internetGatewayDevices == null){
        internetGatewayDevices = InternetGatewayDevice.getDevices(ApplicationConstants.SCAN_TIMEOUT);
    }

    if(internetGatewayDevices != null){
        for (InternetGatewayDevice addIGD : internetGatewayDevices) {           
            addIGD.addPortMapping(description, externalRouterIP, internalPort, externalRouterPort, internalIP, 0, ApplicationConstants.TCP_PROTOCOL);
            addIGD.addPortMapping(description, externalRouterIP, internalPort, externalRouterPort, internalIP, 0, ApplicationConstants.UDP_PROTOCOL);
        }
        return true;
    }else{
        return false;
    }
}

This code do add a port mapping inside my router like you can see in below UPnP table of my TP Link TL-WR940ND:

Current UPnP Settings List

ID App Description External Port Protocol Internal Port IP Address Status

1 Skype UDP at 192.168.0.101:3105 31051 UDP 31051 192.168.0.101 Enabled

2 Skype TCP at 192.168.0.101:3105 31051 TCP 31051 192.168.0.101 Enabled

3 OPEN PORT ON IGD USING UNPN 31052 TCP 31052 192.168.0.102 Enabled

4 OPEN PORT ON IGD USING UNPN 31052 UDP 31052 192.168.0.102 Enabled

The problem is that when I try to establish a connection from outside my network to my public ip + port 31052 I receive a timeout.

I'm using the site (http://www.ipfingerprints.com/portscan.php) to check port status and the port 31052 is marked as 'filtered' while skype's port is marked as 'open':

PORT STATE SERVICE

31051/tcp open unknown

31052/tcp filtered unknown

I didn't find any other settings at my router that skype could be changing like a firewall rule to make the port open.

I've already tested some apps like 'Droid UPnP Port Mapper' (android app) and 'UPnP PortMapper' (windows app) but all of them sucessfully create a port mapping inside my router but none of them let the port 'open'.

My router is not behind a double NAT since my external ip given by http://www.ipfingerprints.com/ is 189.xx.xxx.xxx and also is my router WAN IP.

lhts
  • 61
  • 1
  • 3

0 Answers0