rejetto forum

[Solved] UPnP port forward

123459 · 4 · 9590

0 Members and 1 Guest are viewing this topic.

Offline 123459

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
I searched barely, but not found any solutions, so i make this dirty hack.

Quote
If you need hfs to automatically redirect its port via UPnP
(so others from internet will be able to access your hfs behind your router's NAT), then you can use following:  

1. Download latest MiniUPnP http://miniupnp.free.fr/files/
2. Extract and place upnpc-static.exe to your hfs directory.  

3. In hfs, press alt+F6 (or goto Menu-> Other options->Edit event scripts)
This will open hfs.events file.

4. Add following text to hfs.events:

Code: [Select]
[start]
{.exec|upnpc-static.exe -u http://10.0.1.1:1900/igd.xml -a 10.0.1.2 80 80 tcp 0|out=#x.}

[quit]
{.exec|upnpc-static.exe -u http://10.0.1.1:1900/igd.xml -d 80 tcp|out=#x.}


Explanation:
Code: [Select]
[start] // will add port redirection when hfs is started
{.exec|upnpc-static.exe
-u http://10.0.1.1:1900/igd.xml // used to bypass router detection. "XML root description url", can be found by executing "upnpc-static.exe -s"

 -a // add port redirection
10.0.1.2 //internal ip of your network card, you must write it manually
 80 // local port
 80 // external port
 tcp // protocol
 0 // duration, 0 - redirection will stay indefinetely
|out=#x // hide upnpc window
.}
[quit] // remove port redirection, when hfs is closing. You need to do this, because (dumb) programs on other computers will be unable to redirect 80 port to their computer.

{.exec|upnpc-static.exe -u http://10.0.1.1:1900/igd.xml -d // delete port redirection
 80 tcp|out=#x.}



Questions:
Can hfs completely hide window of executed program?
(cmd START /b, cmd /c doesn't work)

Is there a way to get LAN ip from hfs?
If not, can hfs parse output of executed program?

To Dev: when you add upnp support, will you add ip detection using upnp?
« Last Edit: May 25, 2012, 07:03:52 PM by 123459 »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
1) try this
{.exec|upnpc.exe|out=#x.}
{.^#x.}

2) get ip where? inside a script?

3) can't answer now, i don't know if upnp can do that.


Offline 123459

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
1) try this
{.exec|upnpc.exe|out=#x.}
{.^#x.}

2) get ip where? inside a script?

3) can't answer now, i don't know if upnp can do that.


Thank you - |out=#x works.

Yes, in script. The lan ip must be substituted in -a [10.0.1.2 Thats lan IP]

upnp can - run "upnpc-static.exe -s" and you will get ExternalIPAddress


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
sorry, apparently there's no such capability.

you'll have to do it by capturing upnpc with {.exec.}