#2252·faker

support cidr

Author: unionalCreated Jul 14, 2023Updated Aug 4, 2026
Labelsc: featurep: 1-normalm: internets: waiting for user interest

Clear and concise description of the problem

Add support to generate IP CIDR:

https://aws.amazon.com/what-is/cidr/#:~:text=CIDR%20notation%20represents%20an%20IP,1.0%2F22. https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

Suggested solution

Add as an option to faker.internet.ipv4(...) and faker.internet.ipv6(...).

typescript
faker.internet.ipv4({ maskBit: 24 }) // 192.168.1.0/24

faker.internet.ipv4({ maskBit: { min: 8, max: 32 }}) // 10.0.0.0/10

Alternative

No response

Additional context

No response