# IP Subnetting in Cisco Packet Tracer

I will tell you how to do IP subnetting in Cisco Packet Tracer.

In order to do IP subnetting, it is necessary to make the necessary IP calculations, extract the topology and then implement it in Cisco Packet Tracer.

First, let’s determine the main IP address and then make a sample application according to the desired subnet number.

The main IP address is 192.168.1.0/24, which refers to the 24 subnet masks you see here. The first subnet mask is therefore 3 octets filled with 1’s and 1 octet filled with 0's.

For example, I want to split this network into 4 subnets so I have to calculate the bits I will borrow in the subnet mask. For this, there is a formula called 2^m=subnet.

Replacing it, the number of bits I need is 2. If we take these two bits from the subnet mask, you will see that the two bits of the last octet are one. This is my new subnet mask. If we convert the subnet mask from binary to base decimal by using the places of one bits, 2⁷ +2⁶= 192. So my new subnet mask is 255.255.255.192.

I use the remaining 6 host bits to determine the number of IPs that will fall on each subnet. 2⁶-2=62 units. The reason we do minus 2 is that one of these IPs is for Subnet IP and the other is for broadcast IP.

The subnet table is created based on the calculated number of threads per network. The first subnet IP is 192.168.1.0, the last IP is 192.168.1.62 as you can see, and the next IP is broadcast IP. We can create the table by proceeding this way.

Then I created a topology. These are routers and these networks are subnet networks.

The figure below is an improved version of the topology. Here I gave the computers their IP addresses and the IP addresses that fall into the router interfaces.

While realizing the topology in the packet monitor, I connected a copper pass-thru between the computer switch and the router switch. And I connected serial DCE cable to establish a serial connection between the two routers. With the DCE cable (clocked red zigzag) the serial side of the first router will be DCE, and the serial side of the second router will be DTE. And DCE has to transmit the clock signal controlling the data rate, and the DTE receives the clock signal.

Then go to IP configuration and set the computer’s IP address, subnet mask and default gateway. The default gateways here are the IP addresses of the router interfaces facing the PCs. This is how the IP settings of all computers are made.

It’s time for the routers to connect. I come to the CLI section of the router and I activate it by typing “enable” in the command line that appears. I write “configure terminal” to put it in configuration mode. Then I write the interface I want to set. Then I set this interface by entering the IP and subnet mask and I activate the closed interface by typing “no shutdown”.

I also do this for the other interface, serial 2/0. I write the IP that I set for the serial connection and also adjust the clock speed since this interface is DCE.

As you can see, the opened link has turned green. The same should be done for Router 2.

When I tried to send a package after these operations were completed, I saw that the package was not gone, I got an error. The reason for this error is that the routers do not know the network to send the packet to.

That’s why I have to specify the network to go to the router, the subnet mask and which interface IP it should use to connect to the network. I provided these connections with the IP route command.

I did the same for router 2.

After doing these operations, the connection is completed.

## İmprovement

An improvement can be made to prevent excessive IP usage.

I calculated the new subnet masks depending on the number of hosts in the networks, using the reverse of my previous calculation.

And the subnet table is prepared with the newly calculated IP addresses.

All previous operations should be done for new IPs and subnet masks. This is the last version. And packet transfer also works without any problems.

See you in my next post.

## More from Sena Akbulut

Front End Developer