RoR - Get Private address of Client [closed] - ruby-on-rails

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I want to get the private address, i.e. The internal IP address of the client who accessing my Rails application. My client is having an organization say with a public IP 61.16.175.141. Internally they are having a number of users each having a private IP address in the range of Class C network ranging from 192.168.0.0 to 192.168.255.255. I want to find that private IP address of the user.
I tried most of the answers and nothing matches my result. I tried request.remote_ip, it just renders the public IP address of the organization. Sockets are also working in the same manner. Can any one help me on this please. Hope this clarifies my query. Thanks in advance

By private address, I guess you mean the IP address allocated to a machine by its native OS? I'm fairly sure this information is unobtainable from outside a private network, as this is masked to a globally unique public address, allocated by the ISP and mapped somewhere at entry point to the users private network. You would somehow need to access the users routing table which will store a list of private addresses to it's own external entry point.

Related

openwrt does not resolve the domain name which points to a private ip [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 days ago.
Improve this question
Description:
There is a domain name road.songyangxing.com which resolves to 172.20.12.79. Notice that the ip is private.
We build and run openwrt on Raspberry Pi 4 Model 4. We connect the WiFi lan which the openwrt generates.
Run the command ping road.songyangxing.com, it shows Ping can't find host road.songyangxing.com.
It's OK for pinging the domain name which resolves to a public ip. It's OK for pinging road.songyangxing.com when we change another router.
Question:
How could we let openwrt allow private ip domain name?

Any one Know ?? how to get router ip address from mac and iPhone? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
i wanna get router ip address,i got code for how to get ip address but i didn't get router ip address(Ex: 20.30.40.01 like that).any one know please ping me..
Follow the below steps:-
1)Go to Settings
2)Network
3)Advanced
4)Select TCP/IP tab
You will get IP address of MAC.
If you want the external address:
curl -4 ifconfig.co
curl -6 ifconfig.co
If you want the internal address:
Check if your code also returns the gateway, that's the routers internal address
Your local network router is always at 192.168.1.1 it plays the role of "machine 1" on the local network, or the last 1 in 192.168.1."1"
In the event this is not typically default, and to program it into your application I would refer to the code in this posting: (How can I determine the default gateway on iPhone?)
open up terminal, type:
scutil
list (Lists all your settings)
show State:/Network/Global/DNS
Terminal should read "192.168.1.1" or other primary connection(router ip)
Should be able to script that and include it into your apps. :)
Happy Coding Ahead!

How can I get thin (the webserver) to be accessible outside of my home network? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I followed the simple instructions for installing the "thin" web server in my ruby application via: http://code.macournoyer.com/thin/
I can see that it is being called when I "start" it. However, while I am able to access the web server using "localhost". I would like to be able to access it using my ip address, or some other way - so that I can send a colleague that's not on my home network to my test app.
while I have fiddled around with some variables (port, host, etc) I am still missing something.
How can I access my thin server from outside of my home network?
Note: I do not have a firewall enabled. - Any thoughts on how to resolve this?
This is more of a network issue than a server setting issue.
You would probably need to set your router to redirect incoming accesses to your computer, how to do will vary from router to router.
In most cases there should be a menu in the router that lets you specify a port, and what internal IP address you want the request to be routed to, set that to your machines LAN IP address, and it should be good to go.
You will probably get a better answer at Server Fault or Super User.

How does URL work? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have an URL that point to a specific page http://stackoverflow.com/questions/123. Assume that stackoverflow.com is 123.12.12.12. How does DNS map a specific URL to the specific page after identifying the IP?
It doesn't. DNS just tells you what IP address to connect to. It's the web server's job to map the URL to the page.
DNS does not map URLs to pages, it is used strictly to look up host/domain names. URLs map to pages through the routing integrated into the web server.
For example, the client computer has a URL and looks up the host name part in DNS, which returns the IP. The computer then connects to the IP on the protocol-specific port and sends the HTTP request over that connection. The server then internally processes the URL from the HTTP request and returns the appropriate content.
The specific resource to access is given in the HTTP (in case of HTTP) request once you know the ip of the server.
Using the case in your example, a GET request would be something like this:
GET /questions/123 HTTP/1.1 <- Here you have the specific resource
Host: stackoverflow.com <- Here you have the host
And the DNS transform the host stackoverflow.com to 123.12.12.12

Associate IP addresses with countries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I want to show country flag depending on ip address I receive at server side.
Are fixed ip addresses are assigned to countries ? Where can I get database for ip address to country mapping ?
Take a look at the following:
IP address geolocation SQL database
Geo Locate IP Address XML API Whois Map Country Provider
How to Geolocate Visitors Using an IP-to-Country Database
Free IP to Country Database
My IP Address Lookup and Geotarget IP Project
MaxMind - Open Source IP Address to Country Database
IP address geolocation SQL database
Also on Stack Overflow:
What is the most applicable solution to detect which country an ip belongs to?
Is there any possible way to find the name of the country using IP with scripting language PHP?
IP to Country?
code for finding the state,country,city from the IP Adress in php
Once you have the country code, then you can display the flag with these free icon sets which use ISO country codes:
Flag icons
Flags of the World
PHP Advent also just published a whole article on a very similar process:
GeoIP Wrangling
You're looking for an IP geolocation service such as MaxMind.
ip2location.com provides an IP range database which can be used to tag IP addresses
they provide it in different formats as well so you can choose which one is useful to you
Maxmind is the one we use
Open Sourced self contained flag rendering based on IP:
ip2ensign
It will lookup UV coordinates in a flag texture atlas that matches an arbitrary IP.
And it comes with the IP range database and the texture.

Resources