Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This may seem like a basic question but I need to understand IP addresses.

I don't understand why IP addresses are split into network (wires) and nodes (hosts | device).

For example Class A has 8 bits of network and 24 bits of host, where does this fit into the actual IP address.

I am quite stuck on this as I look at examples around the net and they state mainly that the IP is split into network and hosts then each class has different values. But I'm not sure exactly what this means.

would be great if someone could spend a little time to explain.

share|improve this question

migrated from Apr 2 '11 at 2:40

This question came from our site for professional and enthusiast programmers.

There are two main reasons a host needs to know which portion of its address is the network number and which portion is the host number.

The first reason is so it knows what data link layer (e.g. Ethernet MAC layer) destination address to put on an outgoing packet. If the destination IP address's network section matches the source IP address's network section, then the destination host is directly reachable on the local data link (e.g. it's on the same Ethernet LAN), so the sender can find the destination machine's link-layer address (perhaps via ARP) and put that host's link-layer address in the destination field of the link layer header of the packet. If the network sections of the source and destination IP addresses doesn't match, then the sending host has to send the packet to a router. In that case, the sending host puts the router's link-layer address in the link-layer header.

The second reason is so the host can determine the local network's broadcast address. It does this by filling in all the bits in the host section with ones. So in the case of, the broadcast address is

The idea of network "classes" (a.k.a. "classful networking") only really mattered from the invention of IPv4 in 1981 until the invention of subnetting and Classless Inter-Domain Routing (CIDR) in 1993. From 1981 to 1993, if the first bit of your IP address was a zero, you knew you were on a Class A network, so the first 8 bits of your address was your network number, and the other 24 were your host number. But this meant sites with Class A networks would have 16.8 million hosts on a single flat network, which was impractical. Even though it's been almost two decades since "Class A", "Class B", and "Class C" really mattered, the names still get kicked around to refer to /8's (16.8 million host networks), /16's (65 thousand host networks), and /24's (~256 host networks), respectively.

share|improve this answer

The reason for the split is that it's rare that you have a direct connection to the computer you want to send something to. The data you send usually goes to a router, which then forwards it to other routers, and so forth until a final router in the chain delivers it to your system.

For this to work, there must be a way of knowing which IP addresses can be reached just by dumping data out of the network card, and which IP addresses can only be reached "behind" a router. The network part of the IP address, determined by the network mask, makes this distinction.

So, if my IP is, and my netmask is 24 bits from the left (, then that means I can reach any IP address from to just by sending data out of my network card. I'll use my IP as the source address, the end machine as the destination address, and just throw the traffic on the wire. It should get there if say, the other machine is connected via a switch or hub, without any further help.

Let's say I want to talk to Well, I can't reach that just by spitting the bits out of my NIC. It has to go through a router. The simplest situation is where there is a default gateway given by DHCP. Let's say the default gateway given to us through DHCP is I'll then send my traffic that I want to go to to, putting my IP ( as a source address and as a destination address. The default gateway is not the ultimate destination, but I'm really expecting to forward the traffic to on my behalf. Hopefully the machine at has a connection to the network, and will be able to do that.

I hope this is helpful.

share|improve this answer

Example: /8
where /8 - means network mask. This means that first 8 bits of 32(the adress consists of 32 bits divided by dots and this bits are represented as decimal numbers) identify the network and others - the host

share|improve this answer

Perhaps this article from Cisco will help.

share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Ramhound Oct 19 '15 at 17:08

You must log in to answer this question.