How to use MaxMind GeoIP detection while using CloudFlare? - geoip

I'd like to know how can we detect the IP of the client with maxmind GeoIP while using Cloudflare ?

You need to use CF special server variable "HTTP_CF_CONNECTING_IP" to get the actual user IP address.
Please use the following code to replace your original server variable "HTTP_CF_CONNECTING_IP".
$_SERVER['REMOTE_ADDR'] = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];

Related

KAA MongoDB server, Data not retrived sent from Raspberry Pi

I am running this example http://kaaproject.github.io/kaa/docs/v0.10.0/Programming-guide/Your-first-Kaa-application/ .
But data is not storing on the server side.
What should I do now?
When I running db.logs_my_application_token.
find() from mongo console,
it is showing nothing.
Do I have to provide some IP or host in my code, I am using KAA SANDBOX from AWS.
Console Output of Raspberry Pi attachedenter image description here here...
Finally I am able to do that using ..
Perform these two steps may be this can solve your problem.
Just run this command on host machine
sudo /usr/lib/kaa-sandbox/bin/change_kaa_host.sh $new host name/ip$
Then change the IP address of using Admin UI, for that you need to
sign in using username : kaa and passwword : kaa123
then go to setting > general setting then change the IP address preceded by :8080, enter your machine's public IP address, that can be easily accessible from anywhere.
Tips :: if you are using AWS instance then use public IP address of your instance.
Further error persist then drop your previous instance and launch a new instance.
For more details go the official documentation page
Hope it will be helpful for you.
You do not need to provide IP address.
You should download the generated SDK file and compile it with the source code. and then run it.

Getting the IP of a VMware ESX host through vijava

I'm trying to get the IP of the hostsystems managed by our vCenter. the host.getName() only returns the DNS name of the host. What might be a way to get the IP address that you get when you ping the given host name?
For those who still havig this issue, you can get the host public ip using vijava, in this way :
String hostIp = host.getConfig().getNetwork().getVnic()[0].getSpec().getIp().getIpAddress();
vijava 5.1
Try something like:
host.getConfig().getNetwork().getVnic().spec.getIp().getIpAddress()
I've used something like this earlier and it worked.

Finding the IP and MAC address of DNS Server and Gateway

Hello I am trying to programmatically(C++) find the Gateway IP and DNS Server IP and their MAC address of a local network. Do you have any suggestions on how to do that? Also is there a way to do it using WinPcap? Code samples would be great.
Since you mentioned winpcap I conclude that you are on Windows. Thus you need WinAPI to retrieve your info.
Take a look at Retrieving Information Using GetNetworkParams article it contains all steps you need to get what you want.
P.S.: There's nothing to do with winpcap though.
Well i did what ihor and Sp. suggested to find the IP addresses and then by using winpcap, crafted an ARP Request to the DNS server to get its MAC and processed the ARP reply.

How to get my computer external IP address?

Lets say my IP currently is: 123.123.123.123
How can I get that string programmatically?
Note: I don't want to get this IP: 192.168.0.10, I want that IP which others can use to connect into my computer via HTTP or anything.
NOTE: I dont want to open some web-page such as ip4.me to get the address, I want to get it with just C++.
I tried to google but every suggestion was "load a page and read the IP it tells you". Is that really the only way?!
You can fetch it from http://api.externalip.net/ip/ or some similar services, but I'm not sure how reliable these sites are, in means of availability
Any other way would be extremely complicated, as in general, no network equipment has api to tell external IP, and even if it had, you can not tell is there a simple xDSL router in front of you or Cisco ASA nating outbound traffic
My recommendation is to send a packet with the record route option.
If you know your upstream gateway, you should be able to find a ping command that allows you to set record route, and then either stores that data in an array or something you can regex.
Your WAN IP should be either record 0 or record 1, I believe.
What network library are you using?

How to get IP address of your application server

I need to be able to find the IP address of the server the page is currently executing on. I have some code that calls a third party site and has to pass a specific key that changes depending on which server it is on. Is there a CGI variable or some way in ColdFusion to determine what the IP address is of the host server?
Like the other commenters have outlined if you need the external IP as the third party site sees it then you probably should use the external approaches they recommend.
However if the third party is giving you access in some form that is based on an actual IP as the Server sees itself and not the IP as they see it you can use
<cfset cName = CreateObject("java", "java.net.InetAddress").getLocalHost().getHostAddress()>
<cfdump var="#cName#">
There are two reasons why a program can't query the host it's running on and see what its IP is:
It might have multiple ips, and short of looking through all sorts of kernel data structures you're unlikely to know which one is going to be used for a given outgoing connection.
It might connect to the outside world though a NAT firewall or some sort of proxy so that the outside world will see a different IP than any of the ones configured on your box.
Actually, there might be more than those two, but those are ones that have occurred to me.
Because of that, the simplest way is to connect to another box somewhere outside of your corporate network and see what IP it thinks you have. I use a two line CGI script running on my colo box to detect what IP my home server currently has (so I can detect when the cable company changes it).
You can use CGI.LOCAL_ADDR to determine the IP-address of your server (CFML equivalent to PHP's $_SERVER["SERVER_ADDR"]). It works on IIS and Apache using ColdFusion or Railo, given you are not behind a Proxy, not natting your server IP and having only one IP assigned to your server (not sure which IP would be shown, if there are more than one).
I would use hostip.info API
Your IP in XML: http://api.hostip.info/get_xml.php
Your IP in HTML: http://api.hostip.info/get_html.php
The safest way will be to use a service like WhatIsMyIP. If the server is behind a NAT, then the OS has no knowledge of the external IP address.
There are many questions in SO regarding this, see here for example.
<cfhttp url="http://www.whatismyip.com/" result="myresult" resolveurl="yes">
<cfoutput>#myresult.filecontent#</cfoutput>