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
139
votes
30 answers
How can I check if an ip is in a network in Python?
Given an ip address (say 192.168.0.1), how do I check if it's in a network (say 192.168.0.0/24) in Python?
Are there general tools in Python for ip address manipulation? Stuff like host lookups, ip adddress to int, network address with netmask to…

Staale
- 27,254
- 23
- 66
- 85
115
votes
5 answers
Setting CIDR/IP so anyone can access it from any IP?
How do you set a CIDR/IP so anyone can access it from anywhere?
I'm trying to make my AWS RDS DB instance accessible from anywhere as my ISP doesn't give me a static IP. Everytime my IP changes I have to go change the security record.

Matt
- 25,943
- 66
- 198
- 303
63
votes
15 answers
Check whether or not a CIDR subnet contains an IP address
I'm looking for quick/simple method for matching a given IP4 dotted quad IP to a CIDR notation mask.
I have a bunch of IPs I need to see if they match a range of IPs.
example:
$ips = array('10.2.1.100', '10.2.1.101', '10.5.1.100',…

Uberfuzzy
- 8,253
- 11
- 42
- 50
45
votes
11 answers
Converting CIDR address to subnet mask and network address
Given a CIDR address, e.g. 192.168.10.0/24
How to determine mask length? (24)
How to determine mask address? (255.255.255.0)
How to determine network address? (192.168.10.0)

Dmitry
- 651
- 1
- 8
- 12
30
votes
7 answers
How to see if an IP address belongs inside of a range of IPs using CIDR notation?
Here I have a static reference the ranges I need to check:
private static List Ip_Range = new List()
{
"12.144.86.0/23",
"31.201.1.176/30",
"46.36.198.101/32",
"46.36.198.102/31",
"46.36.198.104/31",
…

Only Bolivian Here
- 35,719
- 63
- 161
- 257
30
votes
8 answers
Python 3: create a list of possible ip addresses from a CIDR notation
I have been handed the task of creating a function in python (3.1) that will take a CIDR notation and return the list of possible ip addresses. I have looked around python.org and found this:
http://docs.python.org/dev/py3k/library/ipaddr.html
but…

MadSc13ntist
- 19,820
- 8
- 25
- 19
25
votes
1 answer
How can I determine an appropriate pod CIDR value for a Kubernetes cluster?
I'm initiating a kubernetes cluster with:
kubeadm init --pod-network-cidr=192.168.1.0/16 --apiserver-advertise-address=192.168.0.33
I'm not too familiar with networking concepts or CIDR, how do I determine an appropriate value for the pod CIDR?
I…

Chris Stryczynski
- 30,145
- 48
- 175
- 286
24
votes
4 answers
Check if two CIDR addresses intersect?
Given two CIDR addresses say 192.168.2.0/14 and 192.168.2.0/32
How do I check if two ip addresses overlap in "python2.6"??
I have gone through netaddr and it allows to check if
192.168.2.0 is in CIDR address 192.168.2.0/14 by
from netaddr import…

AjanShrestha
- 545
- 2
- 5
- 12
23
votes
5 answers
Is there way to match IP with IP+CIDR straight from SELECT query?
Something like
SELECT COUNT(*) AS c FROM BANS WHERE typeid=6 AND (SELECT ipaddr,cidr FROM BANS) MATCH AGAINST 'this_ip';
So you don't first fetch all records from DB and then match them one-by one.
If c > 0 then were matched.
BANS table:
id int…

raspi
- 5,962
- 3
- 34
- 51
23
votes
15 answers
Getting list IPs from CIDR notation in PHP
Is there a way (or function/class) to get the list of IP addresses from a CIDR notation?
For example, I have 73.35.143.32/27 CIDR and want to get the list of all IP's in this notation. Any suggestions?
Thank you.

TamTam
- 849
- 3
- 13
- 25
23
votes
5 answers
How use netaddr to convert subnet mask to cidr in Python
How can I convert a ipv4 subnet mask to cidr notation using netaddr library?
Example: 255.255.255.0 to /24

Mik
- 349
- 1
- 2
- 4
21
votes
3 answers
Cidr blocks AWS explanation
Can someone explain exactly how CIDR blocks work and how it translates into 0.0.0.0/32 for example? Please use laymen’s terms or perhaps even an analogy to something not network related. Can’t seems to find an explanation that clicks with me.…

Billy
- 1,049
- 3
- 14
- 23
21
votes
5 answers
AWS VPC Create Subnet in with different zone
I already have a VPC (Non Default) configured which is used by Amazon EC2.
I need to create another subnet (Non Default) in the same VPC with a different Availability Zone.
So when I am trying to Add details, I am stuck at the CIDR Block. I am…

AvtarSingh Suchariya
- 1,992
- 1
- 20
- 25
19
votes
3 answers
Is there native .NET type for CIDR subnets?
It's simple enough to code up a class to store/validate something like 192.168.0.0/16, but I was curious if a native type for this already existed in .NET? I would imagine it would work a lot like IPAddress:
CIDR subnet =…

Neil C. Obremski
- 18,696
- 24
- 83
- 112
18
votes
5 answers
CIDR bitwise operations - could I be a bit wiser?
I am building a class to represent an IPv4 subnet. I am storing the network address and the subnet mask as 4 byte binary strings, which are built during the constructor based on the arguments. One of the representations I would like the constructor…

DaveRandom
- 87,921
- 11
- 154
- 174