Probably a basic question on subnets and networks

Discussion in 'Networking & Security' started by Sp33dFr33k, Dec 8, 2016.

  1. Sp33dFr33k

    Sp33dFr33k 2[H]4U

    Messages:
    2,481
    Joined:
    Apr 20, 2002
    Trying to understand the concept illustrated here. I have a /26 network which means 62 hosts. My assumption would be that I could have hosts with IPs in between .1 and .63 (which I believe would be the broadcast address). But this is showing I could have 4 networks (subnets?)

    On a subnetting site I found they show this table for a /26

    Code:
    /26 -- 4 Subnets -- 62 Hosts/Subnet
    
    Network #	IP Range	                      Broadcast
    .0	                  .1-.62	                             .63
    .64	                  .65-.126	                    .127
    .128                .129-.190	                    .191
    .192	               .193-.254	                    .255
    
    
    So how do these 4 networks work if I was using a network of 192.168.1.0.
     
  2. Nicklebon

    Nicklebon Gawd

    Messages:
    550
    Joined:
    May 22, 2006
    You're misunderstanding a bad table. The table is assuming that you are breaking a a /24 into 4 /26 subnets. As stated you have 62 hosts. That said, there is nothing stopping you from breaking your /26 into /27s or smaller subnets.
     
  3. bman212121

    bman212121 [H]ard|Gawd

    Messages:
    1,530
    Joined:
    Aug 18, 2011
    So to break that down, a 192.x.x.x is part of a class C subnet. A class C subnet means that only the last octet is available for manipulation, simply meaning he largest a class C can be is 255 addresses by using a /24. I won't try to confuse you right away but if you have a class B or class A, it is entirely possible to have a network larger than that.

    So if you want to have two SEPARATE (Separate being the keyword here) you can divide up the addresses for the entire 192.168.1.0 into smaller chunks. That's what you are doing with a /26. If you have a /24 and computer A has an IP of 192.168.1.5, and computer B has an IP of 192.168.1.85, both of these are on the same network and can talk freely to each other. This is because they are between 192.168.1.0 and 192.168.1.255. Now let's take that same network and split it up using a /26 (netmask 255.255.255.192) Now computer A is in a network that exists between 192.168.1.0 and 192.168.1.63, and computer B is in a separate network between 192.168.1.65 and 192.168.1.127. These two hosts can NO longer talk to each other, because they no longer reside on the same network. You would need to setup routing in order for traffic to move from the first network to the second one, in order for these hosts to talk to each other.

    So if you only have 255 IP addresses available to you, as you would if you were the owner of a /24 network, but you had the need to separate devices from each other, you would use subnetting to split your address pool up into smaller pools so you can have more networks. In the case of the /26, you have 4 unique networks, all of which have 62 IPs available for use. When you say 192.168.1.0 that doesn't actually say anything, as you have yet to include the SIZE of the network. Since we know it's a Class C it cannot be bigger than a /24, but it certainly can be smaller. A 192.168.1.0/24 is 255 hosts on it, a 192.168.1.0/26 has 62, and a 192.168.1.0/30 has only 2 hosts on it. In the class a lot of the times you can just use another /24 like 192.168.2.0/24 because that's available to you, but in the real world that's a boat load of money to get another 255 IP addresses, so we just need to be more efficient with what we have.

    One of the reasons for taking a large pool of addresses and splitting it up is usually driven by security or efficiency. If I have 10 devices on my network, 2 servers, 5 desktops, a printer, a switch, and an AP, I could certainly just leave that network as a /24 and then all of my stuff can talk to each other. But that would be silly to have my servers directly accessible by clients, so I might use a /26 to make it so these devices can't talk directly to each other, and need to go through a router with a firewall on them first. (So I can block traffic accordingly) I can use the 192.168.1.0/26 network for my servers, the 192.168.1.64/26 network for my clients, the 192.168.1.128/26 network for my switch and access point, and the 192.168.1.192/26 network for my printer. Once I do this the servers can't talk to the clients, the clients can't talk to the switches, the switches can't talk to the printers, or any combination of servers / clients / printers / switches & APs. None of those combinations can talk to each other, they are all on completely different networks now. In order to make them communicate again, I use a router that is on each network, and knows how to get traffic from one to another. A typical setup for this would be something like Router port 1 has an IP of 192.168.1.1, port 2 would be 192.168.1.65, port 3 192.168.1.129, and port 4 is 192.168.1.193. Each of these 4 IPs are all on different networks despite all being a 192.168.1.x address. That is because we used the /26 to split up the network. Now a server on 192.168.1.5 can use the gateway of 192.168.1.1 and send it's traffic to 192.168.1.85 because the router will know that in order to get to 192.168.1.85, it needs to send that traffic out from it's 192.168.1.65 interface.
     
    Last edited: Dec 8, 2016
  4. BlueLineSwinger

    BlueLineSwinger Gawd

    Messages:
    625
    Joined:
    Dec 1, 2011
    To be pedantic, /24 (255.255.255.0) != class C, even though they are the same size. You're mixing up classful addressing with classless Inter-Domain Routing (CIDR). Referring to subnets as class A/B/C based solely on their size is incorrect. Classful addressing isn't used anywhere anymore, and is only interesting from a historical perspective.

    Class C addresses exist only between 192.0.0.0 and 223.255.255.255. Any addresses outside this range, no matter the size of the subnet containing them, are not class C. e.g., 10.1.1.0/24 is still class A, even though it contains the same number of addresses as a class C.

    https://en.wikipedia.org/wiki/Classful_network
    https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

    Though otherwise, spot-on.
     
  5. H2R2P2

    H2R2P2 Limp Gawd

    Messages:
    405
    Joined:
    Jun 18, 2006
    Also keep in mind that you cant have a client on a .255 (broadcast) and .0, so technically a Class C has 255 - 2 = 253 client IP addresses available rather than 255. As BlueLine said, you are also confusing subnetting and supernetting, but you have 99% of what info you need at this point.. Another thing to keep in mind is that the whole subnetting problem is only relevant when you are dealing with IP's that are directly on the internet, meaning not going through a NAT device. While large providers have to worry about subnetting, unless you work at a very large company or ISP the odds of you running into it are slim to none. Heck even networks like AOL route all their users traffic down to a handful of IPs (it may even be 2; I know they have one for West Coat, one for East Caost.. they may have one for central US, but seriously thats it).

    If you wanted to set up some sort of security for your internal devices, it would be much simpler to just put them on a different network rather than a subnet. For example, the entire 10.0.0.0 (255.0.0.0) is non-routable (directly on the internet). You could have a 10.0.1.x (255.255.255.0) and another network 10.0.2.x (255.255.255.0). Traffic on these networks would not see each other. Then all you need to do is use a router to route the traffic between the networks if you should want them to communicate for some reason. I have something similar to this in my home. I have an upstaris network, downstairs network, wireless one for IOT devices (TIVO, TVs, Sonos, etc), and another for my security system cameras. They are all on separate networks and connected via routes. That way my 4K streaming doesnt mess up something else going on in the house, etc.. Plus its much easier to troubleshoot and monitor what is going on since I know how its all laid out...
     
  6. BlueLineSwinger

    BlueLineSwinger Gawd

    Messages:
    625
    Joined:
    Dec 1, 2011
    Off by one. 256 (2^8) minus 2 (the network and broadcast addresses) is 254.
     
  7. H2R2P2

    H2R2P2 Limp Gawd

    Messages:
    405
    Joined:
    Jun 18, 2006
    You are correct... Nice catch!
     
  8. Cmustang87

    Cmustang87 [H]ardness Supreme

    Messages:
    4,404
    Joined:
    Oct 4, 2007
    This kind of got more complicated than it needed to be, all that table is saying (as Nicklebon stated) is that you have a /26 network, which is a subnet of a /24.

    Each /26 subnet can have up to 62 usable hosts.

    Don't let people confuse you by talking about Class C networks, etc... classful networking doesn't really exist anymore, everything is classless now.

    In an enterprise example, let's pretend you are a local network administrator. The enterprise network engineering has given you a /26 subnet to work with:

    192.168.1.0/26 or 192.168.1.0/255.255.255.192

    Your first usable IP address is 192.168.1.1 and your last is 192.168.1.62 - 192.168.1.0 is your network ID, 192.168.1.63 is your broadcast.

    If you wanted to, you can segment even further without going outside of your scope you were given by making /27 networks or 255.255.255.224.

    You can now have 2 subnets - 192.168.1.0/27 and 192.168.1.32/27... etc. I think you might get it from there.

    tl;dr - Nicklebon was 100% correct by statng it's a faulty table because you aren't starting with a /24 that you are given. A /26 is just a subnetted /24.
     
    Last edited: Dec 13, 2016