Your router should know its own exteal IP address, mine does, and if I log in to the status page I can read it.
software can read it too: eg, I use the following in my /etc/ddclient.conf
use=web, web='http://192.168.2.1/status_main.stm', web-skip='var wan_ip="'
Which lets the ddclient software get the exteal IP address from that page on my router. Your router will probably be different in detail but it likely similar in general operation.
The convenient thing about websites like http://icanhazip.com is that they work for everyone, there no need to find the router and the password to log into it to read the coection parameters.
upnp is another way to do this, eg: http://stackoverflow.com/questions/799557/trying-to-get-nats-exteal-ipaddress-with-inatextealipaddresscallback-in-c-s
برچسب:
نویسنده: استخدام کار