You are on page 1of 26

Electronics & Communication Department

Lab Manual

Data Communication & Networking

B. E. SEMESTER-VIII

Enrollment Number: ________________________ Name of the Student: _____________________________________________ Academic Year: __________________

List of Experiments
1 2 3 4 5 6 7 8 9 10 11 Introduction to LAN cabling scheme & crimping process Study of Network planning and setup (e.g. - GEC-Rajkot) Study of Network commands Introduction to RS 232C & UART To perform byte transfer between 2 PCs using serial port (using ‘C’ code) To perform simple file transfer between 2 PCs using serial port (using ‘C’ code) To perform character stuffing & de-stuffing Demonstration of Linux OS installation and network utilities Study of Internetworking devices – Network Hardware Study of IP addressing and subnetting Network Simulator- ‘ns-2’: Installation, Programming & Simulation demo

EXPERIMENT 1 Introduction to LAN cabling scheme & crimping process Pin out for EIA/TIA 568A/B cabling Pin 1 2 3 4 5 6 7 8 Signal Transmit + Transmit Receive + N/A N/A Receive N/A N/A EIA/TIA 568A White/Green Green/White or Green White/Orange Blue/White or Blue White/Blue Orange/White or Orange White/Brown EIA/TIA 568B White/Orange Orange/White or Orange White/Green Blue/White or Blue White/Blue Green/White or Green White/Brown Ethernet X X X Not Used Not Used X Not Used Not Used Brown/White or Brown/White or Brown Brown Wiring/Color Coding for CAT5 Cable .

RJ-45 Connector "Pin-Outs" TUTORIAL Questions 1) What are hubs and repeaters? 2) How many types of LED indicators are there at back panel of a Hub? What is their significance? 3) What is the need of an uplink feature in a Hub? 4) What is an NIC card? 5) What is maximum length that category 5 up cable support? 6) What is the difference between a router and a repeater or a bridge? 7) There are how many types of connecting devices? 8) In which layer/layers does the repeater function? 9) In which layer/layers does the router function? 10) What do you mean by 10BASE5? 11) What is the meaning of ‘T’ in 10BASE-T? 12) What is a crossover cable? 13) What is power consumption for DE 816TP hub? 14) What is the function of Collision LED? .

EXPERIMENT 2 Study of Network planning and setup (e.GEC-Rajkot) .g. .

. Procedure:  First go to command prompt  For help and information about this command type tracert /?  Type tracert IP address or name of the destination. TRACERT command is useful to trace the route through which packet passes.42: bytes=32 time<10ms TTL=127 Reply from 192.42: bytes=32 time<10ms TTL=127 To test different network utilities like ping. arp. ftp To study and use different options for these utilities (2) TRACERT: When one system (host or router) send the packet of data to another system then there be two possibilities.11.11.11.168. tracert. First of all we have to check for destination system is reachable or not.42 with 32 bytes of data: Reply from 192.168.168. ipconfig.11.11. Packet directly reach to destination system or it pass through one or more routers.168.42: bytes=32 time<10ms TTL=127 Reply from 192.EXPERIMENT 3 Study of Network commands Objectives   Concepts (1) PING (Packet Internet Groper Command) If any system (host or router) want to communicate with the other system (host or route) then it is necessary to check the communication is possible or not? For this.42 Pinging 192.11. Due to hardware failure or any other reason it is possible the system may on network but not reachable.168.168.42: bytes=32 time<10ms TTL=127 Reply from 192. How can we detect that the destination system is reachable or not? PING command is useful for checking the reach ability of the system. Procedure:  First go to command prompt  For help and information about this command type ping /?  Type ping IP address of system Example: C:\ >ping 192.

Example: C:\>tracert 192.41] Trace complete.255.2] 2 <10 ms <10 ms <10 ms EC9-41 [192.168.168. . . . (3) IPCONFIG: When System is in network at that time it is necessary to know the IP address of that system.11. . Procedure:  First go to command prompt  For help and information about this command type arp /?  Type arp –a. . subnet mask and gateway address IPCONFIG command is used. . We can also get the dynamic ARP table. : 255. . . . .168. . . .41] over a maximum of 30 hops: 1 <10 ms <10 ms <10 ms VPN [192. . ARP is used to resolve Physical address from the IP address. .11.255.168. : 192. .11. . : 192. Procedure:  First go to command prompt  For help and information about this command type ipconfig /?  Type ipconfig. so it is sometimes necessary to resolve Physical address from IP address or vice-versa. . . . . . . . . .41 Tracing route to EC9-41 [192.2 (4) ARP (Address Resolution Protocol): Any system on the network is identified by Physical address and IP address.11. . Example: C:\>ipconfig Windows 2000 IP Configuration Ethernet adapter LAN: Connection-specific DNS Suffix .11. . : IP Address.11. .168.168. .224 Default Gateway .7 Subnet Mask .

class B.168.21 00-11-5b-d2-51-c4 dynamic TUTORIAL Questions (1) Which protocol is used in PING command? (2) Explain briefly about each field received in reply while using PING command.7 on Interface 0x1000003 Internet Address Physical Address Type 192. (13) Which information we get from subnet mask? (14) Write subnet mask for class A.168.11.11.2 00-80-ad-83-02-82 dynamic 192. (8) Which protocol is used in TRACERT command? (9) If more than one router in the route than first reply comes from which router while using TRACERT? (10) If final destination is not reachable than how many reply comes while using TRACERT command? (11) Explain briefly about each field in an ARP table.168. (15) If one router on the path to reach the final destination How can we find the IP addresses of the two interfaces of the router? .11. (3) Is it possible to find IP address of the system on which you are working using PING command? (4) Which kind of ICMP messages used in PING command? (5) What is maximum size of a packet practically? Prove it using PING command? (6) State the minimum number of hop count is requiring for checking reach ability of host? (7) Which message will display while hop count is less than the number of routers on the path.1 00-50-af-0a-5b-80 dynamic 192.168.168. class C and class D addresses. (12) Explain briefly about each field displayed while running ipconfig command.20 00-80-ad-83-4d-35 dynamic 192.11.Example: C:\>arp -a Interface: 192.11.

any device you connect to the serial port will need the serial transmission converted back to parallel so that it can be used. You don't need as many wires then parallel transmission. (byte transfer). (SPP) What are the advantages of using serial data transfer rather than parallel?     Serial Cables can be longer than Parallel cables. These are DCE (Data Communications Equipment) and DTE (Data Terminal Equipment. Serial transmission is used where one bit is sent at a time. TA adapter. Therefore cable loss is not as much of a problem for serial cables then they are for parallel. laptops and palmtops. On software side. If your device needs to be mounted a far distance away from the computer then 3 core cable (Null Modem Configuration) is going to be cheaper that running 19 or 25 core cable.  To implement byte transfer using ALP. plotter etc while Data Terminal Equipment is your Computer or Terminal .) Data Communications Equipments are devices such as your modem. However you must take into account the cost of the interfacing at each end. Many electronic diaries and palmtop computers have infra red capabilities build in. Serial Communication reduces the pin count of Microcontrollers.  To study RS232-C cabling scheme. The pulse length however was cut down to 3/16th of an RS 232 bit length to conserve power considering these devices are mainly used on diaries. Transmit Data (TXD) and Receive Data (RXD) compared with at least 8 pins if you use an 8 bit Parallel method (You may also require a Strobe). [B]  To verify serial port communication between two PCs by writing simple C code. Concept In most cases. IrDA-1 (The first infra red specifications) was capable of 115.EXPERIMENT 4 Introduction to RS 232C & UART Objectives [A]  To understand RS232-C standard and UART functions. This can be done using a UART. there are many more registers that you have to attend to than on a Standard Parallel Port. Therefore the serial port can have a maximum swing of 50V compared to the parallel port which has a maximum swing of 5 Volts.2k baud and was interfaced into a UART. Only two pins are commonly used.  To test RS232-C cable using Windows inbuilt utility. The serial port transmits a '1' as -3 to -25 volts and a '0' as +3 to +25 volts where as a parallel port transmits a '0' as 0v and a '1' as 5v. Hardware Properties Devices which use serial cables for their communication are split into two categories.

Goes active when modem detects a ringing signal from the PSTN. This tells the UART that the modem is ready to establish a link. An open circuit voltage should never exceed 25 volts.000 BPS. 4. This line informs the Modem that the UART is ready to exchange data. (Take note of this one!) The RS 232 C standard specifies a maximum baud rate of 20. Serial Pin outs (D25 and D9 Connectors) D-Type-25 Pin No. This is the opposite of DSR. thus you will require a female connector on your device. The driver should be able to handle this without damage. A short circuit current should not exceed 500mA. this Line becomes active. Serial Ports come in two "sizes". There are the D-Type 25 pin connector and the D-Type 9 pin connector both of which are male on the back of the PC. 3. It states many parameters such as – 1.The electrical specifications of the serial port are contained in the RS232C standard. 2. Below is a table of pin connections for the 9 pin and 25 pin D-Type connectors. Abbreviation TD RD RTS CTS DSR SG CD DTR RI Full Name Transmit Data Receive Data Request To Send Clear To Send Data Set Ready Signal Ground Carrier Detect Data Terminal Ready Ring Indicator DSR DTR RTS RI Data Set Ready Data Terminal Ready Request To Send Ring Indicator . A "Space" (logic 0) will be between +3 and +25 Volts. This tells the Modem that the UART is ready to link. (In Reference to GND) 5. When the modem detects a "Carrier" from the modem at the other end of the phone line. Pin 2 Pin 3 Pin 3 Pin 2 Pin 4 Pin 7 Pin 5 Pin 8 Pin 6 Pin 6 Pin 7 Pin 5 Pin 8 Pin 1 Pin 20 Pin 4 Pin 22 Pin 9 Pin Functions Abbreviation TD RD CTS DCD Full Name Transmit Data Receive Data Clear to Send Data Carrier Detect Function Serial Data Output (TXD) Serial Data Input (RXD) This line indicates that the Modem is ready to exchange data. A "Mark" (Logic 1) will be between -3 and -25 Volts The region between +3 and -3 volts is undefined. D-Type-9 Pin No.

For these programs you require a differently wired Loop Back plug which may vary from program to program. anything you type will be immediately displayed on the screen. Please note that this is not intended for use with Diagnostic Programs and thus will probably not work. Loopback Plug Wiring Diagram . This can be used with the examples later in this tutorial. It has the receive and transmit lines connected together. so that anything transmitted out of the Serial Port is immediately received by the same port.. 9D to 25D Conversion This Loopback plug can come in extremely handy when writing Serial / RS232 Communications Programs.Null Modems A Null Modem is used to connect two DTE's together without using intermediate DCEs. If you connect this to a Serial Port a load a Terminal Program.

All the UARTs pins are TTL compatible. RD. Each address will take up 2 bytes.432 MHZ Crystal. Just like the LPT ports. DTR and RTS which all interface into your serial plug. 16650. Start Address Function 0000:0400 COM1's Base Address 0000:0402 COM2's Base Address 0000:0404 COM3's Base Address 0000:0406 COM4's Base Address COM Port Addresses in the BIOS Data Area. This clock will be used for the Programmable Baud Rate Generator which directly interfaces into the transmit timing circuits but not directly into the receiver timing circuits.) Note that the clock signal will be at Baud rate * 16. the base addresses for the COM ports can be read from the BIOS Data Area. . These should work for most PC's. which includes the 16450. That includes TD. 16550. Serial Port's Registers (PC's) Port Addresses & Iraq’s Name COM 1 COM 2 COM 3 COM 4 Address 3F8 2F8 3E8 2E8 IRQ 4 3 4 3 Above is the standard port addresses. If you look at your serial card a common crystal found is either a 1. games port. RI. then expect a different set of addresses and IRQ's. CTS. The above table shows the address at which we can find the Communications (COM) ports addresses in the BIOS Data Area. DCD. The UART requires a Clock to run. typically a D-type connector. If you just happen to be lucky enough to own a IBM P/S2 which has a micro-channel bus. Therefore RS 232 Level Converters are used.8432 MHZ or an 18. & 16750 UARTS are the most commonly found type in your PC. Most cards will have the UART's integrated into other chips which may also control your parallel port.The UART (8250 and Compatibles) UART stands for Universal Asynchronous Receiver / Transmitter. floppy or hard disk drives and are typically surface mount devices. The 8250 series. UART 8250 is the device that controls the serial port. DSR. For this an external connection mast be made from pin 15 (Baud Out) to pin 9 (Receiver clock in.

until no more bytes are present. THR. even parity . This bit will change to zero if no more bytes are present. DLL. LSR. only one character can be stored. IER. The transmitter holding register is not used to transfer the data directly. Each register is eight bits wide. LCR. The byte is first transferred to a shift register where the information is broken in single bits which are sent one by one. Parity and number of data bits can be changed for example.Registers RBR. Bit 5 in the line status register can be used to check if new information must be written to the transmitter holding register. Common settings are: 8 data bits. THR: Transmitter holding register (WO) The transmitter holding register is used to buffer outgoing characters. LCR: Line control registers (R/W) The line control register is used at initialization to set the communication parameters. SCR. If no FIFO buffering is used. Otherwise the amount of characters depends on the type of UART. IIR. one stop bit. If FIFO buffering is used. Because they are only accessed at initialization when no communication occurs this register swapping has no influence on performance. no parity 7 data bits. one stop bit. These registers can be read or written to check and change the behavior of the communication device. each new read action of the register will yield the next byte. The value 1 indicates that the register is empty. RBR: Receiver buffer register (RO) The receiver buffer register contains the byte received if no FIFO is used. There is no indication of the amount of bytes currently present in the transmitter FIFO. DLM The communication between the processor and the UART is completely controlled by twelve registers. more than one character can be written to the transmitter holding register when the bit signals an empty state. MSR. Bit 0 in the line status register can be used to check if all received bytes have been read. MCR. the registers are accessible in the I/O port map. FCR. The register also controls the accessibility of the DLL and DLM registers. On a PC compatible. or the oldest unread byte with Fife’s. If FIFO buffering is used.

LCR: Line Control Register Bit 0.5 stop bits(5 bits word) 2 stop bits (6.4.7 or 8 bit word) Bit 4 Bit 3 X 0 1 0 1 0 1 1 1 1 No parity Odd Parity Even Parity High Parity(stick) Low Parity(stick) Break signal disabled Break signal enabled DLAB : RBR. THR and IER accessible DLAB : DLL and DLM accessible .5 Bit 5 X 0 0 1 1 6 0 1 7 0 1 Bit 0 0 1 0 1 Detail Data Word Length 5 Bits 6 Bits 7 Bits 8 Bits 1 stop bit 1.1 Value Bit 1 0 0 1 1 2 0 1 3.

5 Mbps. that bit 5 turns high as soon as the transmitter holding register is empty whereas bit 6 indicates that also the shift register which outputs the bits on the line is empty LSR: Line status register Bit 0 1 2 3 4 5 6 7 Comment Data available Overrun error Parity error Framing error Break signal received THR is empty THR is empty. Because of this division. the DLL and DLM which contain the least. Bit 5 and 6 both show the state of the transmitting cycle. This 115200 bps communication speed is not suitable for all applications. To change the communication speed. For very slow communications. the frequency can be further decreased by dividing it by a programmable value. and line is idle Erroneous data in FIFO DLL and DLM: Divisor latch registers (R/W) The frequency (1.8432 MHz) is divided by 16 to generate the time base for communication.LSR: Line Status Register (RO) The line status register shows the current state of communication. The state of the receiver and transmitter buffers is also available. The table shows the most common values with the appropriate settings of the divisor latch bytes. The difference is. Modern UARTS like the 16550 are capable of handling higher input frequencies up to 24 MHz which makes it possible to communicate with a maximum speed of 1. Default values have been defined which are commonly used. this value can go beyond 255. the maximum allowed communication speed is 115200 bps. It is necessary that both the transmitting and receiving UART use the same time base. the divisor is stored in two separate bytes. Therefore. and most significant byte. Errors are reflected in this register. .

DLL and DLM: Divisor latch registers Speed(bps) 50 300 1200 2400 4800 9600 19200 38400 57600 115200 Table of Registers Base Address DLAB Read/Write Abr. Register Name =0 +0 =0 =1 +1 +2 +3 +4 +5 +6 +7 =0 =1 Write Read Transmitter Holding Buffer Receiver Buffer Divisor Latch Low Byte Divisor Latch High Byte Interrupt Identification Register Divisor 2304 384 96 48 24 12 6 3 2 1 DLL 0x00 0x80 0x60 0x30 0x18 0x0C 0x06 0x03 0x02 0x01 DLM 0x09 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Read/Write Read/Write Read Write IIR Read/Write IER Interrupt Enable Register FCR FIFO Control Register Read/Write LCR Line Control Register Read/Write MCR Modem Control Register Read Read LSR Line Status Register MSR Modem Status Register Scratch Register Read/Write - .

After configuration restore transmission mode. 3. (Using ‘C’ program) . Perform simple byte transfer between 2 PCs through serial ports connected via serial cable tested in previous exercise. 4. Check functioning of prepared cable using Direct Cable Communication under windows.Exercise 1. Prepare 9 – 9 pin serial cables with null modem configuration. 2. Load divisors in DLM & DLL to support communication at 9600 bps.

EXPERIMENT 5 To perform byte transfer between 2 PCs using serial port (using ‘C’ code) EXPERIMENT 6 To perform simple file transfer between 2 PCs using serial port (using ‘C’ code) EXPERIMENT 7 To perform character stuffing & de-stuffing EXPERIMENT 8 Demonstration of Linux OS installation and network utilities .

LANs are distinguished from other kinds of networks by three characteristics. 1) Transmission media 2) Transmission mechanism 3) Topology 4) Protocol A Local area network is a data communication system that allows a number of independent devices to communicate directly with each other in a limited geographic area such as single department. Implementations The IEEE standard defined several implementations for Internet Implementation 10BASET 10BASE2 10BASE5 10BASE-FL Connecting Devices Repeaters A repeater is a device that operates only in the physical layer. They are widely used to connect personal computers and workstations in company offices and factories to share resources and exchange information. A repeater receives a signal before it becomes too weak or corrupted and regenerates the original signal. A repeater connects segments of LAN together. It has no filtering capability. Maximum Supported 100 m 200 m 500 m 2000 m Distance To study network devices and the specifications of each for existing network plan To study existing network plan To draw a new network plan as per the new constraints .EXPERIMENT 9 Study of Internetworking devices – Network Hardware Objectives    Concepts Local area networks generally called LANs are privately owned networks within a single building or campus or up to few kilometers in size. A repeater can extend the physical length of a network. or campus. A large organization may need several connected LANs. single building.

Hubs A hub is a multiport repeater. Regeneration of packets allows for greater distances and more nodes to be used in the total network design. When a packet is received by the switch. and dramatically lowers the overall collision rates. As a physical layer device. it regenerates the signal it receives. if the segments are different. If the segments are the same. Filtering of packets and the regeneration of forwarded packets enables switching technology to split a network into separate collision domains. As a network layer device.. it operates in physical. data link and network layers. Bridges ……Nodes …. It is used to create connections in physical star topology. Switches A two layer switch is a bridge with many interfaces and a design that allows better performance. In switched networks. A Router can connect LAN’s together. Filtering means that it can check the destination address of a packet and decide if the packet should be forwarded or dropped. a router can connect WAN’s together and it can also connect LAN’s and WAN’s together. then the packet is "forwarded" to the proper segment. It only acts as a filter. Switches can connect different networks types (such as Ethernet and Fast Ethernet) or networks of the same type. a router checks the network layer addresses. A bridge like a repeater has no physical address. A three layer switch is router with an improved design to allow better performance. the packet is dropped ("filtered"). As a physical layer device it regenerates the signal it receives. A bridge operates in both physical layer and data link layers. As a data link layer device the bridge can check the physical address contained in the packet. the switch examines the destination and source hardware addresses and compares them to a table of network segments and addresses. not an original sender to a final destination. each segment is an independent collision domain. As a data link layer device the router checks the physical addresses (source and destination) contained in the packet. Hub Hub Hub …Nodes…. . A router is an internetworking device. Routers Router is a three layer device.

There are two different types of RJ-45 connectors. Two types of CAT5 cables are typically used in a network: the straight-through cable and the crossover cable. After detecting a collision. CAT5 cable runs should not exceed 100 meters. .3 standard defines carrier sense multiple access with collision detection as the access method for Ethernet. The real destination keeps the frame while the rest drop it. you most likely have a crossover cable. The chart below shows the RJ-45 connector "pin-outs" for CAT5 crossover and straight-through cables. This standard enables devices to detect a collision. RJ-45 Connector "Pin-Outs". The larger the number of bits faster the NIC. CAT5 cables are typically terminated with RJ-45 connectors. a device waits a random delay time and then attempts to re-transmit the message. This desire requires connecting together different and frequently incompatible networks. often with different hardware & software. a set of rules determining how network devices respond when two devices attempt to use a data channel simultaneously (called a collision). NIC provides a physical connection between the networking cable and the computer’s internal bus. By this we mean that the medium is shared between the stations and only one station at a time can use it. Crossover cables are used to connect switches to other switches. Stopping point can be either a gateway node. both in terms of hardware and software. CAT Cabling Ethernet networks use unshielded twisted pair (UTP) Category 5 cable. Network Interface Cards A network interface card (NIC) is used to connect a PC to a network. Access Technique for LAN CSMA-CD The IEEE 802. if it is different. and then there is the "aligned type" connector for use with stranded CAT5 cable. 16 bits and 32 bits. If the wiring is identical at both ends. . It also implies that all stations receive a frame sent by a station. The difference between the two has to do with how the conductors terminate to the RJ-45 connector at each end of the cable. you are holding a straight-through cable.8 bit. NIC comes in 3 basic varieties. CSMA-CD stands for Carrier Sense Multiple Access / Collision Detection. Standard Ethernet networks use CSMA/CD. A straight-through cable is used to connect a DTE to a switch. Stations on an Ethernet can be connected together using a physical star topology with a logical bus topology. This is done by using machines called gateways to make the connection and provide the necessary translation.Gateways Many networks exist in the world. People connected to one network often want to communicate with people attached to a different one. There is the "bent type" connector intended for use with solid core CAT5. It can also be referred as entrance point.

CSA Type 2 250V. 7A 1830mm (6ft) UL. mm (including mounting brackets): DE-812TP+: 483 x 44 x 125 DE-816TP: 483 x 44 x 125 DE-824TP 483 x 44 x 211 DE-812TP+: 2.60 Hz DE-812TP+: 18 W DE-816TP: 18 W DE-824TP: 20W W x H x L.Specification of a network device Model DE-816TP Ethernet Hub Data transfer rate: Protocol: Topologies: EMI Certification: 10 Mbps CSMA/CD Star.0 kg DE-816TP: 2.90 % non-condensing Type 1 (US) or Type 2 (Europe) Per purchase order Type 1 Plug Rating Cord Rating Length Safety Standard 125V.0 kg DE-824TP: 3. 7A 125V. Bus DE-812TP+ and DE-824TP: FCC Class A. VCCI I.03 kg 0° . CE B 100 . 50 .55° C 10 . 10A 250V. VCCI II. CE A DE-816TP: FCC Class B.250 V. 10A 1830mm (6ft) VDE AC power: Power consumption: Dimensions: Weight: Operating temperature: Humidity: Power cord: .

it sends a direct broadcast packet to all hosts in this network. Here ‘n’ represents number of host bits in an IP address.88 wants to use Loopback testing what are the source and destination addresses? . IP address of a device is a combination of network ID and Host ID. An IP address is a 32-bit binary address that uniquely and universally defines the connection of a host or a router to the Internet.56. (2) What is the use of Loopback address? (3) IP addresses are unique.18. Classful IP addressing consists of several blocks of IP addresses. justify your answer.true or false. What are the source and destination addresses used in this packet? (8) A host with IP address 185. justify your answer.5.42. To retrieve network ID information from an IP address a specific pattern of bits is used. (4) Which version of IP addressing scheme is currently in use and what could be the future expansion in the IP addressing scheme? (5) What is meant by Net ID and Host ID? (6) An address space has a total 1024 addresses. There are two types of IP addressing scheme: A) Classful IP addressing and B) Classless IP addressing. TUTORIAL Questions (1) A device can have more than one IP addresses-true or false. Classless IP address uses ‘/n’ notation to make CIDR possible. known as subnet mask.EXPERIMENT 10 Study of IP addressing and subnetting Objectives    To implement a program for IP class identification To implement a program for IP address conversion (BCD to Binary) To implement a program for finding Network ID (with or without subnet mask)and number of hosts Concepts IP address is the identifier used in the IP layer of the TCP/IP protocol suite. It provides logical identity to each device connected to the Internet. Host ID refers to a unique host in a given network identified by network ID. how many bits are needed to represent an address? (7) A router has an IP address 108.22. logically identified as a class.

The Network Animator uses the parameters from the script and writes it into . So we can see graphically how the packets are forwarded and traffic is handled in the network. Syntax of this script can be understood by referring the NS_DOC.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf #Execute nam on the trace file . Its simulated output is considered to be valid for most of real protocol implementations.EXPERIMENT 11 Network Simulator. but it is highly recommended by researchers around the world. Though it is giving protocol stack independent performance.‘ns-2’: Installation. so this can give the more realistic implementation and observation.nam file and then according to that it will create a topology identical to the script. which is an advantage. Programming & Simulation demonstration o To study various features of Network Simulator & Network Emulator o To test a given script on Network Simulator platform and observe the behavior of the network with the help of the key parameters o To measure the performance of a network for a given topology o To understand the network setup with a network emulator o To implement different types of link characteristics and measure the performance by changing various parameters using NIST Net Concepts Network Simulator is a very powerful tool for studying the working of layers and related protocols.PDF We can understand Network Simulator’s simulation process and tcl script format and The Network Animator graphical representation with the help of the following scripts: UDP #Create a simulator object set ns [new Simulator] #Define different colors for data flows $ns color 1 Blue $ns color 2 Red #Open the nam trace file set nf [open out. Network Simulator includes The Network Animator. which is helping Network Simulator to support a graphical environment. Network Simulator uses tcl script for simulation.

exec nam out.5 #Create a UDP agent and attach it to node n0 set udp0 [new Agent/UDP] $udp0 set class_ 1 $ns attach-agent $n0 $udp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 #Create a UDP agent and attach it to node n1 set udp1 [new Agent/UDP] $udp1 set class_ 2 $ns attach-agent $n1 $udp1 # Create a CBR traffic source and attach it to udp1 set cbr1 [new Application/Traffic/CBR] $cbr1 set packetSize_ 500 $cbr1 set interval_ 0.005 $cbr1 attach-agent $udp1 #Create a Null agent (a traffic sink) and attach it to node n3 set null0 [new Agent/Null] $ns attach-agent $n3 $null0 #Connect the traffic sources with the traffic sink $ns connect $udp0 $null0 $ns connect $udp1 $null0 #Schedule events for the CBR agents .nam & exit 0 } #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n2 1Mb 10ms DropTail $ns duplex-link $n1 $n2 1Mb 10ms DropTail $ns duplex-link $n3 $n2 1Mb 10ms SFQ $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right #Monitor the queue for the link between node 2 and node 3 $ns duplex-link-op $n2 $n3 queuePos 0.

tcl files type ns filename.27.tcl (11) To modify the source code press INSERT and make changes and at last press ESC and give :wq for save and quit.27 will be created After entering in this directory.tar.0 "$cbr1 start" $ns at 4.5 "$cbr0 stop" #Call the finish procedure after 5 seconds of simulation time $ns at 5.gz and press enter Directory of the name ns-allinone-2./install and press enter After the completion of the installation set the library paths in .0 "finish" #Run the simulation $ns run OUTPUT:- Installation Procedure (1) (2) (3) (4) (5) Copy ns-allinone-2.tar. type .27. (10) To run .0 "$cbr1 stop" $ns at 4.gz file to /root Type tar xvzf ns-allinone-2. .$ns at 0.tcl files will be available there.27 directory (7) In this directory goto ns-tutorial directory (8) In this directory goto examples directory (9) .tcl To view source code type vi filename.27 directory which is in the nsallinone-2.5 "$cbr0 start" $ns at 1.bash_profile file in /root (6) After the completion of the installation goto ns-2.