Discover Centmin Mod today
Register Now

Cloudflare Get real IPv4 behind Cloudflare with IPv6 connections

Discussion in 'Domains, DNS, Email & SSL Certificates' started by Marcos, Oct 30, 2018.

  1. Marcos

    Marcos New Member

    8
    2
    3
    Sep 3, 2018
    Ratings:
    +2
    Local Time:
    9:56 AM
    MariaDB 10
    Hello!

    I need to get the actual IPv4 addresses to know which location my user is accessing. Ipv6 often does not provide a precise locale.

    Would it be possible for me to get the actual ipv4 address of the user, instead of ipv6?

    Sometimes it provides IPv4 correctly, but depending on the user's connection, it provides an IPv6.

    I saw about Pseudo IPv4, but it did not work.

    Has anyone ever had this kind of problem?


    Pseudo IPv4 - Supporting IPv6 addresses in legacy IPv4 applications

    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.15.5
    • PHP Version Installed: 7.2.11
    • MariaDB MySQL Version Installed: 10.1.36-MariaDB
    • When was last time updated Centmin Mod code base ? : centmin.sh menu option 23 submenu option 2
    • Persistent Config:
      Code (Text):
      AUTODETECPHP_OVERRIDE='y'
      LETSENCRYPT_DETECT='y'
      SSHLOGIN_KERNELCHECK='n'
      PHPMONGODB='y'
      NGINX_VHOSTSTATS='y'
       
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,915
    8,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,438
    Local Time:
    9:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Not at nginx/server level out of the box. But you could probably setup some form of lookup yourself via nginx geoip module to get location data that Centmin Mod supports. See examples
    But no way to get a visitor's reported IPv6 address and get an equivalent IPv4 address.

    IP geo location data is from geolocation databases that hosts and servers look up and there's many databases to use and not all databases are updated in a timely manner. So that's why if you lookup an IP addresses geo location data on several databases, they may differ so an IP could be reported as coming from one country in one database and a different country in a different database.

    You can see examples by inputing you IP in these 2 geolocation multi-database lookup services
    You're at mercy of each respective geo location databases update frequency and policies as to when up to date data is synced in their databases

    For Cloudflare users you can log CF headers for cf-ray to get approximated location of which Cloudflare datacenter a visitor hit city wise Cloudflare - Cloudflare custom Nginx logging. This is probably best way as you're using Cloudflare you can easily deduce location based on CF cf-ray and cf country headers
     
    Last edited: Oct 30, 2018
..