rcl_dev2IpInterfaceObject | V ... | V rutIpt_initNat | V rutIpt_activatePortMappingEntries_dev2 | V rutIpt_portforwardCfg_dev2 | V rutIpt_portforwardRunIptables | V rut_doSystemAction
# select an igd u.selectigd() # display information about the IGD and the internet connection print('local ip address :', u.lanaddr) externalipaddress = u.externalipaddress() print('external ip address :', externalipaddress) print(u.statusinfo(), u.connectiontype())
# find a free port for the redirection r = u.getspecificportmapping(11111, 'TCP') eport = 11111 while r != Noneand eport < 65536: eport = eport + 1 r = u.getspecificportmapping(eport, 'TCP')
print('trying to redirect %s port %u TCP => %s port %u TCP' % (externalipaddress, eport, u.lanaddr, 11111))
b = u.addportmapping(eport, 'TCP', '`reboot`', 11111, 'UPnP IGD Tester port %u' % eport, '') if b: print('Success. Now waiting for some HTTP request on http://%s:%u' % (externalipaddress ,eport)) # b = u.deleteportmapping(eport, 'TCP') # if b: # print('Successfully deleted port mapping') # else: # print('Failed to remove port mapping') else: print('Failed')