Home > Tracking Campaigns > FunnelFlux

Redirect based on IP ranges (5)


09-07-2017 12:26 PM #1 mindfume (AMC Alumnus)
Redirect based on IP ranges

I wish to redirect traffic based on hundreds of IP ranges (which results in several millions of individual IP addresses) and looking for the best way to do this (best = resulting in most optimal redirect speeds).

1. default method is to use a Condition node but this does not support IP ranges so requires the individual IP addresses (with here or there using the * wildcard whenever possible to bring down total number of records). Have not set this up yet but doubt that condition nodes are optimal when holding millions of values.

2. or use a PHP node which scans a custom database table that holds the individual IP addresses.
this is probably the most straightforward, though there must be a smarter way which allows to store IP ranges and efficiently scan those instead of the individual IP addresses.

3. any other methods worth considering?

Have raised this topic with Funnelflux support, but wanted to see if perhaps anyone has experience with this.


09-08-2017 02:06 PM #2 vortex (Senior Moderator)

I could certainly see how that would be useful! Just wondering - did you find out anything after speaking with Funnelflux support?

Not being very technically-oriented, I'd have no idea how to implement something like that. Would probably just brute-force this by setting up one camp targeting each IP range - which would probably result in the fastest redirect speeds. But it would require that the traffic source allow IP targeting, and having to set up hundreds of campaigns can be time-consuming (unless you automate using API).



Amy


09-08-2017 02:27 PM #3 caurmen (Administrator)

This may be of help - PHP to check an IP against an IP range.

https://github.com/cloudflare/CloudF...p_in_range.php

It's a bit complex, though - another simpler version is

Code:
function CheckIpRange($ip, $min, $max) {
        return (ip2long($min); < ip2long($ip) && ip2long($ip) < ip2long($max));
  }


09-26-2017 03:40 PM #4 mindfume (AMC Alumnus)

update - in case anyone else ever needs this:

- I initially created a custom database table to store the ranges, and simply scanned that table with a Funnelflux PHP node.
It worked fine and I really didn't see any issues with it, but still it didn't feel like the best possible solution (i.e. having to create a new DB connection / execute query / close DB connection on each redirect).

- so I came across this article explaining how to build your own maxmind database files:
https://blog.maxmind.com/2015/09/29/...un-and-profit/

It requires using Perl which ended up being very easy even though I'd never seen or touched Perl before. Basically I just followed their instructions and ended up with my custom mmdb (maxmind database) file which I could then easily access with a Funnelflux PHP node using the maxmind API.


09-27-2017 07:33 PM #5 ThrvTrkr (Member)

Thrivetracker actually offers the ability to block out an unlimited number of IPs, so as long as you can provide the necessary ranges that you want to have access to your campaigns or that you want to block out, you can build the rules directly into the tracker and let the redirect links sort out the whole thing automatically. We had a user previously dictating over 30k IPs in our filtering rules and had no issue with keeping speed at optimum levels. This functionality is available in our 30-day free trial, self-hosted or cloud-hosted, and we're ready to set one up for you at any time!

Feel free to DM me for more info!

Cheers,


Home > Tracking Campaigns > FunnelFlux