You are on page 1of 22

CS 305 Computer Network 1

Lecture 3: Data Link Layer

NUB, 2020
Credits to Dr. L. Christofi
pages.cs.wisc.edu/~suman/courses/640/s18/ethernet.pdf 1
Overview
• Data-link layer performs the following tasks:

- Framing

- Physical addressing

- Medium Access Control (MAC)

- Flow control

- Error control

2
Shared Access Networks
• In a shared network, e.g. bus, ring, or wireless
layouts, multiple nodes share the same physical
link.
• Transmission sent by one node is received by all
others
• When two or more nodes send data at the same
time, a collision occurs
— data becomes corrupted and must be
retransmitted -> bandwidth is wasted.

3
The need for MAC
• We need an efficient and fair method
that provides access to the medium: MAC.
• MAC methods attempt to reduce frame
collisions.
• Note that switches separates networks
into several point-to-point links and hence
no collision happens.

4
Medium Access Control Methods
• Token ring
— ring layout
— each node is given a turn to access the medium.
• Carrier-sense multiple-access with collision
detection (CSMA/CD)
— bus and wireless mediums
— Nodes contends for the link and recover from
collisions
— Examples: Early half-duplex Ethernet

5
Token Ring
• Developed by IBM in early 80’s (IEEE 802.5
standard).
• Consists of nodes connected in a logical ring
topology.

Token ‫عالمة أو رمز‬ 6


Control Token operation
Assume node A wishes to send a frame to node C

D
token

A C Node A waits for receipt of control token


from its upstream neighbor
B

A C
Node A transmits frame on to the ring.
Node C copies the frame addressed to it.
frame Frame continues around the ring.
B

7
Control Token operation
D
frame

A C Node A awaits receipt of start of frame


but does not repeat the frame, thereby
B removing it

D
When last bit of frame has been received
A C Node A generates and passes on the
token.
token
B

8
Token passing
• The token is a special permission message always
circulating around the ring.
• When a node gets the token it can transmit for a
limited time
• After it has transmitted the frame, it passes the
token on, to allow another station to access the
transmission medium.
• Every node gets an equal opportunity to send.
• Still used and sold but beaten out by Ethernet.

9
Ethernet
• Ethernet is a family of standards (IEEE 802.3) that
define the physical and data-link layers of the
world’s most popular wired LAN technology.
• Ethernet specifies:
— cables and connectors on the ends of cables,
— protocol rules to create a LAN.
• Ethernet is efficient and manufacturers keep making
it faster.
• Ethernet’s Media Access Control (MAC) policy uses
CSMA/CD.
10
CSMA/CD
• Assume that a A B C D

number of nodes
Carrier
Sense

share a common
communication A B C D

channel (wire) or
Multiple
Access

bus. Also assume half


duplex transmission. A B C D
Collision

• All hosts on an
Ethernet are
Collision

competing for access Collision


Detection
A B C D

to the medium.
11
CSMA/CD procedure
• Sense the channel (carrier sensing)
—If idle, transmit immediately
—If busy, wait until the channel becomes idle
• Collision detection
—Abort transmission immediately if a collision is
detected (another device initiate transmission)
—Try again after a random amount of time in order
to minimize the probability of having another
collision.
• Note that with more hosts, more collisions occur.
Most networks are limited to about 200 hosts.
12
Ethernet Technologies
• Bandwidth:
— Ethernet (10BaseT): 10 Mbps
— Fast Ethernet (100BaseT): 100 Mbps
— Gigabit Ethernet: 1 Gbps
• T stands for Twisted Pair
• Many network interface cards (NIC) can be used
at either 10/100 speeds.
• Gigabit Ethernet is typically used for backbones
and inter-router connectivity
13
Twisted-pair cable

Unshielded twisted paired (UTP) Shielded twisted paired (STP)


14
Categories of UTP
• CAT 5: 10 Mbps
• CAT 5e: 100 Mbps (e for enhanced)
• CAT 6: 1000 Mbps
• The higher the number, the higher bit rate it supports.
• Used in LAN networks (<100 meters).

Figure UTP connector 15


Ethernet Cable
• It contains 4 pairs of wires.
• Only two pairs are used but it is normal to
terminate all the pairs ready for future upgrades

https://www.canford.co.uk/TechZone/Article/RJ45ConnectorWiring 16
Straight Wiring
• Straight Through Cable is used to connect similar type
of networking devices such as:
—Switch to Router
—Computer to switch

https://www.wiringdiagram21.com/2017/05/rj45-color-code.html 17
Crossover Wiring
• Crossover cable is used to connect same type of networking
devices such as:
— Switch to Switch
— Laptop to Laptop
— Router to Router
— Router to Computer

18
Network Interface Card (NIC)
• The function of a NIC is to connect a host device to
the network medium.
• The NIC is also referred to as a network adapter.
• NICs are considered Layer 2 devices because each
NIC carries a unique code called a MAC address.

19
Ethernet Frame
• Network layer packets are transmitted over Ethernet by
encapsulation into a frame consisting of the following
fields:
— Preamble is a sequence of 7 bytes, each set to
“10101010”. It is used to synchronize receiver before
actual data is sent in order to recognize the start of
the frame
— DA = Destination MAC Address
— SA = Source MAC Address
56 48 48 16 32

Preamble DA SA Type Body CRC

20
Ethernet Frame
• MAC Addresses
— unique, 48-bit (6-bytes) hard-coded unicast address
assigned to each adapter
• Example: 12:8:0:e4:b1:2
• Each manufacturer gets their own address range
— Broadcast MAC address: all 1s or
FF:FF:FF:FF:FF:FF
• Type: is used to determine which higher level protocol the
frame should be delivered to (e.g. IPv4).
• Body: actual data (from 46 to 1500 bytes).
• CRC: 4 byte Cyclic Redundancy Check field, used to
detect transmission errors. 21
Ethernet Frame
• Ethernet uses Manchester encoding
— Each bit contains a transition; a 1 has a transition
from up to down; a 0 has a transition from down to
up
— Used to synchronize the sender’s and receiver’s
clocks

22

You might also like