Python Forum
Can't see my UPnP Opened Ports
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't see my UPnP Opened Ports
#1
Interesting situation - apologies for the long Preface:
After setting Port Forwards via UPnP on a Google Fiber modem, the modem decided to ignore them after a few days. The ports were still listed using MiniUPnPC (upnpc -l , in Linux), but I could not connect to them and did not show up as 'Open' using various Port Testing Web tools.
Once I deleted them and recreated them, they became 'active', I could connect and they showed as 'Open' on the Port Testing Web sites.

The Code:
So I found this very nice little Python code to test Ports:
import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(2)                                      #2 Second Timeout
result = sock.connect_ex(('xxx.xxx.xxx.xxx',yyyyy))
if result == 0:
  print 'port OPEN'
else:
  print 'port CLOSED, connect_ex returned: '+str(result)
And tried it on the Google Modem I was behind.
Oddly, those Ports Opened Manually through Google's Admin Web interface returned 'port OPEN', while those opened via UPnP always showed 'port CLOSED, connect_ex returned: 111'.
Testing from another location (not behind the Google Fiber modem, the above code worked correctly for both Manually opened Ports and those opened via UPnP.

Finally to my Question:
I need to be able to test if a given port is actually open from behind the Google Fiber modem, and then delete/add it again if not. Is there something wrong with the above code to do this, or another way to test, or perhaps a setting in Google Fiber modem that I missed?

Sorry if this is not appropriate for this forum. It covers so many different areas, I'm not sure where to post it...

Thank you for your time.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Async socket server and ports Pengwyn 1 10,752 Feb-28-2019, 12:13 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020