USD ($)
$
United States Dollar
India Rupee

IP Addressing and Subnetting : Configure in Cisco

Created by Deepak Sharma in CCNA 4 Nov 2024
Share
«Difference between TCP and UDP: Detailed ...

IP addressing is a system used to assign unique numerical labels to devices on a network, enabling them to communicate with each other. Each IP address consists of two parts: the network portion, which identifies the network itself, and the host portion, which identifies the specific device within that network.

Subnetting is the practice of dividing a larger network into smaller, more manageable subnetworks (subnets). This enhances routing efficiency, improves security, and optimizes performance by limiting broadcast traffic. Subnetting involves creating subnets by manipulating the subnet mask, allowing for more effective use of IP addresses within an organization.

In this article, we will understand IP addresses and subnets and check how to configure them in Cisco devices. Configuration of IP address and subnet on a Cisco device is a very basic concept and should be known if you want to pursue any Cisco certification.

It will be a detailed guide on IP addressing and subnetting, as we will cover everything related to IP address, subnet, their working, and configuration.

What is an IP Address?

An IP address is a unique numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. It serves two main functions: identifying the host or network interface and providing the location of the device in the network.

IP addresses can be classified into two types: IPv4, which uses a 32-bit address format, and IPv6, which uses a 128-bit address format, allowing for a vastly larger number of unique addresses.

Currently, most devices use IPv4 addressing, and we will also learn about IPv4 addresses.

IPv4 addresses are 32-bit binary numbers, typically represented in decimal format (dotted-decimal notation) consisting of four octets separated by periods. Each octet represents 8 bits, ranging from 0 to 255, giving a total of 2^32 (approximately 4.3 billion) unique IPv4 addresses.


Online CCNA TrainingPrepare for CCNA certification exam.Explore course
custom banner static image

IPv4 Address Classes

IPv4 addresses are categorized into five classes, each serving different purposes based on the size of the network and the number of hosts.

ClassFirst BitsIP Address RangeNetwork Size
A01.0.0.0 - 126.0.0.0Large networks
B10128.0.0.0 - 191.255.0.0Medium-sized networks
C110192.0.0.0 - 223.255.255.0Small networks
D1110224.0.0.0 - 239.255.255.255Multicast addresses (not assigned to individual hosts or networks)
E1111240.0.0.0 - 255.255.255.255Reserved for experimental and future use

Types of IPv4 Address

There are two types of IPv4 addresses.

1. Public IPv4 addresses: They are globally routable and can be accessed over the Internet.

● 1.0.0.0 - 126.255.255.255

● 128.0.0.0 - 191.255.255.255

● 192.0.0.0 - 223.255.255.255

2. Private IPv4 addresses: They are used in private networks which are not routable on the Internet.

● 10.0.0.0 - 10.255.255.255

● 172.16.0.0 - 172.31.255.255

● 192.168.0.0 - 192.168.255.255

NAT (Network Address Translation) converts private IPv4 addresses into public addresses or vice versa. It helps private networks to communicate over the internet once they are converted to public addresses. 

What is Subnetting?

Subnetting divides a network into smaller subnets which allows an efficient utilization of IP addresses with network segmentation. It has several benefits such as improved network management, enhanced security, and optimized routing.

What are subnets?

Subnets are smaller, manageable segments of a larger network, created by dividing an IP address space. Subnetting allows for efficient IP address management and better control over network resources, enabling easier troubleshooting and reduced broadcast domains.

Each subnet has its range of IP addresses, which helps in optimizing the use of available addresses and improving overall network efficiency.

How to Subnet an IP Address?

The key steps in the subnetting process are:

Step 1: Start with an IP address that you want to subnet, either a network address or a host address within the network.

Step 2: Decide on the subnet mask that will define the size of each subnet. The subnet mask consists of a series of contiguous 1s followed by a series of contiguous 0s and is represented in decimal format (dotted-decimal notation).

Step 3: Count the number of 1s in the subnet mask, which represents the number of bits dedicated to the network portion of the IP address.

Step 4: Use the formula 2^n - 2 to calculate the number of subnets and hosts per subnet, where n is the number of subnet bits. Subtract 2 to account for the network and broadcast addresses, as they cannot be assigned to hosts.

Step 5: Calculate the network address by performing a bitwise AND operation between the IP address and the subnet mask.

Step 6: Determine the range of valid host addresses within each subnet, which is between (network address + 1) and the last usable address (broadcast address - 1).

Step 7: Calculate the broadcast address for each subnet by setting all host bits to 1.

This process allows network administrators to efficiently utilize IP addresses by creating smaller, more manageable subnets, each with its network address and range of available host addresses.

Configure IP Addressing and Subnetting

Here we will see the process to configure of IP addressing and subnetting on the Cisco environment. You can try the steps in our CCNA virtual lab.

Topology Diagram

banner image

Tasks

● Begin by logging into device R01 and observe that it already has a customized configuration, evident from its host name. Reset this device to its factory default configuration.

● Login into each device and perform the following configurations:

   ✓ Set the hostname to match the device name as indicated in the topology diagram.

   ✓ Implement a command to prevent the device from attempting DNS resolution for mistyped commands.

   ✓ Configure a command to display the most recent input/typing on the screen after an interruption caused by a SYSLOG or other console message.

   ✓ Require a password of "CISCO" whenever anyone attempts to access Privileged EXEC mode. Ensure that this password is not visible in plaintext in the configuration file.

   ✓ Enable all interfaces shown in the topology diagram and provide brief interface descriptions to indicate their respective connections.

   ✓ Once these steps are completed, use CDP on SW02, R05, and R04 to verify that these devices can recognize other connected Cisco devices as CDP neighbors.

● Proceed to configure devices R01 and R03 to allow inbound Telnet connections, authenticated against a preconfigured password of "CISCO".

● For devices R02 and R05, configure them to allow inbound SSH (version 2) connections, authenticated using the username "admin" and a password of "CISCO" at Privilege Level 15. Feel free to include any additional required keywords or features for SSH configuration at your discretion.

● To drive an IP addressing scheme for network segments A through F, adhere to the following guidelines:

   ✓ Begin with the starting network of 170.50.0.0/16.

   ✓ Allocate the first and largest subnet as 170.50.0.0 with a new or different subnet mask.

● Utilize the Variable Length Subnet Masking (VLSM) method, ensuring that each network has the fewest or least host bits possible based on the below-provided host requirements.

        Network Segment    Required Hosts    Subnet Mask         Prefix

                     A                          99

                     B                          13

                     C                           6

                     D                          11

                      E                          26

                      F                          30

● Assign IPv4 addresses to your router interfaces using these guidelines:

   ✓ Routers connecting to network segments A through D should be assigned the first available host address within each respective subnet.

   ✓ The addressing of router R03's E0/2 interface for Segments E and F will be covered in another lab.

   ✓ Configure IP addresses of routers R03 (E0/0: 20.1.3.3/24 and E0/1: 20.1.34.3/24), R04 (E0/0: 20.1.45.4/24 and E0/1: 20.1.34.4/24), and R05 (E0/0: 20.1.45.5/24, E0/1: 50.1.23.5/24 and E0/2: 20.1.5.5/24).

● To verify your IPv4 addressing configuration, perform the following actions:

   ✓ Confirm successful Telnet connectivity from R02 to R01.

   ✓ Verify Telnet connectivity from R04 to R03.

   ✓ Ensure SSH connectivity from R01 to R02.

   ✓ Validate SSH connectivity from R04 to R05.

Configuration and Verifications

Login to R01, press enter, and go to the user mode using the command "enable". Use the command "write erase" or "erase startup-config" to remove the configuration and press enter to confirm. Then use "reload" command to restart the device and press enter to confirm. 

banner image

When the R01 device comes up again it will be in factory default state. It asks for System Configuration Dialog, Type "no" to proceed as

banner image

Login to all devices and configure using the following commands.

enable - command to enter in user mode

configure terminal - command to enter in configuration mode

no ip domain-lookup - command to prevent the device from attempting DNS resolution for mistyped commands

line console 0

  logging synchronous - command to display the most recent input/typing on the screen after an interruption caused by a console message

enable secret CISCO- command for configuring password to enter in privileged exec mode

interface <> 

  description <> - command to enter into interface mode and give a description to it, note <> give interface name here

Note: All devices are in factory default, and it asks for System Configuration Dialog, Type "no" to proceed. By default, the router's interfaces are shut down, so need to unshut them using the command "no shutdown". Save the device configuration using the "write" command.

R01:

!

enable

configure terminal

hostname R01

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/2

 description "Connection-to-SW01"

 no shutdown

!

interface E0/1

 description "Connection-to-SW02"

 no shutdown

!

interface E0/0

 description "Connection-to-R02"

 no shutdown

!

end

!

write

!

banner image

R02:

!

enable

configure terminal

hostname R02

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/3

 description "Connection-to-SW01"

 no shutdown

!

interface E0/2

 description "Connection-to-SW02"

 no shutdown

!

interface E0/0

 description "Connection-to-R01"

 no shutdown

!

interface E0/1

 description "Connection-to-PC02"

 no shutdown

!

end

!

write

!

banner image

R03:

!

enable

configure terminal

hostname R03

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/2

 description "Connection-to-SW03"

 no shutdown

!

interface E0/0

 description "Connection-to-PC04"

 no shutdown

!

interface E0/1

 description "Connection-to-R04"

 no shutdown

!

end

!

write

!


banner image

R04:

!

enable

configure terminal

hostname R04

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/0

 description "Connection-to-R05"

 no shutdown

!

interface E0/1

 description "Connection-to-R03"

 no shutdown

!

end

!

write

!

banner image

R05:

!

enable

configure terminal

hostname R05

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/0

 description "Connection-to-R04"

 no shutdown

!

interface E0/2

 description "Connection-to-R02"

 no shutdown

!

end

!

write

!


banner image

Note: The switch's interfaces are already in no shutdown state by default. Please shut down all the unused interfaces using the command "shutdown". Using the interface range <> command, you can configure multiple interfaces at the same time. Save the device configuration using the "write" command.

SW01:

!

enable

configure terminal

hostname SW01

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/0

 description "Connection-to-PC01"

!

interface E0/2

 description "Connection-to-R01"

!

interface E0/3

 description "Connection-to-R02"

!

interface range E0/1

 description "unused interface"

 shutdown

!

end

!

write

!

banner image

SW02:

!

enable

configure terminal

hostname SW02

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/0

 description "Connection-to-SW03"

!

interface E0/1

 description "Connection-to-R01"

!

interface E0/2

 description "Connection-to-R02"

!

interface E0/3

 description "Connection-to-SW04"

!

interface E1/0

 description "Connection-to-SW04"

!

interface range E1/1-3

 description "unused interface"

 shutdown

!

end

!

write

!

banner image

SW03:

!

enable

configure terminal

hostname SW03

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/0

 description "Connection-to-PC03"

!

interface E0/1

 description "Connection-to-SW02"

!

interface E0/2

 description "Connection-to-SW04"

!

interface E0/3

 description "Connection-to-R03"

!

interface E1/0

 description "Connection-to-PC"

!

interface E1/1

 description "Connection-to-SW04"

!

interface range E1/2-3

 description "unused interface"

 shutdown

!

end

!

write

!


banner image

SW04:

!

enable

configure terminal

hostname SW04

no ip domain-lookup

line console 0

 logging synchronous

 exit

enable secret CISCO

!

interface E0/0

 description "Connection-to-SW02"

!

interface E0/1

 description "Connection-to-R05"

!

interface E0/2

 description "Connection-to-SW03"

!

interface E1/0

 description "Connection-to-SW02"

!

interface E1/1

 description "Connection-to-SW03"

!

interface range E0/3, E1/2-3

 description "unused interface"

 shutdown

!

end

!

write

!

banner image


Use "show cdp neighbor" command on SW02, R05, and R04 to verify that these devices can recognize other connected Cisco devices as CDP neighbors.

Note: Now whenever you log in to any device, you have to first use the enable command for privileged mode and it will then also ask for a password (which you previously configured as "CISCO"). Here in the output Device IDs are the neighbors, Local Interfaces are the device interfaces and Port IDs are the neighbor device interfaces to which this device is connected. 

SW02:

banner image

In the output above SW02 is connected to R01, R02, SW03 and SW04 on interfaces E0/1, E0/2, E0/0 and E0/3 & E1/0 respectively.

R05:

banner image

In the output above R05 is connected to R04 and SW04 on interfaces E0/0 and E0/2 respectively.

R04:

banner image

In the output above R04 is connected to R03 and R05 on interfaces E0/1, E0/0 respectively.

Now configure devices R01 and R03 to allow inbound Telnet connections and authenticate them against a preconfigured password of "CISCO". This will be configured in vty line, there are 5 lines in these routers i.e., 0-4 (in high-end devices there are 15 lines) meaning 5 users can log in to this device at the same time.

Note: By default, telnet is allowed, and any user (who has this device password) can telnet to this device.

From now onwards, it will be assumed that you are already logged into the devices and have entered the enable password.

R01 and R03:

!

configure terminal

!

line vty 0 4

 transport input telnet

 password CISCO

 exit

!

end

!

write

!


banner image

banner image

Configure R02 and R05 to allow inbound SSH (version 2) connections, authenticated using the username "admin" and a password of "CISCO" at Privilege Level 15

Note: By default, SSH is not allowed in many low-end or old devices so first need to enable SSH on these devices as follows

Note: When generating a key, select the 1024-bit long key

R02 and R05:

!

configure terminal

!

ip domain-name cisco.com

!

crypto key generate rsa

!

ip ssh version 2

!

end

!

write

!

banner image

banner image

Now similar to allowing telnet under vty lines in the previous scenario, in this case, allow ssh as follows, remember here username and password is to be configured at privileged level 15 instead of under vty line.

This needs to specify under vty line that the local password will be used using the command "login local".

R02 and R05:

!

configure terminal

!

username admin password CISCO

!

line vty 0 4

 transport input ssh

 login local

 exit

!

end

!

write

!


banner image

banner image

Drive an IP addressing scheme for network segments A through F as per the provided table from a major subnet 170.50.0.0/16. The following bits are required to have these hosts in the Network Segments (A, B, C, D, E, F). If you subtract these bits from 32 then you will get a subnet mask.

B = 13 requires 4-bits => 32-4 = 28 or 255.255.255.240  

● C = 6 requires 3-bits => 32-3 = 29 or 255.255.255.248 

● D = 11 requires 4-bits => 32-4 = 28 or 255.255.255.240  

● E = 26 requires 5-bits => 32-5 = 27 or 255.255.255.224  

● F = 30 requires 5-bits => 32-5 = 27 or 255.255.255.224

●A = 99 requires 7-bits => 32-7 = 25 or 255.255.255.128  

As per given in the task, the first and largest subnet should be 170.50.0.0, and the others are as follows, so the first subnet 170.50.0.0/25 and add 128, 32, 32, 16, and 16 in the last octate for segment F, B, E, D and C respectively.

● A => 170.50.0.0 255.255.255.128

● F => 170.50.0.128 255.255.255.224

● E => 170.50.0.160 255.255.255.224

● B => 170.50.0.192 255.255.255.240

● D => 170.50.0.208 255.255.255.240

● C => 170.50.0.224 255.255.255.248

Now configure R01 and R02's interfaces using network segments A, B, and D as per topology. Use initial available IP addresses. 

Note: By default, the router's interfaces are in a shutdown state, here we are adding the command "no shutdown" on interfaces just for consistency. 

R01:

!

configure terminal

!

interface E0/2

 description "Segment A"

 ip address 170.50.0.1 255.255.255.128

 no shutdown

!

interface E0/0

 description "Segment B"

 ip address 170.50.0.193 255.255.255.240

 no shutdown

!

interface E0/1

 description "Segment D"

 ip address 170.50.0.209 255.255.255.240

 no shutdown

!

end

!

write

!

banner image

R02:

!

configure terminal

!

interface E0/3

 description "Segment A"

 ip address 170.50.0.2 255.255.255.128

 no shutdown

!

interface E0/2

 description "Segment D"

 ip address 170.50.0.210 255.255.255.240

 no shutdown

!

interface E0/0

 description "Segment B"

 ip address 170.50.0.194 255.255.255.240

 no shutdown

!

interface E0/1

 description "Segment C"

 ip address 170.50.0.225 255.255.255.248

 no shutdown

!

end

!

write

!

banner image

Now configure interface IP addresses on R03, R04, and R05 as per provided in the tasks. 

R03:

!

configure terminal

!

interface E0/0

 description "connected to PC04"

 ip address 20.1.3.3 255.255.255.0

!

interface E0/1

 description "connected to R04"

 ip address 20.1.34.3 255.255.255.0

!

end

!

write

!

banner image

R04:

!

configure terminal

!

interface E0/0

 description "connected to R05"

 ip address 20.1.45.4 255.255.255.0

!

interface E0/1

 description "connected to R03"

 ip address 20.1.34.4 255.255.255.0

!

end

!

write

!

banner image

R05:

!


configure terminal


!


interface E0/0


 description "connected to R04"

 ip address 20.1.45.5 255.255.255.0

!

interface E0/1

 description "future use"

 ip address 50.1.23.5 255.255.255.0

!

interface E0/2

 description "connected to SW04"

 ip address 20.1.5.5 255.255.255.0

!

end

!

write

!

banner image

Now check the direct IP connectivity between the devices using the PING command. R01 can reach R02 from segments A, B, and D. Also use the "show ip interface brief" command to check the configured IP address on interfaces and make sure both interface status and protocol are showing up/up.

R01:

banner image

Check the IP connectivity from R04 to R03 and R05. Also, use "show ip interface brief" command to check the configured IP address on interfaces and make sure both interface status and protocol are showing up/up.

R04:

banner image

Further verifications can be performed by, using password CISCO for telnet or SSH into other devices (as configured in the tasks) and using "exit" to come out from the terminal of the logged device.

Telnet connectivity from R02 to R01

banner image

Telnet connectivity from R04 to R03

banner image

SSH connectivity from R01 to R02, log in using username "admin" and password "CISCO"

banner image

SSH connectivity from R04 to R05, log in using username "admin" and password "CISCO"

banner image

IP Addressing and Subnetting- Summing Up!

IP addressing involves assigning unique numerical labels to devices on a network, allowing them to communicate. IPv4 uses a 32-bit format, while IPv6 uses a 128-bit format. Subnetting divides a larger network into smaller, more manageable segments called subnets, enhancing efficiency, security, and performance.

To configure IP addressing and subnetting on Cisco devices, define interfaces, assign IP addresses and subnet masks, enable interfaces, and verify configurations. Mastering these concepts is crucial for effective network management and troubleshooting.

By staying informed about best practices and configuring devices properly, network professionals can optimize network performance and strengthen security measures.

What is Subnet Mask in Computer ...»
Deepak Sharma

He is a senior solution network architect and currently working with one of the largest financial company. He has an impressive academic and training background. He has completed his B.Tech and MBA, which makes him both technically and managerial proficient. He has also completed more than 450 online and offline training courses, both in India and ...

More... | Author`s Bog | Book a Meeting

Related Articles

#Explore latest news and articles

CCNA Course Syllabus: Topics Explained 11 Nov 2024

CCNA Course Syllabus: Topics Explained

Examine the latest Cisco CCNA course syllabus and understand the details of each 200-301 exam topics with practical on lab devices. Start Now!
What is IPv6 Addressing? How to configure on Cisco Devices? 5 Nov 2024

What is IPv6 Addressing? How to configure on Cisco Devices?

Learn what is IPv6 addressing and how to configure them in Cisco routers and switches at CCNA Labs at UniNets.
What is OSI Model and 7 Layers in OSI model 13 Nov 2024

What is OSI Model and 7 Layers in OSI model

Understand what are OSI layers model & their network functions. Start your IT networking journey for mastering advance topics. Read More! 

FAQ

IP addressing assigns unique identifiers to devices on a network, while subnetting divides a network into smaller segments called subnets to improve efficiency, security, and performance.
The subnet address is the network portion of an IP address, obtained by performing a bitwise AND operation between the IP address and the subnet mask. It identifies the network to which a device belongs.
Subnetting is used to create smaller, more manageable network segments, improve routing efficiency, enhance security by isolating traffic, and optimize IP address utilization.
The two main types of subnetting are fixed-length subnet masking (FLSM), where all subnets have the same size, and variable-length subnet masking (VLSM), where subnets can have different sizes.
The IP address range refers to the total number of available IP addresses, while a subnet is a logical division of a network that has its own network address and range of available host addresses.

Comments (0)

Share

Share this post with others

Contact learning advisor

Captcha image
Fortinet SD-WAN Live Training!
Fortinet SD-WAN Live Training!
Join Our Expert-Led Fortinet SD-WAN Training with lab Support – Starting 16th Nov, 10 AM IST.
Day
Hr
Min
Sec
Register Now