October 26, 2012

DHCP on Packet tracer through Server

We are going to apply DHCP on server and PCs will be assigned IP addresses through DHCP.
serv1
Open the server and go to the Desktop tab, click IP Configuration and enter the IP address.
2
Now, go to the Config tab.
3
And go to the DHCP
4
i. Enter IP for default Gateway.
ii. Start IP address
iii.. Maximum number of Users.
iv. Click Save.
6
Now, click on any PC that is attached to the server, go to IP configuration and select DHCP. You will see that DHCP will successfully assign IP address to the PC
7
Now, if we go back to server and assign DNS Server address and then go to any PC and select DHCP.
9 
It will also assign DNS to the PC as well.   
 10  
We can also open the website of the server through any PC by going to the Web Browser option and entering the IP address of the server.
11
And we can ping the server by going to the PC’s command prompt and entering server’s IP address.
12

October 22, 2012

DHCP on packet tracer

This tutorial is about how to configure dhcp on cisco router in packet tracer. The Dynamic Host Configuration Protocol (DHCP) is a network protocol that is used to configure network devices. DHCP allows a computer to join an IP-based network without having a pre-configured IP address. DHCP is a protocol that assigns unique IP addresses to devices, then releases and renews these addresses as devices leave and re-join the network. 
Internet Service Providers (ISPs) usually use DHCP to allow customers to join the Internet with minimum effort. The DHCP server maintains a database of available IP addresses and configuration information. When it receives a request from a client, the DHCP server determines the network to which the DHCP client is connected, and then allocates an IP address. DHCP servers typically grant IP addresses to clients only for a limited interval.

Lets apply DHCP on packet tracer.
First, let us make a topology with one router on which we will apply DHCP and several client PCs. More like this one,

Untitled

Now, we will apply DHCP on the router.
The commands in sequence are as follows.


cli actual

In the following command “ip dhcp pool cisco”, we are creating a  pool for DHCP called cisco. cisco is the name here and we can name it whatever we want.
Similarly, in the command “default-router “ we are telling the DHCP about the default route to follow.
Notice, after we exit from DHCP mode, we are excluding some IP addresses by applying this command “ip dhcp excluded-addresses x-x”, where x is the starting and ending IP address respectively. We are basically reserving some IPs for our use. It can be used to attach printers, or assign it to some specific users for security purposes. You can also give dns address in dhcp by using the following command.
dns-server 192.168.1.15.

Now, open the PC.

image

Click on IP Configuration

image

Select from Static to DHCP

image

And after DHCP request is completed you will see the following screen.

image

Now, after applying some IPs in sequence, DHCP will skip the IPs that we have excluded from our DHCP pool.

image

That is all, we have applied DHCP on packet tracer.



October 20, 2012

EIGRP on Packet Tracer

Hi everyone, today we are going to apply Enhanced Interior Gate Way Routing Protocol (EIGRP) on packet tracer.  Here are the basic set of commands that we can apply on router CLI mode in order to apply EIGRP on router.

clip_image002

Also, look at some additional commands.

clip_image002[7]

Now, we are going to apply EIGRP on the following topology.

eigrp diagram

Now, after successfully applying IP addresses like in this topology, we will apply following commands.
Router(config)#router eigrp 10
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.2.0
Router(config-router)#exit

Apply the above set of commands on both routers like this.

eigrp 1

And eigrp protocol has been applied on this topology. Notice the following command.
router eigrp 10
This number ‘10' is the process ID.







October 19, 2012

RIP Version 2 on Packet Tracer

There is no big difference between RIP version 1 and version 2 when we are applying them in packet tracer. In order to apply RIP version 2 on packet tracer. we will just have to add the following command. We will follow the same example that we used in RIP version 1 in this article.

rip

Router(config)# router rip
Router(config-router)# network 192.168.1.0
Router(config-router)# network 192.168.2.0
Router(config-router)# version 2
Router(config-router)#exit

You see there is just the addition of one statement i.e. “version 2”. The rest is the same. We will apply the above set of commands on both routers i.e. Router 3 and Router 2 ,used in the topology above which is also used in this article, above and bingo, we have applied RIP V2 on packet tracer.
Just make sure that the protocol is applied as an additional step and cannot replace the basic steps i.e. we have to assign IP addresses to the router’s interfaces and PCs and also change the state of the interfaces from down to UP like in this article and then we will go ahead and apply Protocol.


RIP on Packet Tracer

Main Commands
clip_image002
You need to advertise only the classful network number, not a subnet.
Explanation:
Lets apply RIP protocol on the following topology.


Now, we will follow the steps as mentioned in detail in the following article. i.e.
i. We will assign IP addresses to all the fast Ethernet and serial interfaces respectively.
ii We will change the state of the interfaces from down to UP.
Then, after we are done with the basic step. We will apply RIP protocol commands on both routers.

Configuration of Router 0 i.e. configuring both serial and fastethernet interfaces.


Configurations of R1


Assigning IP address to PC0


Assigning IP address to PC1





R1
In order to apply protocol RIP, we will write the following set of commands.

Router(config)# router rip
Router(config-router)# network 192.168.1.0
Router(config-router)# network 192.168.2.0
Router(config-router)# network 192.168.3.0
Router(config-router)#exit


R2:
In order to apply protocol RIP, we will write the following set of commands on R2 as well.

Router(config)# router rip
Router(config-router)# network 192.168.1.0
Router(config-router)# network 192.168.2.0
Router(config-router)# network 192.168.3.0
Router(config-router)#exit









Write all the commands in the same fashion as in the above screen shots and voila, we are done with RIP protocol. Another important thing here is that we will add all the networks that we are using in our topology. Here in this particular example i am just using two networks x.x.1.0 and x.x.2.0 so thats why i have added these two network addresses to the RIP protocol.

Now, you can check it. Traffic is enabled and you can easily send data from PC0 to PC1.





What is Packet Tracer

Packet Tracer is a powerful network simulator that can be utilized in training for CCNA and CCNP certification exam by allowing students to create networks with an almost unlimited number of devices and to experience troubleshooting without having to buy real Cisco routers or switches. The tool is created by Cisco Systems. The purpose of Packet Tracer is to offer students a tool to learn the principles of networking as well as develop Cisco technology specific skills. However, it is not be used as a replacement for Routers or Switches. 

Here how it looks like after we start it.

ptfirst

We are different modules and panels available in the packet tracer. Some important modules, which are important to understand for the working in Packet Tracer, are mentioned in the following diagram.

pt

Now, in order to create a topology, we will have to select some of the devices and put them in our main window i.e. the white portion of packet tracer. and here how it looks after we add the devices.

1

Now, we will have to connect these devices and for that we use cables. To understand the cables, please refer to my following article.

new

And after you successfully create the topology, you can check either the traffic is flowing or not by selecting the packet from right panel and putting it on both PCs as follows.

2pac

For detailed article on making the topology and successfully enabling the communication, read this article


Technorati Tags: What is packet tracer, pt activities,  how to work on packet tracer,  packet tracer tutorial, how packet tracer works,  packet tracer topology,  packet tracer networking,  networking in packet tracer

October 17, 2012

Communication between PCs in Packet Tracer

Here, we will see communication enabled between PCs via Router in Packet Tracer.
So, for this we need two PCs, a router ,and two cross over cables to connect them.
Important point is that we use cross over cable to connect PC to a router because they both use the same pins for transmission and receiving of data.

1

Now, we will connect them by selecting fast ethenet interfaces on both ends.
2
Similarly, on the PC side we will select fast Ethernet interface.
3
Now, we have connect the devices. Further, we will go to the router CLI mode and enter the following commands.
Step by step ,
we will have to do the following things.
i. Access the interfaces one by one
ii. Assign IP addresses to interfaces
iii. Change the status of the interfaces i.e. from Down to Up.
iv. Assign IP addresses to PCs.
v. Assign Default GateWay to PCs. FYI fast ethernet ip address is the gateway address to the PC. 
Now, commands of the Router CLI mode are as follows.
int
Now, we have accessed both interfaces one by one and we have assigned IP addresses respectively.
new
See the difference the lights have changed the color from Red to Green :)
Now, lets assign IP addresses to the PCs.
Click on PC1, go to Desktop, then click IP Configuration.
PC1:
pc1
PC2:
pc2
Now, our communication is enabled and we are able to communicate from PC1 to PC2 via Router.
Click on the packet in the right panel on the packet tracer, then click on PC1 and then click on PC2. You will see the successful packet tracer (status is shown in the bottom right corner)
packet
Select it and click on both PCs.
2pac

Bingo, your communication is successful.

Packet Tracer CLI

There are various common commands that one needs to be familiar with. These commands will be used all the time.

There are different modes. All modes have their own distinct commands.

clip_image002

 

All the configuration commands will be written in configuration mode.

Using the tab Key to Complete Commands

When you are entering a command, you can use the tab key to complete the command. Enter the first few characters of a command and press the tab key. If the characters are unique to the command, the rest of the command is entered in for you. This is helpful if you are unsure about the spelling of a command. For example, if we write in enable mode, “sh” and press tab button, “show” command will be written on the CLI mode.

clip_image002[6]

Router Modes

clip_image002[16]

clip_image004

TIP: There are other modes than these. Not all commands work in all modes. Be

careful. If you type in a command that you know is correct—show running-config, for example—and you get an error, make sure that you are in the correct mode.

Entering Global Configuration Mode

clip_image006

Configuring a Router Name

This command works on both routers and switches.

clip_image002[18]

Configuring Passwords

These commands work on both routers and switches.

clip_image004[5]

Here it is important to know that the enable secret password is encrypted by default. The enable password is not. For this reason, recommended practice is that you never use the enable password command. Use only the enable secret password command in a router or switch configuration. You cannot set both enable secret password and enable password to the same password. By doing so, it defeats the use of encryption.

Show Commands:

There are various show commands. in order to get familiar with these commands just write “show ?” in the enable mode.

show

Similarly, there are various commands that shows us the configurations that we have done on our router or any other device depending on the device we are working on. We will talk about later on.

Similarly, there are various commands in the configuration mode which we attain by entering the following command

Router# configure terminal.

Look at the following diagram.

basic

 

Ok, so now lot of things are happening here. Red markers explain them, also we are setting the hostname of the router and we have successfully applied the password by the following command.

enable password cisco

Here, “cisco” is the password.

 

Similarly, the command

router#show ip interface brief

gives us the information about the interfaces of the router. Now, detail discussion on the interfaces will be done later.

Networking Cables and Connections

In order for the communication to take place, cables play important role. Cable is the medium through which information usually moves from one network device to another. There are several types of cable which are commonly used with LANs. The type of cable chosen for a network is related to the network's topology, protocol, and size.
There are various types of cables used in networks as follows.
  • Unshielded Twisted Pair (UTP) Cable
  • Shielded Twisted Pair (STP) Cable
  • Coaxial Cable
  • Fiber Optic Cable

Twisted Pair Cables:
Twisted pair cabling is a type of wiring in which two conductors of a single circuit are twisted together for the purposes of canceling out electromagnetic interference (EMI) from external sources; for instance, electromagnetic radiation from unshielded twisted pair (UTP) cables, and crosstalk between neighboring pairs. In balanced pair operation, the two wires carry equal and opposite signals and the destination detects the difference between the two. This is known as differential mode transmission. Noise sources introduce signals into the wires by coupling of electric or magnetic fields and tend to couple to both wires equally. The noise thus produces a common-mode signal which is cancelled at the receiver when the difference signal is taken.

Categories Of UTP Cable:
It has been categorized into three categories based on the equipment that are being connected through these wires.
i. Straight Through Cable
ii. Cross Over Cable
iii. Roll Over Cable

Explanation:

Straight Through Cable:
Straight through cables are used to connect different devices like Switch to PC. Switch to Router. Router to Switch etc. Straight-through cables are used when each end of the communication transmits and receives on different pairs.

Cross Over Cable:
In a cross over the cable, the send and receive wires are "crossed over", meaning the wires are opposite on each end. This allows two PCs to talk to each other, has it connects the send of one computer to the receive of the other. Hence, the cross over cables are used to connect similar devices like PC to PC , Router to Router, Switch to Switch, Hub to Hub etc.

Roll Over Cable:
Roll over cables are used to connect to the console port of the device. It gets the name rollover because the pin outs on one end are reversed from the other, as if the wire had been rolled over and you were viewing it from the other side.

Transmission Pins:
Devices that transmit on 1,2 and receive on 3,6
1) PC
2)Router
3)Wireless Access Point AP
4) Networked printers
Devices that transmit on 3,6 and receive on 1,2
1)switch
2)bridge
3)hub

image

Required Equipment:
In order to make a network cable you need the following equipment.
i. Cat5, Cat5e cable.

CAT5 cable usually contains four pairs of copper wire, Fast Ethernet communications only utilize two pairs. A newer specification for CAT5 cable -CAT5 enhanced ("CAT5e" or "CAT 5e")- supports networking at Gigabit Ethernet[ speeds (up to 1000 Mbps) over short distances by utilizing all four wire pairs, and it is backward-compatible with ordinary CAT5.

ii. A connector named RJ-45.

RJ45 connectors feature eight pins to which the wire strands of a cable interface electrically. Standard RJ-45 pin outs define the arrangement of the individual wires needed when attaching connectors to a cable.

iii. Crimping tool:

Use to crimp the cable inside RJ 45 connector. 

iv. Wire stripper or Knife:

You can use a knife too to cut the wire open. In order to make different combinations of it. we will have to cut the upper protective coating and bring out the eight wires. 

Category Speed Use
1 1 Mbps Voice Only (Telephone Wire)
2 4 Mbps LocalTalk & Telephone (Rarely used)
3 16 Mbps 10BaseT Ethernet
4 20 Mbps Token Ring (Rarely used)
5 100 Mbps (2 pair) 100BaseT Ethernet
5e 1,000 Mbps Gigabit Ethernet
6 10,000 Mbps Gigabit Ethernet


Auto-MDIX:
Auto-MDIX (automatic medium-dependent interface crossover) is a computer networking technology that automatically detects the required cable connection type (straight-through or crossover) and configures the connection appropriately, thereby removing the need for crossover cables to interconnect switches or connecting PCs peer-to-peer. When it is enabled, either type of cable can be used and the interface automatically corrects any incorrect cabling. For Auto-MDIX to operate correctly, the speed on the interface and duplex setting must be set to "auto".

October 3, 2012

OSPF on Packet Tracer

Apply OSPF Routing Protocol on the following protocol.

OSPF MANUAL

Follow the instructions given on the manual step by step. 

October 1, 2012

List Data Structure


The List data structure is among the most generic of data structures. In daily life, we use shopping list, groceries list, list of people to invite to a dinner, list of presents to give etc. In this tutorial, we will see how we use lists in programming.

A list is the collection of items of the same type (grocery items, integers, names, books etc). The data in arrays are also of same type. When we say an array of x[10]; it means that only the integers can be stored in it. The same is true for list. The data which we store in list should be of same nature. The items, or elements of the list, are stored in some particular order. What does this mean? Suppose in the list, you have the fruit first which are also in some order. You may have names in some alphabetical order i.e. the names which starts with A should come first followed by the name starting with B and so on. The order will be reserved when you enter data in the list like a dictionary. We have all the elements in the alphabetical order in dictionary.  

It is possible to insert new elements at various positions in the list and remove any element of the list. 
List is a set of elements in a linear order. Suppose we have four names a1, a2, a3, a4 and their order is as (a3, a1, a2, a4) i.e. a3, is the first element, a1 is the second element, and so on. We want to maintain that order in the list when data is stored in the list. We don’t want to disturb this order. The order is important here; this is not just a random collection of elements but an ordered one. Sometimes, this order is due to sorting i.e. the things that start with A come first. At occasions, the order may be due to the importance of the data items. We will discuss this in detail while dealing with the examples.

Now we will see what kind of operations a programmer performs with a list data structure. Following long list of operations may help you understand the things in a comprehensive manner.

Operation Name
Description
createList()
Create a new list (presumably empty)
copy()
Set one list to be a copy of another
clear();
Clear a list (remove all elements)
insert(X, ?)
Insert element X at a particular position in the list
remove(?)
Remove element at some position in the list
get(?)
Get element at a given position
update(X, ?)
Replace the element at a given position with X
find(X)
Determine if the element X is in the list
length()
Returns the length of the list.

Details of Functions

createList() is a function which  creates a new list. For example to create an array, we use int x[10] or int* y = new int[10]; we need similar functionality in lists too. The copy() function will create a copy of a list. The function clear() will remove all the elements from a list. We want to insert a new element in the list, we also have to tell where to put it in the list. For this purpose insert(X, position) function is used. Similarly the function remove(position) will remove the element at position. To get an element from the list get(position) function is used which will return the element at position. To replace an element in the list at some position the function update(X, position) is used. The function find(X) will search X in the list. The function length() tells us about the number of elements in the list.

We need to know what is meant by “particular position” we have used “?” for this in the above table. There are two possibilities:

  • Use the actual index of element: i.e. insert it after element 3, get element number 6. This approach is used with arrays
  • Use a “current” marker or pointer to refer to a particular position in the list.

The first option is used in the data structures like arrays. When we have to manipulate the arrays, we use index like x[3], x[6]. In the second option we do not use first, second etc for position but say wherever is the current pointer. Just think of a pointer in the list that we can move forward or backward. When we say get, insert or update while using the current pointer, it means that wherever is the current pointer, get data from that position, insert data after that position or update the data at that position. In this case, we need not to use numbers. But it is our responsibility that current pointer is used in a proper way.


Arrays



Arrays are data structure in which identical data types are stored. The arrays occupy the memory depending upon their size and have contiguous area of memory. We can access the arrays using the array index.


To declare arrays, we have to give their data type, name and size. These are fixed-size arrays. The declaration of arrays is as follows:

data_type    array_name [size] ;


Consider the following program:

void main(  )
{          
int x[6]; 
        int j;

    for(j = 0; j < 6; j++) 
        {

         x[j] = 2 * j;
        }
    }

We have declared an int array of six elements and initialized it in the loop.

Let’s revise some of the array concepts. The declaration of array is as int x[6]; or float x[6]; or double x[6]; You have already done these in your programming assignments. An array is collection of cells of the same type. In the above program, we have array x of type int of six elements. We can only store integers in this array. We cannot put int in first location, float in second location and double in third location. What is x? x is a name of collection of items. Its individual items are numbered from zero to one less than array size. To access a cell, use the array name and an index as under:

           x[0], x[1], x[2], x[3], x[4], x[5]

To manipulate the first element, we will use the index zero as x[0] and so on. 
Array occupies contiguous memory area in the computer. In case of the above example, if some location is assigned to x[0], the next location can not contain data other than x[1]. The computer memory can be thought of as an array. It is a very big array. Suppose a computer has memory of 2MB, you can think it as an array of size 2 million and the size of each item is 32 bits. You will study in detail about it in the computer organization, and Assembly language courses. In this array, we will put our programs, data and other things.

In the above program, we have declared an array named x. ‘x’ is an array’s name but there is no variable x. ‘x’ is not an lvalue

If some variable can be written on the left- hand side of an assignment statement, this is lvalue variable. It means it has some memory associated with it and some value can be assigned to it. For example, if we have the code  
          int a, b; 

It can be written as b = 2;
It means that put 2 in the memory location named b. We can also write as a = b; it means whatever b has assign it to a, that is a copy operation. If we write as a = 5; it means put the number 5 in the memory location which is named as a. But we cannot write 2 = a; that is to put at number 2 what ever the value of a is. Why can’t we do that? Number 2 is a constant. If we allow assignment to constants what will happen? Suppose ‘a’ has the value number 3. Now we assigned number 2 the number 3 i.e. all the number 2 will become number 3 and the result of 2 + 2 will become 6. Therefore it is not allowed.

x’ is a name of array and  not an lvalue. So it cannot be used on the left hand side in an assignment statement. Consider the following statements

int x[6];   
int n;
x[0] = 5;   x[1] = 2;
x = 3;                                // not allowed
x = a + b;                            // not allowed
x = &n;                           // not allowed

In the above code snippet, we have declared an array x of int. Now we can assign values to the elements of x as x[0] = 5 or x[1] = 2 and so on. The last three statements are not allowed. What does the statement x = 3; mean? As x is a name of array and this statement is not clear, what we are trying to do here? Are we trying to assign 3 to each element of the array? This statement is not clear. Resultantly, it can not be allowed. The statement x = a + b is also not allowed. There is nothing wrong with a + b. But we cannot assign the sum of values of a and b to x. In the statement x = &n, we are trying to assign the memory address of n to x which is not allowed. The reason is the name x is not lvalue and we cannot assign any value to it. For understanding purposes, consider x as a constant. Its name or memory location can not be changed. This is a collective name for six locations. We can access these locations as x[0], x[1] up to x[5]. This is the way arrays are manipulated.

Sometimes, you would like to use an array data structure but may lack the information about the size of the array at compile time. Take the example of telephone directory. You have to store one lakh (100,000) names in an array. But you never know that the  number of  entries may get double or decline in future. Similarly, you cannot say that the total population of the country is one crore (10 million) and declare an array of one crore names. You can use one lakh locations now and remaining will be used as the need arrives. But this is not a good way of using the computer resources. You have declared a very big array while using a very small chunk of it. Thus the remaining space goes waste which can, otherwise, be used by some other programs. 

Suppose you need an integer array of size n after the execution of the program. We have studied that if it is known at the execution of the program that an array of size 20 or 30 is needed, it is allocated dynamically. The programming statement is as follows:

            int*  y = new int[20]; 

It means we are requesting computer to find twenty memory locations. On finding it, the computer will give the address of first location to the programmer which will be stored in   y. Arrays locations are contiguous i.e. these are adjacent. These twenty locations will be contiguous, meaning that they will be neighbours to each other. Now y has become an array and we can say y[0] =1 or y[5] = 15. Here y is an lvalue. Being a pointer, it is a variable where we can store the address of some variable. 

When we said , int* y = new int[20];  

The new returns the memory address of first of the twenty locations and we store that address into y. As y is a pointer variable so it can be used on the left-hand side. We can write it as:

            y = &x[0];      

In the above statement, we get the address of the first location of the array x and store it in y. As y is lvalue, so it can be used on left hand side. This means that the above statement is correct.

            y = x;

Similarly, the statement y = x is also correct. x is an array of six elements that holds the address of the first element. But we cannot change this address. However we can get that address and store it in some other variable. As y is a pointer variable and lvalue so the above operation is legal. We have dynamically allocated the memory for the array. This memory, after the use, can be released so that other programs can use it. We can use the delete keyword to release the memory. The syntax is:

            delete[ ] y;

We are releasing the memory, making it available for use by other programs. We will not do it in case of x array, as ‘new’ was not used for its creation. So it is not our responsibility to delete x

C program to Read From a File

#include <stdio.h> #include <stdlib.h> void main() {     FILE *fptr;     char filename[15];     char ch;   ...