Publications
Interviews
Talks & Presentations
Curriculum Vitae
Open Source Projects
PGP Key
Favorite (IT-)Books
Legal Research Toolbox
Network Security Toolbox
Favorite Movie Quotes
New York, NY

com.lukasfeiler.ipconfig


Please download the package HERE.
Please see the documentation for details.


From the documentation:

Command Line Interface

To validate a network interface configuration on the command line run
java -jar com.lukasfeiler.ipconfig.jar

You will be prompted for IP address, netmask and default gateway.
com.lukasfeiler.ipconfig will verify the following:
- The IP addresses consist of 4 valid octets (numbers between 0 and 255).
- The netmask is continious - i.e. the netmask consists of a number of 1s followed by a number of 0s.
- The host part bits of the IP addresses are not all set to 0 - this would be a reference to the whole subnet (e.g. 192.168.1.0/255.255.255.0).
- The host part bits of the IP addresses are not all set to 1 - this would be a broadcast address (e.g. 192.168.1.255/255.255.255.0).
- Both IP addresses are within the same subnet - the network part is equal for both IP addresses.

Example:
Are the IP addresses 192.168.1.10 and 192.168.1.9 in the same subnet 255.255.255.252? Let's find out!

java -jar com.lukasfeiler.ipconfig.jar
IP Adress: 192.168.1.10
Netmask: 255.255.255.252
Gateway: 192.168.1.9
------------------ OUTPUT FOLLOWS ------------------
OK!
IP adress: 192.168.1.10
Netmask: 255.255.255.252
Gateway: 192.168.1.9

The reason for this is as follows:
IP address192.168.1.1011000000101010000000000100001011
Netmask255.255.255.25211111111111111111111111111111100
Gateway192.168.1.911000000101010000000000100001010

As you can see the IP address and the gateway have the same host part (which is 30 bits long in this case).
Therefore they are in the same subnet and the network interface configuration is valid.