Network Calculator Or Firewall

Hi everyone.

I need extension or component that calculates network ip subnets to be used in a kind of firewall.

I want to put some network in configuration like “” or “”, for instance, and when someone comes with ip, it should define that client’s ip belongs to this subnet and then do action I want.

Are there any ready solutions, or at least ip calculator for Yii?

Thank you in advance.