2

When I use this command which IP addresed are scanned

# nmap -sP 192.168.0.120/25           

How can I get the IP range when I have the addres and subnet. Because I am trying to understand this, but no result till now..Please help me..Thank a lot

user2804038
  • 1,093
  • 3
  • 15
  • 17

2 Answers2

5

You can use ipcalc, a nice *nix tool to guide you:

    ~ $  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 
user170860
  • 76
  • 2
  • Thanks for pointing out yet another helpful tool in *nix environment. May be nice to extend your answer with how the calculation is done. Network = Address & Netmask , Broadcast = Address | ~Netmask. HostMin = Network+1, HostMax = Broadcast-1 – Pau Coma Ramirez Jan 05 '15 at 16:53
  • Thankfully ipcalc is available with brew as well – Shrey Feb 08 '17 at 05:56
4
192.168.0.120

This says that the IP address is 192.168.0.120.

/25

This says that the netmask is 25 bits long. As an IPv4 address is 32 bits, that leaves 7 bits for the address. The lowest IP address in the range is given by masking out the bottom 7 bits, and the highest by adding 127 (=27-1) to that.

user207421
  • 305,947
  • 44
  • 307
  • 483