Professional Documents
Culture Documents
Lab # 5
IP Address
An Internet Protocol (IP) address is a numeric label consisting of a 32 bit number assigned to a network capable device that uses IP for communication. The address fundamentally serves two purposes: location addressing and computer host or network interface identification. The address indicates where the connected device resides with the majority of hosts/devices still using the IPv4 (Internet Protocol Version 4) form of addressing. A significant limitation of the legacy IPv4 addressing is that it supports less than 4.3 billion total addresses. Based on the rapid growth of the Internet and related technologies, the use of IPv4 is not sustainable for the long term. In the mid-1990s, the new IPv6 technique was developed which makes use of 128 bits for the IP address. IPv6 technology continues to be deployed, albeit slowly. The Internet Assigned Numbers Authority (IANA) is responsible under the IETF for management of the IP address space allocation globally. Beneath the IANA, there are five regional Internet registries (RIRs) that are responsible for allocating IP address blocks to Internet service providers (ISPs) and other trusted organizations.
IP Address Classes
There were five IP address classes in use before the majority of industry switched to classless routing. There were A, B, C, D, and E. Class A addresses were used for networks with a very large number of total hosts. Class B was designed for use on medium to large networks, and C for small local area networks (LANs). Class D and E were set aside for multicast and experimental purposes. In the following table, the four octets that make up an IP address (a, b, c, and d respectfully) are displayed in how they were distributed in classes A, B, and C.
Classes A, B, and C. Class IP Address A B C a.b.c.d a.b.c.d a.b.c.d Network ID a a.b a.b.c Host ID b.c.d c.d d
6th Semester-SE
Class A IP addresses were used for networks that had a large number of hosts on the network. The class permitted up to 126 networks by using the first octet of the address for the network identification. The first bit in this octet was always fixed or set to be zero. The following seven bits in the octet were then set to one which would complete the network identification. The remaining octets (24 bits) represented the hosts ID and would allow up to 126 networks with 17 million hosts per network. In a Class A address, the network number values start at the number 1 and end at 127.
Class B IP Address
Class B IP address were assigned to medium to large networks. They allow 16,384 networks by using the first two octets in the address for the network identification. The first two bits of the first octet are fixed to 1 0. The next 6 bits along with the following octet then complete the network identification. The third and fourth octet (16 bits) then represents the host ID. This allows approximately 65,000 hosts per network. Class B network number values start at 128 and finish at 191.
Class C IP Address
Class C IP addresses were used in small LAN configurations. They allow for approximately 2 million networks by using the first three octets of the address for the network identification. In a Class C address, the first three bits are fixed to 1 1 0. In the following three octets, 21 bits make up the network identification. The last octet then represents the host identification. This allows for 254 hosts per network. A Class C network number value starts at 192 and ends at 223.
Class D IP Address
Class D IP addresses were reserved for multicasting purposes. These addresses begin with an octet in the 224-239 range. They would have leading bits of 1 1 1 0 and includes addresses from 224.0.0.0 to 239.255.255.255.
6th Semester-SE
Class E IP Address
Class E IP addresses are reserved for experimental use. The first octet of these addresses ranges between 240 and 255. This range is reserved by the IETF and similar to Class D networks, should not be assigned to a host device.
Private IP Addresses
While we are used to writing out streets and house numbers on envelopes, inside your computer IP Addresses are usually represented in what is known as dotted-decimal format such as 124.62.112.7 as this is the system that is understood by computers. As you can see, the address is split into 4 sections known as "octets" and each of the four octets can be numbered from 0-255, providing a total of 4,294,967,296 potentially unique IP Addresses. Now, while 4.2 Billion might seem like a lot, for many years large amounts of these have been allocated and used by large network such as backbone providers, ISPs and large Universities that made up the early Internet While other groups still have been reserved for special purposes and are not usable, so in practice the real amount is far less than 4.2 billion. The problem that we face today is that with many homes owning more than one computer and with cell phones, PDAs and even fridges being enabled for Internet access these days, IP Addresses are running out. When I mentioned above that some blocks of addresses had been reserved for special purposes, one of these purposes was for private networking and it is these private addresses that help to relieve the pressure on the remaining address space and make possible many of the cable and DSL routers that people have at home today to share their Internet connection amongst many PCs.
6th Semester-SE
Classless IP Addressing
After the invention of the Domain Name System (DNS), industry realized that the use of IP address classes would limit the scalability of the Internet. As a result, the IETF published RC 1518 and 1519 in 1993 to define the classless method of routing IPv4 data packets. The most recent definition of the standard occurred in 2006 under RFC 4632. Classless IP addressing was introduced as a more efficient means to make use of the IP address space when compared to Classful addressing. In classless addressing, the IP address is treated as a 32 bit stream where the boundary between the network identification and host can be at any of the bit positions. The network portion of the address is determined by the number of 1s that are in the subnet mask being applied to the address. A subnet mask is used locally on the hosts connected to the network and are never transmitted in an IPv4 data packet or datagram. All of the hosts on the same network are configured to use the same subnet mask with the host section of the IP address being unique to the host. The classless version of address is referred to as Classless Inter-Domain Routing (CIDR) and allows networks to be divided into differentsized subnets. The system avoids wasting IP addresses through the use of the subnet mask.
6th Semester-SE
Explanation: The figure above might seem confusing at first but it's actually very simple. We will take Class A as an example and analyze it so you can understand exactly what is happening here: Below you can see all this in pictures:
6th Semester-SE
Now, even though we have 3 Classes of IP Addresses that we can use, there are some IP Addresses that have been reserved for special use. This doesn't mean you can't assign them to a workstation but in the case that you did, it would create serious problems within your network. For this reason it's best that you avoid using these IP Addresses.
The following table shows the IP Addresses that you should avoid using: IP Address Network 0.0.0.0 Network 127.0.0.0 Function Refers to the default route. This route is to simplify routing tables used by IP. Reserved for Loopback. The Address 127.0.0.1 is often used to refer to the local host. Using this Address, applications can address a local host as if it were a remote host.
IP Address with all host Refers to the actual network itself. For example, network 192.168.0.0 (Class C) can be bits set to "0" used to identify network 192.168.0.0 This type of notation is often used within routing (Network Address) e.g tables. 192.168.0.0 IP Address with all node bits set to "1" (Subnet / Network Broadcast) e.g 192.168.255.255 IP Addresses with all node bits set to "1" are local network broadcast addresses and must NOT be used. Some examples: 125.255.255.255 (Class A) , 190.30.255.255 (Class B), 203.31.218.255 (Class C). See "Multicasts" & "Broadcasts" for more info.
6th Semester-SE
Subnet Masking
Applying a subnet mask to an IP address allows you to identify the network and node parts of the address. The network bits are represented by the 1s in the mask, and the node bits are represented by the 0s. Performing a bitwise logical AND operation between the IP address and the subnet mask results in the Network Address or Number. For example, using our test IP address and the default Class B subnet mask, we get: 10001100.10110011.11110000.11001000 11111111.11111111.00000000.00000000 -------------------------------------------------------10001100.10110011.00000000.00000000 Default subnet masks: Class A - 255.0.0.0 - 11111111.00000000.00000000.00000000 Class B - 255.255.0.0 - 11111111.11111111.00000000.00000000 Class C - 255.255.255.0 - 11111111.11111111.11111111.00000000 Additional bits can be added to the default subnet mask for a given Class to further subnet, or break down, a network. When a bitwise logical AND operation is performed between the subnet mask and IP address, the result defines the Subnet Address (also called the Network Address or Network Number). There are some restrictions on the subnet address. Node addresses of all "0"s and all "1"s are reserved for specifying the local network (when a host does not know its network address) and all hosts on the network (broadcast address), respectively. This also applies to subnets. A subnet address cannot be all "0"s or all "1"s. This also implies that a 1 bit subnet mask is not allowed. This restriction is required because older standards enforced this restriction. Recent standards that allow use of these subnets have superseded these standards, but many "legacy" devices do not support the newer standards. If you are operating in a controlled environment, such as a lab, you can safely use these restricted subnets. To calculate the number of subnets or nodes, use the formula (2n-2) where n = number of bits in either field, and 2n represents 2 raised to the nth power. Multiplying the number of subnets by the number of 140.179.000.000 Network Address 140.179.240.200 Class B IP Address 255.255.000.000 Default Class B Subnet Mask
6th Semester-SE
In this example a 3 bit subnet mask was used. There are 6 (23-2) subnets available with this size mask (remember that subnets with all 0's and all 1's are not allowed). Each subnet has 8190 (213-2) nodes. Each subnet can have nodes assigned to any address between the Subnet address and the Broadcast address. This gives a total of 49,140 nodes for the entire class B address subnetted this way. Notice that this is less than the 65,534 nodes an unsubnetted class B address would have. You can calculate the Subnet Address by performing a bitwise logical AND operation between the IP address and the subnet mask, then setting all the host bits to 0s. Similarly, you can calculate the Broadcast Address for a subnet by performing the same logical AND between the IP address and the subnet mask, then setting all the host bits to 1s. That is how these numbers are derived in the example above. Subnetting always reduces the number of possible nodes for a given network. There are complete subnet tables available here for Class A, Class B and Class C. These tables list all the possible subnet masks for each class, along with calculations of the number of networks, nodes and total hosts for each subnet. Here is another, more detailed, example. Say you are assigned a Class C network number of 200.133.175.0 (apologies to anyone who may actually own this domain address). You want to utilize this network across multiple small groups within an organization. You can do this by subnetting that network with a subnet address. We will break this network into 14 subnets of 14 nodes each. This will limit us to 196 nodes on the network instead of the 254 we would have without subnetting, but gives us the advantages of traffic isolation and security. To accomplish this, we need to use a subnet mask 4 bits long. Recall that the default Class C subnet mask is 255.255.255.0 (11111111.11111111.11111111.00000000 binary) Extending this by 4 bits yields a mask of
6th Semester-SE
Subnet bits Network Number Node Addresses Broadcast Address 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 200.133.175.0 200.133.175.16 200.133.175.32 200.133.175.48 200.133.175.64 200.133.175.80 200.133.175.96 Reserved .17 thru .30 .33 thru .46 .49 thru .62 .65 thru .78 .81 thru .94 .97 thru .110 None 200.133.175.31 200.133.175.47 200.133.175.63 200.133.175.79 200.133.175.95 200.133.175.111 200.133.175.127 200.133.175.143 200.133.175.159 200.133.175.175 200.133.175.191 200.133.175.207 200.133.175.223 200.133.175.239
200.133.175.112 .113 thru .126 200.133.175.128 .129 thru .142 200.133.175.144 .145 thru .158 200.133.175.160 .161 thru .174 200.133.175.176 .177 thru .190 200.133.175.192 .193 thru .206 200.133.175.208 .209 thru .222 200.133.175.224 .225 thru .238
6th Semester-SE
6th Semester-SE
Let's say for example, we were given the IP address 195.70.16.159 and told that it is in a /30. This is how I'd go about filling in the template above. First of all, as IP addresses are 32 bits long, and each octet is 8 bits in length, we know that: Bits 0 to 8 are covered in the first octet. Bits 9 to 16 are covered in the second octet.
6th Semester-SE
25 SN x
26 SN x
27 SN x
28 SN x
29 SN x
30 SN x
31 H x
32 H x
Now let's replace the bit numbers with their values: 128 SN x 64 SN x 32 SN x 16 SN x 8 SN x 4 SN x 4 H x 1 H x
Now, let's replace the x's with the value of the fourth octet in the address, which in this case, is 159.
128 SN 1
64 SN 0
32 SN 0
16 SN 1
8 SN 1
4 SN 1
4 H 1
1 H 1
Now to find out the network address all we do is add the SN bits that have a 1 underneath them, together. (128 + 16 + 8 + 4 = 156).
When you add this 156 to the first three octets of the address, we're left with the Network Address 195.70.16.156. Now, as we know that the first usable address is always the Network Address plus one, all we need to do is perform the following calculation: (156 + 1 = 157). This gives us a First Usable Address of 195.70.16.157.
6th Semester-SE
Solution: Group 1
For this group, each customer needs 256 addresses. This means that 8 (log2 256) bits are needed to define each host. The prefix length is then 32 8 = 24. The addresses are
Group 2
For this group, each customer needs 128 addresses. This means that 7 (log2 128) bits are needed to define each host. The prefix length is then 32 7 = 25. The addresses are
6th Semester-SE
Group 3
For this group, each customer needs 64 addresses. This means that 6 (log264) bits are needed to each host. The prefix length is then 32 6 = 26. The addresses are
Number of granted addresses to the ISP: 65,536 Number of allocated addresses by the ISP: 40,960 Number of available addresses: 24,576
Tasks: Q1. Find the class of each address. a. 00000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111 c. 14.23.120.8 d. 252.5.15.111 Q2. A block of addresses is granted to a small organization. We know that one of the addresses is 205.16.37.39/28. Find a. b. c. d. Network Address The first usable address The last usable address The broadcast address
6th Semester-SE Engr. Mirza Ahsan Ullah
6th Semester-SE