Can anybody make a python code to Determining the Number of IP Subnets and Hosts? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anybody make a python code to Determining the Number of IP Subnets and Hosts?

python code network address

20th Jun 2017, 2:17 PM
fsociety
fsociety - avatar
10 Answers
+ 4
@fsociety: Delayed, sorry. Outside interference. To calculate the hosts on a subnet, you raise 2**(32 - subnet_mask_bits) - 2. A short, colorful visual (at step 5): https://www.chabotcollege.edu/faculty/netacad/prot/sem1/study_sheets/detIPadd.htm I almost included a bit of CompSci (as a skippable detail) and just decided...let's skip it. I'll save it as possible lesson material, or asked-for follow up.
5th Jul 2017, 7:34 PM
Kirk Schafer
Kirk Schafer - avatar
+ 4
@Ahmed chiboub: Not every example has fit to my preconceptions.
5th Jul 2017, 5:06 PM
Kirk Schafer
Kirk Schafer - avatar
+ 3
Determining the Number of IP Subnets and Hosts.. can anybody make python code for that.. thanks kirk, i change my question.. for a better understanding.. for other
6th Jul 2017, 1:40 AM
fsociety
fsociety - avatar
+ 2
Here's a netmask / subnet calculator I ran into recently...not Python but maybe adds some inspiration: https://code.sololearn.com/WKVVmk6rIOJT/?ref=app
3rd Jul 2017, 2:45 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
i want to calculate number of machines in a network giving the network address and mask.
3rd Jul 2017, 12:58 PM
fsociety
fsociety - avatar
+ 1
you don't need the network address. only the mask. easy: https://code.sololearn.com/cxFVgoT5FzPk/?ref=app
3rd Jul 2017, 1:59 PM
Ahmed chiboub
Ahmed chiboub - avatar
+ 1
if i know an ip address and then sub net mask.. how to count the range network address.. for that ip address
5th Jul 2017, 4:12 PM
fsociety
fsociety - avatar
0
didn't get what you mean. do you want to calculate number of machines in a network giving the network address and mask, or you want to scan a network and get the number of connected machines.?
21st Jun 2017, 9:20 PM
Ahmed chiboub
Ahmed chiboub - avatar
0
if you want the network address and the broadcast address , it's gonna take some time
3rd Jul 2017, 2:00 PM
Ahmed chiboub
Ahmed chiboub - avatar
0
is it written in Python? I don't think so
3rd Jul 2017, 3:54 PM
Ahmed chiboub
Ahmed chiboub - avatar