Classless Inter-Domain Routing, a method for allocating TCP/IP network addresses and routing data packets. Divides IP address into network id (high bits) and host id (low bits) as determined by netmask. In 1993, replaced the older classful network routing.
Questions tagged [cidr]
397 questions
4
votes
2 answers
Terraform: Allow all internal traffic inside aws security group
I am trying to allow all tcp traffic between instances, otherwise deny all ingress and egress traffic.
Problem with "cidr_blocks", in aws console i can select security group but in terraform how can achieve something like that.
resource…

Taha Ergun
- 566
- 2
- 7
- 17
4
votes
5 answers
How to list all IPs in a network
Python has a method in the ipaddress module to list all the IPs in a network. eg.
import ipaddress
ips = [ip for ip in ipaddress.ip_network('8.8.8.0/24').hosts()]
How would you do the same thing in Go?

Jonathan
- 10,792
- 5
- 65
- 85
4
votes
3 answers
Terraform next available CIDR on AWS
I would like to see if it is possible for our Terraform code to programmatically figure out the next CIDR to use for a VPC.
VPC CIDR range 172.20.1-255.0/24
What I have so far:
data "aws_vpcs" "existing_vpcs" {
}
data "aws_vpc" "details"…

tavor999
- 447
- 6
- 25
4
votes
1 answer
MySQL query to convert CIDR into IP range
I have a table which contains a column as CIDR values like 1.0.85.128/25, I have 2 other columns (start_ip_range and end_ip_range), I want to populate those 2 column FROM CIDR column
Java code might look like as follows:
String[] parts =…

PHP Avenger
- 1,744
- 6
- 37
- 66
4
votes
3 answers
Subnet (or CIDR) IP control at T-SQL
I don't know how to exactly explain, but there is a problem about selecting and comparing query IP subnet. For example, there is a list for IP address and I have another CIDR/subnet mask list (X.X.X.0/24 etc). How can I learn that each IP address in…

juniorDev
- 155
- 2
- 13
4
votes
3 answers
Amazon VPC n^2 -4 IP Addresses? CIDR Block
I was in the process of creating a new AWS VPC for my instances. However, I noticed that when I used CIDR Notation to create the VPC & Public Subnet, AWS indicates that I have n^2 - 4 (where n is the # of bits) available IP addresses? Why is this?
I…

steviesh
- 1,740
- 6
- 19
- 33
4
votes
2 answers
C CIDR to address list
I'm writing a program where I need to iterate over a list of addresses derived from a user given cidr (eg. 75.24.64.0/24).
I took a look at some of the code, but that seemed overcomplicated.
In the end I decided to use a struct that looked something…

735Tesla
- 3,162
- 4
- 34
- 57
4
votes
4 answers
Data structure to store IP ranges, allowing quick search for given IP (Java)
I'm trying to think of an efficient data structure to represent IP ranges, as described just below. I know what I want to try is fairly easily possible, I just can't seem to put my finger on it.
So, let's say I have hundreds of separate IP ranges in…

ConorD55
- 181
- 3
- 11
4
votes
2 answers
how to convert ipaddress/mask to CIDR using c++?
I have a list of ipaddress/mask which needs to be converted to CIDR notation.
for e.g. 12.174.36.240/24 needs to be converted to 12.174.36.0/24
or something like what http://www.subnet-calculator.com/cidr.php does
How can this be acheived?
PS: the…

chingupt
- 403
- 2
- 7
- 19
4
votes
1 answer
CIDR notation and IP range validator pattern
I have a pattern to validate normal IP addresses, that is :
private static final String PATTERN =
"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
…

Maverick
- 2,738
- 24
- 91
- 157
4
votes
5 answers
calculate IP range using PHP and CIDR
I've seen various questions and answers around this site and I'm still having difficulty wrapping my head around this problem (could be because I've got a cold). Regardless, I'm trying to come up with a small web app that will create tables of IP…

greentiger
- 85
- 1
- 2
- 9
4
votes
3 answers
Convert ip array to smallest cidr subnet list in java
I have an ip array like below and I want to convert it to smallest cidr subnet list. Is there a library for that in Java?
For…

denizeren
- 934
- 8
- 20
3
votes
1 answer
cloudformation failed to create subnets
I was trying to run a code and i had this error but cant identify the problem. i got the error message The CIDR '10.0.1.0/24' conflicts with another subnet (Service: AmazonEC2; Status Code: 400; Error Code: InvalidSubnet.Conflict; Request ID:…

Nah Cassie
- 33
- 3
3
votes
1 answer
When I run cidrsubnet function in terraform I am getting 'prefix extension of 3 does not accommodate a subnet numbered 8'. Why is this?
code:
cidrsubnet("10.1.2.0/21", 3, 8)
Issue:
When I run this in terraform I am getting prefix extension of 3 does not
accommodate a subnet numbered 8. Why is this? Anything below 8 works. I've followed the following example: Configure subnets…

shan
- 125
- 3
- 16
3
votes
1 answer
Oracle PL/SQL versions of INET6_ATON and NTOA functions?
Any have any good code for converting a IPv6 address string into an integer? Converting IPv4 seems to be fairly easy, with the one format. However, IPv6 has several different formats to show an…

SineSwiper
- 2,046
- 2
- 18
- 22