Questions tagged [ip-address]

An Internet Protocol address (IP address) is a numerical label assigned to each device in a computer network that uses the Internet Protocol for communication. This is a general tag that covers both IPv4 (like 172.168.100.1) and the newer IPv6 (like 2012:da8:0:1234:7:577:8:2). If you specifically mean any of these, use IPv4 or IPv6 tags.

3608 questions
1640
votes
52 answers

How to get a Docker container's IP address from the host

Is there a command I can run to get the container's IP address right from the host after a new container is created? Basically, once Docker creates the container, I want to roll my own code deployment and container configuration scripts.
Murali Allada
  • 16,808
  • 4
  • 15
  • 21
1255
votes
30 answers

How to get the client IP address in PHP

How can I get the client IP address using PHP? I want to keep record of the user who logged into my website through his/her IP address.
Anup Prakash
  • 12,796
  • 4
  • 14
  • 12
596
votes
46 answers

Finding local IP addresses using Python's stdlib

How can I find local IP addresses (i.e. 192.168.x.x or 10.0.x.x) in Python platform independently and using only the standard library?
UnkwnTech
  • 79,308
  • 64
  • 178
  • 223
560
votes
48 answers

How to get client's IP address using JavaScript?

I need to somehow retrieve the client's IP address using JavaScript; no server side code, not even SSI. However, I'm not against using a free 3rd party script/service.
FlySwat
  • 160,042
  • 69
  • 241
  • 308
472
votes
6 answers

Maximum length of the textual representation of an IPv6 address?

I want to store the data returned by $_SERVER["REMOTE_ADDR"] in PHP into a DB field, pretty simple task, really. The problem is that I can't find any proper information about the maximum length of the textual representation of an IPv6 address, which…
Gilles
  • 6,459
  • 2
  • 19
  • 24
419
votes
27 answers

How to get IP address of the device from code?

Is it possible to get the IP address of the device using some code?
Nilesh Tupe
  • 7,053
  • 5
  • 23
  • 30
403
votes
20 answers

How to get a user's client IP address in ASP.NET?

We have Request.UserHostAddress to get the IP address in ASP.NET, but this is usually the user's ISP's IP address, not exactly the user's machine IP address who for example clicked a link. How can I get the real IP Address? For example, in a Stack…
Mehdi
  • 5,155
  • 6
  • 33
  • 54
371
votes
26 answers

How to get the IP address of the server on which my C# application is running on?

I am running a server, and I want to display my own IP address. What is the syntax for getting the computer's own (if possible, external) IP address? Someone wrote the following code. IPHostEntry host; string localIP = "?"; host =…
Nefzen
  • 7,529
  • 13
  • 33
  • 33
330
votes
7 answers

Is it possible to have SSL certificate for IP address, not domain name?

I want my site to use URLs like http://192.0.2.2/... and https://192.0.2.2/... for static content to avoid unnecessary cookies in request AND avoid additional DNS request. Is there any way to obtain SSL cert for this purpose?
Evgenyt
  • 8,665
  • 12
  • 36
  • 44
319
votes
19 answers

What is the most accurate way to retrieve a user's correct IP address in PHP?

I know there are a plethora of $_SERVER variables headers available for IP address retrieval. I was wondering if there is a general consensus as to how to most accurately retrieve a user's real IP address (well knowing no method is perfect) using…
Corey Ballou
  • 39,300
  • 8
  • 60
  • 75
307
votes
16 answers

Express.js: how to get remote client address

I don't completely understand how I should get a remote user IP address. Let's say I have a simple request route such as: app.get(/, function (req, res){ var forwardedIpsStr = req.header('x-forwarded-for'); var IP = ''; if…
Erik
  • 11,695
  • 42
  • 119
  • 194
256
votes
10 answers

Get IP address of visitors using Flask for Python

I'm making a website where users can log on and download files, using the Flask micro-framework (based on Werkzeug) which uses Python (2.6 in my case). I need to get the IP address of users when they log on (for logging purposes). Does anyone know…
Jon Cox
  • 9,614
  • 21
  • 72
  • 113
216
votes
5 answers

Get the client IP address using PHP

I want to get the client IP address who uses my website. I am using the PHP $_SERVER superglobal: $_SERVER['REMOTE_ADDR']; But I see it can not give the correct IP address using this. I get my IP address and see it is different from my IP address…
user1752627
  • 2,367
  • 2
  • 13
  • 9
186
votes
19 answers

Find the IP address of the client in an SSH session

I have a script that is to be run by a person that logs in to the server with SSH. Is there a way to find out automatically what IP address the user is connecting from? Of course, I could ask the user (it is a tool for programmers, so no problem…
flybywire
  • 232,954
  • 184
  • 384
  • 491
180
votes
5 answers

Rails: Get Client IP address

In Rails, what's the best way to get the ip address of the client connecting to the server? Here are two ways I've found: request.remote_ip request.env['HTTP_X_REAL_IP']
ma11hew28
  • 106,283
  • 107
  • 420
  • 616
1
2 3
99 100