Simulating a Local Area Network

Objectives

After completing this experiment you will be able to:

  • Learn about Local Area Network (LAN); different topologies and protocols uses in LAN
  • Learn about simulating a LAN using ns2

Time Required

Around 3.00 hours


Local Area Network

A local area network (LAN) provides 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 is often connected to other LANs, which in turn are connected Internet.

LAN Topologies

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

  • Bus topology
  • Star topology
  • Ring topology
  • Mesh topology

Bus topology: In case of a bus topology, each machine is connected to a single cable through some kind of connector. Terminators (resistors) are required at each end of the bus cable to prevent the signal from bouncing back and forth on the cable.

Star topology: In local area networks with forming a star topology, each network host is connected to a central hub (a signal booster or repeater). In contrast to the bus topology, the star topology connects each node to the hub with a point-to-point connection. All traffic in the network has to pass through the central hub.

Ring Topology: In local area networks where the ring topology is used, each computer is connected to the network in form of a closed loop or ring. Each machine has a unique address for their identification. Ring topologies typically utilize a token passing scheme to control access to the medium. By utilizing this scheme, only one machine can transmit on the network at a time.

Mesh Topology: In a mesh network where all nodes are connected to each other through one or more hops.

MAC Protocols

Medium Access Control (MAC) protocols allows machines to access the communication medium, and thereby to "take turns" at transmitting data.

MAC protocols could be broadly classified into three types:

  1. Channel partitioning based protocols (TDMA, CDMA)
  2. Random access based protocols (ALOHA, CSMA)
  3. Taking turns (token passing, polling)
  4. Contention Based Protocol: Carrier Sense Multiple Access / Collision Detection (CSMA/CD)

    In Carrier Sense Multiple Access with Collision Detection all work stations listen to the shared medium. If there is no ongoing transmission (by other devices), a workstation can transmit. However, if someone else is transmitting, the workstation backs off and waits. If two or more workstations sense that the medium is free, and start transmitting at the same time, a collision occurs! The end devices are however capable of detecting this collision (from the energy level of the medium), and they stop transmitting under such scenario. Each workstation waits for a random amount of time and tries again. CSMA/CD is non deterministic protocol. This works only on wired networks -- collisions can't be detected on a wireless network. CSMA/CA based protocols are used instead.

    Taking turns

    In this protocol each workstation takes turn in transmitting. A very common example is token ring LAN. Here a software token is passed from one device to the next. Token ring is an example of deterministic protocol.

    Ethernet

    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 (almost) access the line. However, when many computers want to access the medium frequently it generates a high traffic. This results in high average waiting time and higher chances of collision. In other words, when the size of a LAN increases, it's performance decreases. For example, an Ethernet network with more than 5% collision rate could indicate that the network is getting loaded. When the rate crosses 10%, the network could be considerably overloaded [v].

    Ethernet Frame Structure

    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.
    • Addresses: Destination and source MAC address each 6 bytes long.
    • Type: It indicates the higher layer protocol.
    • CRC: Cyclic Redundancy Check is used for error detection, and correction to some extent.

    Ethernet Versions

    Following are the different categories of Ethernet available commercially:

    • 10Base2: It is commonly called thin Ethernet. It operates at 10 Mbps and its maximum segment length is of 200m.
    • 10Base5: Also known as thick Ethernet. It also operates at 10 Mbps, but could extend upto a maximum distance of 500m.
    • 10BaseT: An Ethernet standard that transmits at 10 Mbps basebad signal over twisted wire pairs (telephone wire). Its maximum segment length is of 100m.
    • 10BaseF: This kind of Ethernet use fiber optic cable. Its maximum segment length is of 200m.
    • GbE: Gigabit Ethernet, which operates at 1000 Mbps.

    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 required parameters to setup a LAN with ns2:

    1. A group of nodes which are to be connected to form a LAN
    2. Delay for the link
    3. Bandwidth of the link
    4. Link layer type e.g. "LL"
    5. Interfacing queue e.g."Queue Drop Tail"
    6. MAC layer type
    7. Channel type

    The following code shows how to setup a LAN with three nodes forming a bus topology, CSMA/CD based MAC protocol and a DropTail queue attached to the link:

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

    The nodes $n3, $n4, $n5 must be created as usual before the above statement could be executed. However, the above creates nodes of a different type: LanNode. This implementation of node helps to simulate the contention over a shared medium as found in a LAN [i, vi].

Decrease font size Increase font size List of experiments
Top