Getting my ip address

后端 未结 12 1157
走了就别回头了
走了就别回头了 2020-12-16 23:34

I have a computer on a small network, so my ip is 192.168.2.100.

I am trying to get my real ip. I download the no-ip client but that just seems like a lot of trouble

相关标签:
12条回答
  • 2020-12-17 00:02

    Some routers can tell you their external IP address via UPnP, or more specifically, the IGD protocol. If you happen to own an UPnP enabled router, you can try this. IStaticPortMapping::get_ExternalIPAddress sounds promising.

    SNMP enabled devices can tell you their IP addresses, too. The OID to ask for is IP-MIB::ipAdEntAddr.

    0 讨论(0)
  • 2020-12-17 00:03

    When I need to check my public ip address, I like this website:

    http://www.whatismyip.global/

    The website keeps a history of your IPs. For me is very usefull!

    0 讨论(0)
  • 2020-12-17 00:05

    Do note reinvent the wheel, there is a standard protocol, STUN (with already existing implementations), just for that. See also Discovering public IP programatically.

    0 讨论(0)
  • 2020-12-17 00:06

    I always use curl http://whatismyip.org to get my public IP while behind NAT.

    0 讨论(0)
  • 2020-12-17 00:12

    I can't think of how you would resolve your IP address from the perspective of another machine. Here's a couple thoughts:

    • Automate the loading of the ip-adress.com page and parse it
    • Look at DynDNS
    0 讨论(0)
  • 2020-12-17 00:14

    Unfortunately, you're server will most likely be completely oblivious to what it's own External address appears to be (as it might be set further upstream via some router/gateway)

    You could have a look at this link

    http://ip-address.domaintools.com/myip.xml

    It might be a little easier to parse than what you're currently doing.

    0 讨论(0)
提交回复
热议问题