How to calculate ip address in a range?

0

0

If I run this command,

# nmap -sP 192.168.0.120/25

which IP addresses are scanned?

How can I calculate the IP addresses that are in this range? I've been searching Google but I couldn't find something helpful.

ina

Posted 2013-11-11T21:34:00.820

Reputation: 1

Answers

4

There is a useful utility, in Linux, called ipcalc. If it is not installed by default, you may download it from your distro's repositories. In Mac OS, you can find the same utility here, while for Windows you find it here (careful with dependencies, it requires Microsoft .Network Framework 2.0).

Its output is like this, exactly for your case:

 ipcalc 192.168.0.120/25
 Address:   192.168.0.120        11000000.10101000.00000000.0 1111000
 Netmask:   255.255.255.128 = 25 11111111.11111111.11111111.1 0000000
 Wildcard:  0.0.0.127            00000000.00000000.00000000.0 1111111
 =>
 Network:   192.168.0.0/25       11000000.10101000.00000000.0 0000000
 HostMin:   192.168.0.1          11000000.10101000.00000000.0 0000001
 HostMax:   192.168.0.126        11000000.10101000.00000000.0 1111110
 Broadcast: 192.168.0.127        11000000.10101000.00000000.0 1111111
 Hosts/Net: 126                   Class C, Private Internet

MariusMatutiae

Posted 2013-11-11T21:34:00.820

Reputation: 41 321

Does this mean that the ip addresses scanned are from 192.168.0.1-- 192.168.0.126? Or from .120-.126? I am a little bit confused... – ina – 2013-11-11T21:47:16.383

1Note that you can simply use nmap to answer this question by running nmap -n -sL 192.168.0.120/25. The first valid host address is 192.168.0.1; the ".0" address for a network is not a valid host address. – larsks – 2013-11-11T21:48:37.667

0

Enter "25" in the "Mask Bits" field and it will show all the details for the network: http://www.subnet-calculator.com/cidr.php

Jim G.

Posted 2013-11-11T21:34:00.820

Reputation: 2 794