Wednesday, December 19, 2012

Understanding IP Address Configuration

In this post, I would like to start from the basics of a network up to creating a simple network in packet tracer and assigning IP address to each of its hosts. Before going in detail know the little words of networks that you hear always.

What is a Host in networking?


network host is a computer connected to a computer network. A network host may offer information resources, services, and applications to users or other nodes on the network. So, simply call a PC in a network as a Host.

What is an IP Address ?


Every Machine on a network has a unique identifier just as you would have an address to let the world identify the place you live. People may find their locations in the world using their address so as the computers use the unique identifier to send data to specific computers on a network. 



Most networks today, including all computers on the Internet, use the TCP/IP protocol as the standard for how to communicate on the network. In the TCP/IP protocol, the unique identifier for a computer is called its IP address.



There are two standards for IP addresses: IP Version 4 (IPv4) and IP Version 6 (IPv6). All computers with IP addresses have an IPv4 address, and many are starting to use the new IPv6 address system as well. 

Now, you may be eager to know what these two types of IP addresses are used for and how. are they same or different? of course they are different.

IPV4 :- 

This uses 32 binary bits to create a single unique address on the network. An IPV4 address is expressed by four numbers separated by dots. Each number is the decimal (base-10) representation for an eight-digit binary (base -2) number, also called an octet. E.g:- 172.16.2.5

IPV6:-

This uses 128 binary bits to create a single unique address on the network. An IPv6 address is expressed by eight groups of hexadecimal (base-16) numbers separated by colons. 
E.g :- 2001:cdba:0000:0000:0000:0000:3257:9652

Groups of numbers that contain all zeros are often omitted to save space, leaving a colon separator to mark the gap (as in 2001:cdba::3257:9652)

There are lot more to learn about IP addresses and its versions. But for the moment, I think that desciption gave you a brief idea. Assume that throughout these posts we will be discussing only about the IPV4 addresses.

Now let's focus on the three groups of IP addresses along with their address ranges used in IP Address configuration .

The three classes are called as ClassA, ClassB and ClassC. We can easily identify the class given an IP Address by examining the first digit of it. for an example, you will realize 10.5.26.6 is a ClassA IP address. 

For the simplicity, let me explain the classes and ranges in the form of a table as below. also know that,

IP Address= Network ID + Host ID




N- stands for Network ID
H- stands for Host ID

so, according to the above table, if you have given an IP Address (IPV4), just look at the first digit and determine to which range it falls out of 0- 127 , 128-191,192-223. that will give you its group whether its A or B or C. 


Next point is , depending on the class you have to identify an IP address's network ID and subnet mask. yo may think what a network ID is. It's simple, network IDs are common for all nodes that are in the same network. for an example, think LAN-A's network ID is 10.0.0.0. This is common for all the PC in LAN-A. But another network should not have an already existing network ID


if it is class A :- get only the first digit and add three more zeros as the next digits to form the network ID

if it is class B :- get only the first two digits and add two more zeros as the next digits to form the network ID


if it is class C :- get the first three digits and add one more zeros as the next digit to form the network ID

Now your question is what is subnet mask, isn't it ?


Up to now you know that an IP address has two components, the network ID and the host ID. A subnet mask separates the IP address into the network and host addresses (<network><host>). Subnetting further divides the host part of an IP address into a subnet and host address (<network><subnet><host>). It is called a subnet mask because it is used to identify network address of an IP Address by performing bitwise AND operation on the netmask.


A Subnet mask is a 32-bit number that masks an IP address, and divides the IP address into network address and host address. Subnet Mask is made by setting network bits to all "1"s and setting host bits to all "0"s. Within a given network, two host addresses are reserved for special purpose. The "0" address is assigned a network address and "255" is assigned to a broadcast address, and they cannot be assigned to a host.

Hope, now you understand the above table very easily.


So, shall we create a simple network in packet tracer and assign IP addresses according to the concepts we learned?



Creating a simple network in CISCO packet tracer

Drag and drop two routers (1841), four Pcs (end-devices--> Generic) and two switches (Switch- PT) to the working area as shown in the image below.


Now, it's time to connect the nodes of the host and create the networks. 

connecting two routers

You have to use Serial-DCE connections to connect two routers. but keep in mind that routers do not come with serial ports by default. you have to add serial ports to both the above routers before connecting them. Please refer the previous post to check out how to add a serial port to a router.

once, you have the routers ready with serial ports, jst click on Connections -->click on Serial-DCE ( the read Z icon with a small clock) and click on Router0 and drop on Router1. when you click on a router, a small menu will show you all the available ports of the router. select the Serial 0/0/0 (which is the serial port that we have just added)

connecting PCs to switch

This is really simple because you just have to use the Copper-Straight-Through cables to make this connection. this switch contains six ports altogether named as Fast Ethernet 0/1 to Fast Ethernet 0/5 and you can connect a PC to one of its ports. once you connect a PC to one of the ports available in the switch where next time you try to connect another PC to the same switch, the previous port wont visible as available to you.

first click on the Connections -->click on Copper-Straight-Through --> click on PC-0 -->select Fast Ethernet --> click on Switch-0 --> select Fast Ethernet 0/1 

again click on the Connections -->click on Copper-Straight-Through --> click on PC-1 -->select Fast Ethernet --> click on Switch-0 --> select Fast Ethernet 1/1 

follow the steps and connect PC-2 and PC-3 with Switch-1

connecting switch to Roter

This is similar as connecting PCs with switches. you have to deal with Fast Ethernet ports of both the router and the switches and use Copper-Straight_through cables same as above.

once you make the connections, your system should look like below















You also need to identify the LANs( Local Area Networks) and the WANs(Wide Area Network) here. It's simple. wherever you see routers connected to each other, you can call them a WAN and PCs and switches connected to routers are called as LANs. So, according to the below diagram, you can see two LAN's and a WAN in our simple network.




















How to plan IP address for the network?


Before assigning, just remember the concepts once again. LAN1 is one network thus it needs to have a common network ID for PC-0 and PC1. Let's consider LAN1's network ID as 192.168.10.0 and LAN2's network ID as 192.168.11.0. Therefore, the PC's can hold IP addresses as below. note that we have taken the GroupC addresses since they are cheapest than other two groups of addresses.

PC-0 :-192.168.10.5
PC-1 :-192.168.10.6
Router0's Fast Ethernet 0/0 ( the port in LAN1's side) also needs to have an address like 192.168.10.1

PC-2 :-192.168.11.5
PC-3 :-192.168.11.6
Router1's Fast Ethernet 0/0 ( the port in LAN2's side) also needs to have an address like 192.168.11.1

Now, the WAN consist of two routers and they need to have IP addresses which falls into the same network address. We'll consider their network ID as 10.0.0.0 (groupA), then the serial ports can hold IP addresses as below

Router0' Serial0/0/0 :- 10.1.0.1
Router1' Serial0/0/0 :- 10.1.0.2



How to assign IP address for the network in packet tracer?


Click on the PC-0 ->select Desktop tab->select IP configuration-> give IP address, Sub net mask and the default gateway as below.


 No wonder if you asked me the question of what a default gateway is. It is the IP address of a router's fast Ethernet port from where it is connected to the specific PC. In this case, PC-0 is connected to Router-0 from the fast Ethernet port of IP address 198.168.10.1.  

Follow the similar steps for all the PCs in the network and assign them the planned IP addresses.

 How to set IP address to a Router’s fast Ethernet port?

First we'll see how to assign IP address to the fast Ethernet port of Router-0


  1. Click on Router-0
  2. select CLI tab 
  3. if it prompts as "Continue with configuration dialog? [yes/no]: "   enter no and press Enter key 
  4. type enable and press Enter to go to the privileged mode
  5. type config t to go to the configuration mode
  6. type interface fastEthernet 0/0 and press Enter
  7. type ip address <IP address of that port> <Subnet mask of that port> and press Enter
  8. type no shutdown and press Enter

refer the following CLI commands for clarification

Router>enable
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 192.168.10.1 255.255.255.0
Router(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#

points to consider...

  • first note that you must be in the configuration mode to assign IP address to a router.
  • once you are in the configuration mode, you can have access to all the ports available for the router by typing the port number first (else there will be confusion to identify to which of the ports you are trying to assign the IP address out of the fastEthernet0/0 and Serial0/0/0 of Router-0)
  • once you type the port number, you will go inside that port where now you can assign the IP address
  • also note that if you are inside a specific fastEthernet port, the CLI mode will chnge from Router(config)# to Router(config-if)#
  • you have to assign the IP address and leave a space and then type the subnet mask too
  • after assigning the IP address, typing no shutdown is important to keep the port open
once you are done exit both the modes and close the CLI of Router-0 and ollow the same steps for Router-1 as wells

How to set IP address to a Router’s Serial port?

First we'll see how to assign IP address to the Serial port0/0/0 of Router-0
  1. Click on Router-0
  2. select CLI tab 
  3. if it prompts as "Continue with configuration dialog? [yes/no]: "   enter no and press Enter key 
  4. type enable and press Enter to go to the privileged mode
  5. type config t to go to the configuration mode
  6. type interface Serial 0/0/0 and press Enter
  7. type ip address <IP address of that port> <Subnet mask of that port> and press Enter
  8. type clock rate 64000 [Only need to set clock rate for the DCE (since Router0 behaves as DCE)shows the clock in Router -0 's side when sent the mouse over the cable]
  9. type no shutdown and press Enter [since routers are in shutdown status by default
refer the following CLI commands for clarification

Router>
Router>enable
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface serial0/0/0
Router(config-if)#ip address 10.1.0.1 255.0.0.0
Router(config-if)#clock rate 64000
Router(config-if)#no shutdown 

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
Router(config-if)#

follow the same steps to assign IP address to Router-1 as well and complete the IP configuration of the network. Also note that if you have assigned IP addresses for all the ports correctly, all of the blubs near the two ends of each connection must blink in green (not in red) as shown in the below image.