Jump to content

Splitting Ip addresses into groups


xstevey_bx

Recommended Posts

If you were to take all of the public ip addresses in the world is there a numerical way that you could split them into 1000 groups?

 

I know you can sort them by country or whatever but thats too specific for what I want to try. I want a fairly random spread.

 

I want people to click onto my site and depending on their ip address group be reditected to one of 1000 pages. The country they are in should be recordable but have just as equal a chance of selecting each of the 1000 pages.

 

Thanks for any help

Link to comment
Share on other sites

If the groups have no apparent link to them, why split them up in the first place? Why not just pick a random one to begin with?  Or...if they have no apparent link to them, but you are wanting to have the person stay with the same "group" then why not just pick $x amount of websites (enough for 1 group) and then link them to the person?  I guess you're going to have to be more specific in your intentions...also, you first say 1000 groups but later you say 1000 pages.  Those are two different numbers of IP addresses, so which one is it, groups or pages?

Link to comment
Share on other sites

Im really confused myself with this too lol...

 

When a user logs onto my website I want to record their ip address.

 

I then want that ip address to be checked against the 1000 groups of ip address I have defined to see what one it is in.

 

Each of those 1000 groups will be associated with a page of information.

 

If a user logs on with an ip address of 14.16.18.20 and it is a member of group number 30 then they are able to view information specific to people signing on from that ip range.

 

What I need to know is what are the ranges e.g. (0.0.0.0 - 0.100.0.0) that I would need to define in order to split all the public ip addresses in use just now into 1000 fairly equal groups

 

Any clearer? :S

 

 

Link to comment
Share on other sites

what makes them a member of group number 30

also why dont you look at the binary way that IP's work and have a kind of subnet system

convert the ip to 32 bit binary then the first 22 are the counts for your groups and the last 10 are the ips in each group

or is that just to confusing lol

 

Scott.

Link to comment
Share on other sites

but again, why predetermine groups? when you get the IP address, check to see if it's in a group already. if it's not, it's a new one, and assign it randomly to one of the 1000 groups.

 

If I assigned people to a group randomly it reduces the chance of having an unbalanced spread of users between the groups.

 

If I have the groups pre determined then areas with a high number of ip addresses in use for the one range will begin to fill up and that information will be more readily avaliable to users.

 

However, if users in an area with an ip range that has minimal traffic then the information will become harder to view...

Link to comment
Share on other sites

without the purpose of this project, it's hard to determine the proper solution.

 

...if you want to predetermine groups though, here is some info that might help you out:

-technically, ip addresses go from 0.0.0.0 to 255.255.255.255

-255 x 255 x 255 x 255 = 4,228,250,625 possible addresses

 

if you crunch the numbers, it works out ABOUT like so:

Group 1: 0.0.0.0 to 0.64.255.255

Group 2: 0.65.0.0 to 0.129.255.255

Group 3: 0.130.0.0 to 0.194.255.255

Group 4: 0.195.0.0 to 1.4.255.255

Group 5: 1.5.0.0 to 1.69.255.255

etc

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.