Charles Hooper

Thoughts and projects from a hacker and engineer

First Ruby App: Subnet Calculator

Well, I just completed my first ruby app. It’s a fairly simple subnet calculator that takes an IP address and subnet mask and calculates the broadcast address, network address, and maximum number of hosts that subnet can support. Should you find any errors, let me know!

Example

1
2
3
4
5
6
$ ./ip.rb 10.0.0.0 255.0.0.0
Subnetting information for 10.0.0.0/8
Subnet mask: 255.0.0.0
Network Address: 10.0.0.0
Broadcast: 10.255.255.255
Max hosts: 16777213

Comments