Local or private ip

private networks are usually local

For first I can use 10/24 for the last I can use 192.168/16 to wildcard them. How to wildcard the second one?

like the third one.

Are you sure? But the second part of second one us from 16 to 32 not to 255. It seems you are wrong?

A quick search for “172.16 net mask” gives this: https://en.wikipedia.org/wiki/Private_network which suggests you would use

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16

The first one does not mean from 10.0.0.0 until 10.0.0.255? Shouldn’t I block until 10.255.255.255 instead?

No, I’ve always thought of it as the number of unchanging bits in the binary version of the address, so /8 means that the first eight don’t change and the remaining 24 can, giving a range from 10.0.0.0 to 10.255.255.255 (or probably .254).

Using the older-style subnet notation (which I sometimes find easier to understand) that would be 10.0.0.0 with subnet 255.0.0.0.

And how is possible to define a fake domain name e.g. example.com on a localhost? And does gethostbyaddr() returns the private ip associated with that domain on local host?

Depends on your system. On a Windows 7 PC, edit \windows\system32\drivers\etc\hosts. and add a line like this:

127.0.0.1 example.dev

Note that filename is hosts., i.e. it has no extension on it. You can then open http://example.dev in your browser. I use .dev for local versions of sites so I can be sure I am working locally, if you use the actual name it will give you a problem when you want to access the “live” site because, if I remember correctly, hosts entries overrule dns entries.

I would doubt that gethostbyaddr() would work if there is more than one host name defined for the same localhost address - how would it know which one to return? But your question is strange - you ask about using gethostbyaddr() to “return the private ip associated with that domain” - but surely that function returns the name associated with the ip, rather than the ip associated with the name?

So how can I be sure if my script is not used on a localhost but on a real site? is there a way to check it?

Wouldn’t calling the domain ‘.dev’ or something else other than your proper domain do it? If you’re running the test version on your localhost then the address bar would show .dev, if it’s on the live server it would show .com. I might not understand what you’re asking, though.

I meant verifying it with a php code since we don’t know this is .dev or something else. Possible?

Any help?

I usually use .local for local copies of sites.

Apparently if you were to apply domain names that don’t contain any dots at all then they are assumed to be on the local machine eg localhost

For localhost is possible to set any ip? Or only private ip or 127.* is possible to define for localhost?

The point of localhost and the 127.0.0.1 address (and ::1 on IPv6) is that it’s a fixed, reserved way of knowing that you’re referring to “this machine”. It wouldn’t really work if it could be altered, then it would just be any old address and you’ve have to have certain bits of information to be able to figure it out.

So if I want to ionCube my script on a unique installation, e.g. ionCube license on domain/ip, is there a way to make sure he cannot trick the license on several machine, setting up the same domain/ip on all of them since MAC is editable? Is there a way to license on a very unique machine?

I thought MAC was supposed to be unique. I know you can edit it on a VM (or you could in Hyper-V last time I looked) but surely if you put two NICs with the same MAC address they’ll get upset.

Anyway, outside of my knowledge now, I don’t know what an ionCube is or where you’d put it. If you manage to crack a 100% reliable but still usable copy protection scheme, feel free to let us know how you did it from your Caribbean private island.

Not sure I see the problem here, if it is licensed by domain, then surely the customer should be allowed to spin up more instances if the site receive a lot of traffic.

For MAC, while it can be edited putting two servers with the same MAC in the same network will create issues for the network traffic. It would still be able to do it from different locations though (i.e. hosts).

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.