. .
Simulating a Typical LAN




After completing this experiment you will be able to:


  • Learn about Local Area Network (LAN) and different topology, protocols uses in LAN
  • Know how to simulate a LAN using open source network simulator NS2
  • Identifying and analyzing the problem related to creating of nodes considering different network topology and setup the TCP/UDP connections; also they can learn how the FTP/CBR (or any other application) will run over it


Time Required


Around 3.00 hours


Local Area Network


A local area network (LAN) supplies networking capability to a group of computers in close proximity to each other such as in an office building, a school, or a home. A LAN is useful for sharing resources like files, printers, games or other applications. A LAN in turn often connects to other LANs, and to the Internet or other WAN. A LAN interconnects a variety of data communicating devices.It operates within a small geographic area.It broadcasts data at high data transfer rates.LAN exhibits very low error rates.A LAN is popularly named after the protocol used in the data link segment of the network such as Ethernet, Gbit Ethernet ,Token ring etc.


A LAN is basically inexpensive, highly reliable and easy to install and manage. The primary uses of LAN are Information exchange, file serving, print serving and remote execution.


LAN Topologies


Nodes in LAN are interconnected using one of four basic configurations:


Bus topology
Star topology
Ring topology
Mesh topology


Bus topology: In local area networks where bus topology is used, each machine is connected to a single cable. Each computer or server is connected to the single bus cable through some kind of connector. A terminator is required at each end of the bus cable to prevent the signal from bouncing back and forth on the bus cable.


Star topology: In local area networks with a star topology, each network host is connected to a central hub. In contrast to the bus topology, the star topology connects each node to the hub with a point-to-point connection. All traffic that transverses the network passes through the central hub. The hub acts as a signal booster or repeater.


Ring Topology: In local area networks where the ring topology is used, each computer is connected to the network in a closed loop or ring. Each machine or computer has a unique address that is used for identification purposes. The signal passes through each machine or computer connected to the ring in one direction. Ring topologies typically utilize a token passing scheme, used to control access to the network. By utilizing this scheme, only one machine can transmit on the network at a time. The machines or computers connected to the ring act as signal boosters or repeaters which strengthen the signals that transverse the network.


Mesh Topology: Mesh Network is a network where all the nodes are connected to each other and is a complete network. In a Mesh Network every node is connected to other nodes on the network through hops. Some are connected through single hops and some may be connected with more than one hope.


MAC Protocols


MAC protocol is the software that allows workstations to "take turns" at transmitting data.


MAC protocols are of two types namely:


  1. Contention based protocols.
  2. Round robin protocols.


Contention Based Protocols CSMA/CD


In carrier sense multiple access with collision detection all work stations listen to the medium.If there is no traffic or no other node is transmitting ,a workstation can transmit. If someone else id transmitting the workstation backs off and waits.If two workstations transmit at the same time a collision occurs.When transmitting workstation hear collision,they stop transmitting immediately.Each workstation waits for a random amount of time and tries again.CSMA/CD is non deterministic protocol.


Round Robin Protocol


In this protocol each workstation takes turn in transmitting.The turn is passed around the network from workstation to workstation.The most common example is token ring LAN. Here a software toke is passed from workstation to workstation.Token ring is an example of deterministic protocol.It is more complex than CSMA/CD.




Ethernet is the most popular CSMA/CD protocol.It is standardized as IEEE 802.3.In Ethernet when only one computer needs to transmit data,it can immediately access the line but when many computers want to access the medium frequently it generates a high traffic.As a result the average waiting time is high and there is a high probability of collision.Thus for every collision,transmission must start again.Therefore, the expected delay depends on the traffic of the LAN.


Ethernet Frame Structure



An Ethernet frame consists of the following fields:


  •  Preamble: 7 bytes with pattern 10101010 followed by one byte with pattern 10101011.It is used to synchronize the receiver,sender ,clock rates.
  • Addresses: 6 bytes frame is received by all the adapters on a LAN and dropped if the addresses does not match.
  • Type: It indicates the higher layer protocol mostly IP.
  • CRC: It is used for error detection.If error is detected the frame is simply dropped.


Ethernet Versions


Following are the different categories of Ethernet available commercially:

  1. 10Base2 : It is commonly called thin Ethernet.It operates at 10Mbps and its maximum segment length is of 200m.
  2. 10Base5 : It is commonly known as thick Ethernet.It operates at 10Mbps maximum distance is 500m.
  3. 10BaseT : An Ethernet standard that transmits at 10Mbps over twisted wire pairs (telephone wire). 10Base-T is a shared media LAN when used with a hub (all nodes share the 10Mbps) and 10Mbps between each pair of nodes when used with a switch. There are rarely new 10Base-T products.Its maximum segment length is of 100m.
  4. 10BaseF: This kind of Ethernet use fiber optic cable. Its maximum segment length is of 200m.


Simulating a LAN using Network Simulator 2


The network simulator simulates the three levels related to local area network. They are:

  1. Link layer protocols such as ARQ
  2. MAC protocol
  3. Physical Channel


There are seven arguments:


  1.  A group of nodes e.g. "n3 ,n4, n5".
  2. The delay
  3. The bandwidth
  4. Link layer type e.g. "LL"
  5. Interfacing queue e.g."Queue Drop Tail"
  6. The MAC type
  7. Channel type


The command required to setup a LAN with bus topology is:


1    set lan [$ns lan "$n3 $n4 $n5" 0.5Mb 40ms LL Queue/DropTail MAC/Csma/Cd Channel]


Cite this Simulator:

..... .....
Copyright @ 2018 Under the NME ICT initiative of MHRD (Licensing Terms)
 Powered by AmritaVirtual Lab Collaborative Platform [ Ver 00.12. ]