I was learning about IPv6 in order to build an internal network port scanner (this means a private network to which one is connected) I wasn't able to find a way to know the network range with the submask, let me illustrate it with an example :
IPv4 : 192.168.2.32 with a sub mask of 255.255.255.0 means that the 192.168.2 part of the IPv4 represents the network and the 32 represents the device ip. So, when scanning the network I know I have to scan the ips in the following range : 192.168.2.0 -- 192.168.2.255
IPv6: fd04:ad:32be:: . I know the first 64 bits represent the network if /64 , but while scanning an internal network with this IPv6 address how do I know the range to scan like in IPv4 ?
Thank you,
If you have older network equipment and are in an enterprise, rapid sequential scans of large swaths of IPv6 space is not a good idea (and isn't really a gd idea in general).
W/r/t "ranges", this is from current rev nmap
IPv6 addresses can be specified by their fully qualified IPv6 address or hostname or with CIDR notation for subnets. Octet ranges aren't yet supported for IPv6.
This is a randomly selected range-to-subnet converter.
Consider using ICMPv6 Neighbor Discovery vs sequential scans and also consider using DHCP logs and switch/router logs to get individual IPv6 addresses vs use ranges and perform sequential scans.
Also, unless you know what you're doing or are trying to take a deep-dive into low-level network programming, don't reinvent the wheel and just use nmap
.
Finally, this is prbly a more appropriate question for serverfault and can/should likely be closed.