Javascript to validate if IP belongs to a subnet mask


Javascript to validate if IP belongs to a subnet mask

Hi all,

I don't know javacript very well and needed a script to validate if a certain IP belongs to a given subnet mask prefix, meaning, while receiving two inputs, IP and prefix, would test if it belongs to it or not.

Example:

Inputs (for example 192.168.30.2/24): IP: 192.168.30.2 Subnet prefix: 24

Is this possible to do?

Submitted July 11, 2017 at 09:11PM by geelian
via reddit http://ift.tt/2u4yLLF

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s