On Tue, Dec 19, 2023 at 04:27:14PM +0300, Maksim Rodin said:
Is there any tool in base which allows to get something like this?

I have over the years implemented this in shell several times, it's not
terribly difficult to convert dotted quad into an integer and then you
can work out your address list fairly simply.

broadcast address = (netmask ^ 0xFFFFFFFF) | network
network address = prefix & netmask
netmask = 0xFFFFFFFF >> prefix length

That should give you enough to write a simple loop that prints out
all the addresses in a prefix.

If you are disinterested in writing software, the perl ipcalc is basically the
defacto standard (http://jodies.de/ipcalc), and the C implementation in
packages appears to work just fine.  sipcalc appears to handle IPV6 addresses
as well as IPV4 so you may wish to look at that instead if IPV6 is important to you -- it appears to have no dependancies either.

--Matt

--
Please direct replies to the list.

Reply via email to