From my understanding the networks is as follows
Class A: 10.0.0.1 - 10.255.255.254
Class B: 172.16.0.1 - 172.16.255.254
Class C: 192.168.0.1 - 192.168.0.254
But then I look at ifconfig virbr0
on my Linux computer:
virbr0 Link encap:Ethernet HWaddr 42:40:99:CB:02:7F
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:2842 (2.7 KiB)
Here the IP address is 192.168.122.1. Is that an allowed IP?
And if so, is 192.168 than actually a Class B network?
Yes it is a valid private IP address.
Classful IP addressing is outdated and can be confusing at times. A class C address is an address with a 255.255.255.0 subnet mask. The 192.168.0.0 block of addresses was originally supposed to be 256 separate Class C addresses. The range would be 192.168.0.0-192.168.255.255. Valid subnets were 192.168.0.0, 192.168.1.0, 192.168.2.0, etc.
Nowadays, Classful IP addressing has gone away. We now have something called CIDR. With CIDR, all you really need to know is that these addresses are valid private IP addresses:
10.0.0.0-10.255.255.255
172.16.0.0-172.31.255.255
192.168.0.0-192.168.255.255
How you divide those up into subnets is up to you.
Classful networking is no longer used, instead you need to look into classless inter-domain routing. Also that is a valid IP that is in one of the ranged reserved for private use (See RFC 1918). You might also want to read this post about sub netting.
As Kyle mentioned, there are no classes anymore, and haven't been for almost 15 years.
The private network IP ranges are:
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
RFC1918 as has been posted, and should be read. Excerpt:
"3. Private Address Space
The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets:
We will refer to the first block as "24-bit block", the second as "20-bit block", and to the third as "16-bit" block. Note that (in pre-CIDR notation) the first block is nothing but a single class A network number, while the second block is a set of 16 contiguous class B network numbers, and third block is a set of 256 contiguous class C network numbers."
Subnet Calculator / Planner
Absolutely, 192.168.122.1 is a valid IP address. However, it is a "private" address, which means essentially that it is not allowed to be directly exposed to the internet.
The "class A", "class B", "class C" terminology is no longer technically correct, although the terms are still used as shorthand for the network sizes they represented. Kyle pointed out the informative wikipedia article on CIDR and the very useful question and answer about subnet construction.
So, the best response to your question about 192.168 being a class B network is that the question is not meaningful. You can put
192.168.122.1
in a "class B" size network by using the mask255.255.0.0
. Or you can put it in a "class C" size network by using the mask255.255.255.0
. Both are equally valid, although in practice having a "class B" sized subnet is a recipe for a pitifully slow network.No, there is a block of 256 class C networks reserved for local use,
192.168.0
through192.168.255
.