Getting my ip address

后端 未结 12 1158
走了就别回头了
走了就别回头了 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:15

    The way you're doing it is probably as good as any.

    You say you have a public FTP site -- do you also have a web site there? Your other option is to have your local machine access a php page on that public facing site. That php page can verify it's you and then use the $_SERVER['REMOTE_ADDR'] to record your external IP.

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

    Your computer has no information on any NAT or routing that takes place between it and the internet except which hop is the next one (usually your router's internal ip). It simply doesn't know at which hop the internal address gets translated into which public address.

    Therefore there is no simple function or method you can call, in any language.

    The only two ways are to ask someone else. How?:

    • Ask your NAT router (because it itself does the translation to a public ip) by fetching and parsing the right page on your router's admin site. Arguably most reliable, and fair.
    • Ask an external host how it sees you, by fetching and parsing a public service such as http://dynamic.zoneedit.com/checkip.html. An example in VB script is here.
    0 讨论(0)
  • 2020-12-17 00:17

    If you want to get the eventual IP that the remote site seems when processing your traffic then the only way is to actually access a remote site. In many situations your computer may not be aware that the IP is getting changed by a proxy or a NAT server.

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

    No, there's not really an easier way. Your computer really doesn't know the public IP it's behind -- there could any number of layers of NAT between it and the public internet. All it knows is that it receives messages at 192.168.2.100, and sends outgoing messages through the gateway at 192.168.2.1. It has no idea what happens after the packet hits the gateway.

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

    You can also access this page to get your IP

    http://www.biranchi.com/ip.php

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

    Not quite what you asked for but still applies to what you want. I setup a GMail Notifier on my home computer and go to the account activity page to see which IP address is accessing my Google acount. Secure, simple and works.

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