Lecture 05-Data Communication & Network IP Addressing
Lecture 05-Data Communication & Network IP Addressing
An IP address is a software address, not a hardware address. The latter is hard-coded on a network interface card (NIC) and used for finding
hosts on a local network. IP addressing was designed to allow hosts on one network to communicate with a host on a different network
regardless of the type of LANs the hosts are participating in.
IP Terminology
In this section several important terms that are vital to your understanding of the Internet Protocol. Here are a few to get you started:
Byte A byte is 7 or 8 bits, depending on whether parity is used. For this course, always assume that a byte is 8 bits.
Octet An octet, made up of 8 bits, is just an ordinary 8-bit binary number. In this course, the terms byte and octet are completely
interchangeable.
Network address: This is the designation used in routing to send packets to a remote network Eg. 10.0.0.0, 172.16.0.0, and 192.168.10.0.
Broadcast address The address used by applications and hosts to send information to all nodes on a network is called the broadcast address.
Examples include 255.255.255.255, which is all networks, all nodes; 172.16.255.255, which is all subnets and hosts on network 172.16.0.0;
and 10.255.255.255, which broadcasts to all subnets and hosts on network 10.0.0.0.
An IP address consists of 32 bits of information. These bits are divided into four sections, referred to as octets or bytes, each containing 1 byte
(8 bits). You can depict an IP address using one of three methods:
Dotted-decimal, as in 172.16.30.56
Binary, as in 10101100.00010000.00011110.00111000
Hexadecimal, as in AC.10.1E.38
Network Addressing
The network address (which can also be called the network number) uniquely identifies each network. Every machine on the same network
shares that network address as part of its IP address. In the IP address 172.16.30.56, for example, 172.16 is the network address.
The node address is assigned to, and uniquely identifies, each machine on a network. This part of the address must be unique because it
identifies a particular machine, an individual as opposed to a network, which is a group. This number can also be referred to as a host address.
In the sample IP address 172.16.30.56, the 30.56 is the node address.
The designers of the Internet decided to create classes of networks based on network size. The figure below summarizes the three classes of
network
To ensure efficient routing, Internet designers defined a mandate for the leading-bits section of the address for each different network class.
For example, since a router knows that a Class A network address always starts with a 0, the router might be able to speed a packet on its
way after reading only the first bit of its address. This is where the address schemes define the difference between a Class A, a Class B, and a
Class C address.
The first bit of the first byte in a Class A network address must always be off, or 0.
If we turn the other 7 bits all off and then turn them all on, we’ll find the Class A range of network addresses:
00000000 = 0
01111111 = 127
This means a Class A address must be between 0 and 127 in the first byte, inclusive. Network 127.0.0.1 is reserved for loopback tests.
Designates the local node and allows that node to send a test packet to itself without generating network traffic.
The first bit of the first byte must always be turned on but the second bit must always be turned off. If you turn the other 6 bits all off and then
all on, you will find the range for a
Class B network:
10000000 = 128
10111111 = 191
This means a Class A address must be between from 128 to 191 in the first byte, inclusive.
The first 2 bits of the first octet are always turned on, but the third bit can never be on. Following the same process as the previous classes,
convert from binary to decimal to find the range. Here’s the range for a Class C network:
11000000 = 192
11011111 = 223
So, if you see an IP address that starts at 192 and goes to 223, you’ll know it is a Class C IP address.
Network Address Ranges: Classes D and E
The addresses between 224 to 255 are reserved for Class D and E networks. Class D (224–239) is used for multicast addresses and Class E
(240–255) for scientific purposes. For this course we don’t need to know them.
Private IP address
Public IP address
Public IP Addresses
Private IP Addresses
These are IP addresses that can be used on a private network, but they’re not routable through the internet.
This is designed for the purpose of creating a measure of well-needed security, but it also conveniently saves valuable IP address space. If
every host on every network had to have real routable IP addresses, we would have run out of IP addresses. But by using private IP addresses
ISPs and home users only need a relatively tiny group of bona fide IP addresses to connect their networks to the Internet. This is economical
because they can use private IP addresses on their inside networks and get along just fine.
To accomplish this task, the ISP and the corporation, the end user, no matter who they are need to use something called Network Address
Translation (NAT), which basically takes a private IP address and converts it for use on the Internet. The reserved private addresses are listed
in table below.
Note: An IP address that does not lie in the address space table above is a public IP addresses.
Subnetting Basics
At the introduction of the course, we were defining only one network. What happens if we wanted to take one network address and create six
networks from it? We would have to do something called subnetting, because that’s what allows you to take one larger network and break it
into a bunch of smaller networks. There are loads of reasons in favor of subnetting, including the following benefits:
Reduced network traffic
We all appreciate less traffic of any kind. Networks are no different. Without trusty routers, packet traffic could grind the entire network down
to a near standstill. With routers, most traffic will stay on the local network; only packets destined for other networks will pass through the
router. Routers create broadcast domains. The more broadcast domains you create, the smaller the broadcast domains and the less network
traffic on each network segment.
Optimized network performance
Simplified management
It’s easier to identify and isolate network problems in a group of smaller connected networks than within one gigantic network.
To create a subnet follow these steps: When you’ve chosen a possible subnet mask for your network and need to determine the number of
subnets, valid hosts, and broadcast addresses of a subnet that the mask provides, all you need to do is answer five simple questions:
How many subnets does the chosen subnet mask produce?
How many valid hosts per subnet are available?
What are the valid subnets?
What’s the broadcast address of each subnet?
What are the valid hosts in each subnet?
Here’s how you get the answers to those five big questions:
How many subnets? 2x = number of subnets. x is the number of masked bits, or the 1s. For example, in 11000000, the number of 1s
gives us 22 subnets. In this example, there are 4 subnets.
How many hosts per subnet? 2y – 2 = number of hosts per subnet. y is the number of unmasked bits, or the 0s. For example, in 11000000,
the number of 0s gives us 26 – 2 hosts. In this example, there are 62 hosts per subnet. You need to subtract 2 for the subnet address and
the broadcast address, which are not valid hosts.
What are the valid subnets? 256 – subnet mask = block size, or increment number. An example would be 256 – 192 = 64. The block
size of a 192 mask is always 64. Start counting at zero in blocks of 64 until you reach the subnet mask value and these are your subnets.
0, 64, 128, 192.
What’s the broadcast address for each subnet? Now here’s the really easy part. Since we counted our subnets in the last section as 0,
64, 128, and 192, the broadcast address is always the number right before the next subnet. For example, the 0 subnet has a broadcast
address of 63 because the next subnet is 64. The 64 subnet has a broadcast address of 127 because the next subnet is 128. And so on.
And remember, the broadcast address of the last subnet is always 255.
What are the valid hosts? Valid hosts are the numbers between the subnets, omitting the all 0s and all 1s. For example, if 64 is the
subnet number and 127 is the broadcast address, then 65–126 is the valid host range. It’s always the numbers between the subnet
address and the broadcast address.
Note: Understanding the Powers of 2 is very important for use with IP subnetting. Each successive power of 2 is double the previous one.
Subnet Masks
For the subnet address scheme to work, every machine on the network must know which part of the host address will be used as the subnet
address. This is accomplished by assigning a subnet mask to each machine. A subnet mask is a 32-bit value that allows the recipient of IP
packets to distinguish the network ID portion of the IP address from the host ID portion of the IP address.
The network administrator creates a 32-bit subnet mask composed of 1s and 0s. The 1s in the subnet mask represent the positions that refer
to the network or subnet addresses. Not all networks need subnets, meaning they use the default subnet mask. This is basically the same as
saying that a network doesn’t have a subnet address. The table shows the default subnet masks for Classes A, B, and C. These default masks
cannot change.
In other words, you can’t make a Class B subnet mask read 255.0.0.0. If you try, the host will read that address as invalid and usually won’t
even let you type it in. For a Class A network, you can’t change the first byte in a subnet mask; it must read 255.0.0.0 at a minimum.
Similarly, you cannot assign 255.255.255.255, as this is all 1s, a broadcast address. A Class B address must start with 255.255.0.0, and a
Class C has to start with 255.255.255.0.
Subnetting Class C Addresses
In a Class C address, only 8 bits are available for defining the hosts. Remember that subnet bits start at the left and go to the right, without
skipping bits. This means that the only Class C subnet masks can be the following:
We can’t use a /31 or /32 because we have to have at least 2 host bits for assigning IP addresses to hosts.
Example #1: 255.255.255.128 (/25)
Since 128 is 10000000 in binary, there is only 1 bit for subnetting and 7 bits for hosts. We’re
going to subnet the Class C network address 192.168.10.0.
192.168.10.0 = Network address
255.255.255.128 = Subnet mask
Now, let’s answer the big five:
How many subnets? Since 128 is 1 bit on (10000000), the answer would be 21 = 2.
How many hosts per subnet? We have 7 host bits off (10000000), so the equation would be 27 – 2 = 126 hosts.
What are the valid subnets? 256 – 128 = 128. Remember, we’ll start at zero and count in our block size, so our subnets are 0, 128.
What’s the broadcast address for each subnet? The number right before the value of the next subnet is all host bits turned on and equals
the broadcast address. For the zero subnet, the next subnet is 128, so the broadcast of the 0 subnet is 127.
What are the valid hosts? These are the numbers between the subnet and broadcast address. The easiest way to find the hosts is to write
out the subnet address and the broadcast address. This way, the valid hosts are obvious. The following table shows the 0 and 128
subnets, the valid host ranges of each, and the broadcast address of both subnets:
Example #2: 255.255.255.192 (/26)
In this second example, we’re going to subnet the network address 192.168.10.0 using the subnet mask 255.255.255.192.
192.168.10.0 = Network address
255.255.255.192 = Subnet mask
Now, let’s answer the big five:
How many subnets? Since 192 is 2 bits on (11000000), the answer would be 22 = 4 subnets.
How many hosts per subnet? We have 6 host bits off (11000000), so the equation would be 26 – 2 = 62 hosts.
What are the valid subnets? 256 – 192 = 64. Remember, we start at zero and count in our block size, so our subnets are 0, 64, 128, and
192.
What’s the broadcast address for each subnet? The number right before the value of the next subnet is all host bits turned on and equals
the broadcast address. For the zero subnet, the next subnet is 64, so the broadcast address for the zero subnet is 63.
What are the valid hosts? These are the numbers between the subnet and broadcast address. The easiest way to find the hosts is to write
out the subnet address and the broadcast address. This way, the valid hosts are obvious. The following table shows the 0, 64, 128, and
192 subnets, the valid host ranges of each, and the broadcast address of each subnet:
We know the Class B network address has 16 bits available for host addressing. This means we can use up to 14 bits for subnetting (because
we have to leave at least 2 bits for host addressing). Using a /16 means you are not subnetting with class B, but it is a mask you can use.
This section will give you an opportunity to practice subnetting Class B addresses. Again, I have to mention that this is the same as
subnetting with Class C, except we start in the third octet with the exact same numbers.
Valid subnets? 256 – 128 = 128. 0, 128. Remember that subnetting is performed in the third octet, so the subnet numbers are really
0.0 and 128.0, as shown in the next table. These are the exact numbers we used with Class C; we use them in the third octet and add a
0 in the fourth octet for the network address.
Valid hosts?
The following table shows the two subnets available, the valid host range, and the broadcast address of each:
Example #2: 255.255.192.0 (/18)
Hosts? 214 – 2 = 16,382 (6 bits in the third octet, and 8 in the fourth).
Valid subnets? 256 – 192 = 64. 0, 64, 128, 192. Remember that the subnetting is performed in the third octet, so the subnet numbers
are really 0.0, 64.0, 128.0, and 192.0, as shown in the next table.
Valid hosts?
The following table shows the four subnets available, the valid host range, and the broadcast address of each:
Subnetting Class A Addresses
Class A subnetting is not performed any differently than Classes B and C, but there are 24 bits to play with instead of the 16 in a Class B
address and the 8 in a Class C address.
Class A addresses use a default mask of 255.0.0.0, which leaves 22 bits for subnetting since you must leave 2 bits for host addressing. The
255.255.0.0 mask with a Class A address is using 8 subnet bits.
Subnets? 28 = 256.
Hosts? 216 – 2 = 65,534.
Valid subnets? What is the interesting octet? 256 – 255 = 1. 0, 1, 2, 3, etc. (all in the second octet). The subnets would be 10.0.0.0,
10.1.0.0, 10.2.0.0, 10.3.0.0, etc., up to 10.255.0.0.
Broadcast address for each subnet?
Valid hosts?
The following table shows the first two and last two subnets, valid host range, and broadcast addresses for the private Class A 10.0.0.0
network:
255.255.240.0 gives us 12 bits of subnetting and leaves us 12 bits for host addressing.
Subnets? 212 = 4096.
Hosts? 212 – 2 = 4094.
Valid subnets? What is your interesting octet? 256 – 240 = 16. The subnets in the second octet are a block size of 1 and the subnets in
the third octet are 0, 16, 32, etc.
Broadcast address for each subnet?
Valid hosts?
The following table shows some examples of the host ranges the first three and the last subnets: