ofekp / TinyUPnP

A very small UPnP IGD implementation for your ESP8266 for automatic port forwarding
GNU Lesser General Public License v2.1
102 stars 15 forks source link

Could not find port mapping in IGD #39

Open flydr2 opened 4 years ago

flydr2 commented 4 years ago

Been trying to get UPnP to work with no success. Seems to have multiple errors.

see attached log.txt log.txt

ofekp commented 4 years ago

@flydr2 You can see the return error message is saying "OnlyPermanentLeasesSupported".

Do you have UPnP service enabled on your router?

flydr2 commented 4 years ago

Yes an working with other applications.

On Thu, Aug 15, 2019, 3:42 AM Ofek notifications@github.com wrote:

You can see the return error message is saying "OnlyPermanentLeasesSupported".

Do you have UPnP service enabled on your router?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ofekp/TinyUPnP/issues/39?email_source=notifications&email_token=ABG7MGUQAP4NEAZAOS3R5EDQEUCH5A5CNFSM4ILNIIB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4LDFMQ#issuecomment-521548466, or mute the thread https://github.com/notifications/unsubscribe-auth/ABG7MGVOHQMSD7AZND2XSM3QEUCH5ANCNFSM4ILNIIBQ .

ofekp commented 4 years ago

Can you please try to change LEASE_DURATION from 36000 to 0? If that does not work, please try again with -1.

Let me know the results.

flydr2 commented 4 years ago

I had tried 0... Will try -1 and report back when done...

flydr2 commented 4 years ago

-1 does not work... looks like the same thing log.txt

flydr2 commented 4 years ago

The router is a ZYXEL VMG1312-B10B Untitled

ofekp commented 4 years ago

Every documentation or advise I was able to find say 0 should do the trick. Can you send me the log after you set this to 0 please?

Then, please attach the file from this path (I am partly guessing this URL since it is not printed in the log): http://10.0.0.1:5431/dynsvc/WANPPPConnection121.xml

Then, if you are familiar with PostMan or any other tool that lets you send POST requests, please send the following (I am assuming you internal address is still 10.0.0.6):

Method:

POST

URL:

http://10.0.0.1:5431/uuid:6031978d-0edc-dc0e-8d97-3160318ddc02/WANPPPConnection121

Headers:

Content-Type: text/xml; charset="utf-8"
Connection: close
SOAPAction: "urn:schemas-upnp-org:service:WANPPPConnection:1#AddPortMapping"
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
  <u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANPPPConnection:1">
  <NewRemoteHost></NewRemoteHost>
  <NewExternalPort>9191</NewExternalPort>
  <NewProtocol>TCP</NewProtocol>
  <NewInternalPort>9191</NewInternalPort>
  <NewInternalClient>10.0.0.6</NewInternalClient>
  <NewEnabled>1</NewEnabled>
  <NewPortMappingDescription>NoLuz</NewPortMappingDescription> 
</u:AddPortMapping>
</s:Body>
</s:Envelope>

I removed the <NewLeaseDuration>-1</NewLeaseDuration> completely from the request.

Let's see if this sets the rule correctly.

flydr2 commented 4 years ago

Here is the log with "0" log.txt

Also what I have changed in the script Untitled

flydr2 commented 4 years ago

As requested the xml... (Renamed it .txt) WANPPPConnection121.xml.txt

I will try to figure out what you want me to try with PostMan

flydr2 commented 4 years ago

As requested the xml... (Renamed it .txt) WANPPPConnection121.xml.txt

I will try to figure out what you want me to try with PostMan postman

ofekp commented 4 years ago

@flydr2 Nice work following my requests :)

I can see that using 0 results in a 200 OK response which is awesome and a good sign. The rule is just not found after that, and we need to find out why.

Please make sure that the rule is not found in the router using the web UI. If it is, please delete it.

Now, please add the following line to the body, as one of the parameters in the PostMan request you sent before? <NewLeaseDuration>0</NewLeaseDuration> You can put it just before the </u:AddPortMapping>.

I am expecting to see 200 OK response this time, if not, we have another issue in the PostMan request. Make sure your Headers section in the PostMan app are set correctly too.

If you do get 200 OK, please check the router config to see if you can find the rule using the Web UI.

If you don't get 200, please run the code again with the lease duration const set to 0, and after it runs (and fails) a few times, please check the router for the rule.

Let me know what happened.

ofekp commented 4 years ago

Hey @flydr2, any luck?

flydr2 commented 4 years ago

Not at home for awhile...

ofekp commented 4 years ago

I hope you're on vacation :) Have fun, we'll continue at your convenience.

I have taken the liberty to remove your name and phone number from your message, since they are not publicly available at your GitHub profile. Probably added automatically. Cheers!