In preparation of our CCNA exam, we want to make sure we cover the various concepts that we could see on our Cisco CCNA exam. So to assist you, below we will discuss TCPIP Address and Subnetting.


TCP/IP Address & Subnetting Overview
In a TCP/IP environment, each node must have a unique 32-bit logical IP address. Each IP datagram includes the source and destination IP addresses in the header.
Host and Network Address
Each company listed on the Internet is viewed as a single network. This network must be reached before a host within that company can be contacted. A two-part addressing scheme allows the IP address to identify both the network and the host.
All the endpoints within a network share a network number.
The remaining bits identify each host within that network.
IP Address Classes
There are five classes of IP: Classes A through E. Classes A, B, and C are the most common. Class A has 8 network bits and 24 host bits. (So there are few Class A networks, but each has many hosts.) Class C addresses allow for many more networks, each with fewer hosts. This scheme was based on the assumption that there would be more small networks than large networks in the world.
Note: The address range for all five classes is shown in the figure. Class D is used for multicast purposes, and Class E addresses are used for research.
The example in the figure shows networks A and B connected by a router. Network B has a Class A address (10.0.0.0). The routing table contains entries for network addresses (not hosts within that network). In the example,172.16.0.0 and 10.0.0.0 refer to the wires at each end of the router. Network 10.0.0.0 is a special case of Class A networks. It is typically used in private networks.
TCP/IP Address Summary
In a TCP/IP environment, each end station has a 32-bit logical IP address that has a network and host portion.
The address format is known as dotted-decimal notation. The range is 0.0.0.0 to 255.255.255.255.
Five address classes are suited to different types of users.
The total number of available hosts on a network can be derived by using the formula 2n – 2, where n is the number of bits in the host portion.
Implementing Subnet Planning
Without subnets, the organization operates as a single network. These flat topologies result in short routing tables but, as the network grows, the use of bandwidth becomes inefficient. (All systems on the network receive all the broadcasts on the network.) Network addressing can be made more efficient by breaking the addresses into smaller segments, or subnets. Subnetting provides additional structure to an addressing scheme without altering the addresses. In the figure, the network address 172.16.0.0 is subdivided into four subnets:
172.16.1.0, 172.16.2.0, 172.16.3.0, and 172.16.4.0. If traffic were evenly distributed to each end station, the use of subnetting would reduce the overall traffic seen by each end station by 75 percent.
Subnet Mask
A subnet mask is a 32-bit value written as four octets. In the subnet mask, each bit determines how the corresponding bit in the IP address should be interpreted (network, subnet, or host). The subnet mask bits are coded as follows:
Binary 1 for the network bits
Binary 1 for the subnet bits
Binary 0 for the host bits
Although dotted decimal is the most common format, the subnet can be represented in several ways:
Dotted decimal—172.16.0.0 255.255.0.0
Bit count—172.16.0.0/16
Hexadecimal—172.16.0.0 0xFFFF0000
The ip netmask-format command can be used to specify the format of network masks for the current session. Dotted decimal is the default.
Default Subnet Masks
Each address class has a default subnet mask. The default subnet masks only the network portion of the address, the effect of which is no subnetting. With each bit of subnetting beyond the default, you can create 2n – 2 subnets. These examples show the effect of adding subnet bits.
How Routers Use Subnet Masks
To determine an address’s subnet, a router performs a logical AND operation with the IP address and subnet mask. Recall that the host portion of the subnet mask is all 0s. The result of this operation is that the host portion of the address is removed, and the router bases its decision on only the network portion of the address. In the figure, the host bits are removed, and the network portion of the address is revealed. In this case, a 10-bit subnet address is used, and the network (subnet) number 172.16.2.128 is extracted.
Broadcast Addresses
Broadcast messages are sent to every host on the network. There are three kinds of broadcasts:
Directed broadcasts—You can broadcast to all hosts within a subnet and to all subnets within a network. (170.34.2.255 sends a broadcast to all hosts in the 170.34.2.0 subnet.)
Flooded broadcasts (255.255.255.255)—Local broadcasts within a subnet.
You can also broadcast messages to all hosts on all subnets within a single network. (170.34.255.255 sends a broadcast to all subnets in the 170.34.0.0 network.)
Identifying Subnet Addresses
Given an IP address and subnet mask, you can identify the subnet address, broadcast address, first usable address, and last usable address using this method:
1 Write down the 32-bit address. Directly below that, write down the subnet mask.
2 Draw a vertical line just after the last 1 bit in the subnet mask.
3 Copy the portion of the IP address to the left of the line. Place all 0s for the remaining free spaces to the right. This is the subnet number.
4 Copy the portion of the IP address to the left of the line. Place all 1s for the remaining free spaces to the right. This is the broadcast address.
5 Copy the portion of the IP address to the left of the line. Place all 0s in the remaining free spaces until you reach the last free space. Place a 1 in that free space. This is your first usable address.
6 Copy the portion of the IP address to the left of the line. Place all 1s in the remaining free spaces until you reach the last free space. Place a 0 in that free space. This is your last usable address.
How to Implement Subnet Planning
Subnetting decisions should always be based on growth estimates rather than current needs. To plan a subnet, follow these steps:
1 Determine the number of subnets and hosts for each subnet required.
2 The address class you are assigned and the number of subnets required determine the number of subnetting bits used. For example, with a Class C address and a need for 20 subnets, you will have a 29-bit mask (255.255.255.248). This allows for the Class C default 24-bit mask and 5 bits required for 20 subnets. (The formula 2n – 2 yields only 14 subnets for 4 bits, so 5 bits must be used.)
3 The remaining bits in the last octet are used for the host field. In this case, each subnet has 23 – 2, or 6 hosts.
4 The final host addresses are a combination of the network/subnet plus each host value. The hosts on the 192.168.5.32 subnet would be addressed as 192.168.5.33, 192.168.5.34, 192.168.5.35, and so forth.
Implementing Subnet Planning Summary
Breaking up networks into smaller segments (or subnets) improves network efficiency and conserves IP addresses.
A 32-bit subnet mask determines the boundary between the subnet host portions of the IP address using 1s and 0s.
A subnet defines a broadcast domain in a routed network.
Cisco IOS Software supports directed, local network, and subnet broadcasts.
Subnet planning should be based on future growth predictions rather than current needs.
Configuring IP Addresses
An IP address must be assigned to a switch if you plan to use SNMP or connect to the switch through a Web browser or Telnet. If the switch needs to send traffic to a different IP network, the traffic is routed to a default gateway. Here’s the procedure for configuring a switch IP address:
SwitchA>enable
SwitchA#config term
SwitchA(config)#ip address 10.2.5.10 255.255.255.0
SwitchA(config)#ip default-gateway 10.2.5.2
SwitchA(config)#exit
SwitchA#show ip
The no ip address command resets the address to the default (0.0.0.0).
Each unique IP address can have a host name associated with it. A maximum of six IP addresses can be specified as named servers. Domain Name System (DNS) is a system used to translate names into addresses. If a system sees an address it does not recognize, it refers to DNS, which is enabled by default with a server address of 255.255.255.255. The ip domain-lookup and the no ip domain-lookup commands turn DNS on and off, respectively.
Router IP Host Names
When names are used to route traffic, they must be translated into addresses. Routers must be able to associate host names with IP addresses to communicate with other IP devices. The ip host command manually assigns host names to addresses.
Configuring IP Addresses Summary
The ip address command sets the IP address and subnet mask.
The ip name-server command defines which hosts can provide the name service.
DNS translates node names into addresses.
The show hosts command displays host names and addresses.