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 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.

3875 questions
56 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
  • 21,718
  • 4
  • 19
  • 21
36 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
  • 14,406
  • 4
  • 17
  • 12
49 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?
  • 88,102
  • 65
  • 184
  • 229
31 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.
  • 172,459
  • 74
  • 246
  • 311
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…
  • 7,183
  • 3
  • 21
  • 24
31 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,655
  • 5
  • 25
  • 30
7 answers

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

I want my site to use URLs like and 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?
  • 10,201
  • 12
  • 40
  • 44
21 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…
  • 5,435
  • 6
  • 37
  • 57
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…
  • 14,060
  • 49
  • 132
  • 218
27 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 =…
  • 7,819
  • 14
  • 36
  • 34
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
  • 42,389
  • 8
  • 62
  • 75
12 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
  • 10,622
  • 22
  • 78
  • 123
4 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…
  • 2,527
  • 2
  • 15
  • 10
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…
  • 261,858
  • 191
  • 397
  • 503
46 answers

Validating IPv4 addresses with regexp

I've been trying to get an efficient regex for IPv4 validation, but without much luck. It seemed at one point I had had it with (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?(\.|$)){4}, but it produces some strange results: $ grep --version grep (GNU grep)…
Matthieu Cartier
  • 2,361
  • 4
  • 17
  • 15
2 3
99 100