You are on page 1of 39

Lecture 9:

Datalink layer and Physical layer

HEDSPI Project
Hanoi University of Technology
by
Ngo Hong Son

1
Overview
 Last weeks : Datalink layer
 Datalink layer services
 Multiple access control
 Ethernet LAN, ARP and addressing
 Today: More about LAN and physical layer
 More about LAN: Bridge and Switch, WLAN
 Physical layer issues
 Physical media: copper, twisted pair, fiber, wireless

 Transmission issues: Modulation, encoding, multiplexing

 Case studies: Cable modem,

2
Hub, Switch, Bridge

3
LAN interconnected devices
 Hub, bridge and switch
 Have multiple ports
 Hub: a physical layer repeater
 Just receives electrical signal from one port and
forward to all others
 Do not have data-link layer services
 Bridges and switches
 Smarter than hub
 Can store and forward Ethernet frame

4
Switch A

 Allows multiple simultaneous C’ B


transmissions
 E.g. A-to-A’ and B-to-B’
simultaneously, without collisions 1 2
6 3
 Ethernet protocol used on each 4
5
incoming link, but no collisions; full
duplex
C
 each link is its own collision domain
 Switch has a MAC address table to B’ A’
know which host is at which interface
 (MAC address of host, interface to
reach host, time stamp)

5
Source: A
Dest: A’
Build address table: self-learning
A A’ A
 switch learns which
C’ B
hosts can be reached
through which interfaces 1 2
 when frame received, 6 3
switch “learns” location of 5 4
sender: incoming LAN
segment C
 records sender/location B’
pair in switch table A’

MAC addr interface TTL


A 1 60 Switch table
(initially empty)

6
Switch: frame filtering/forwarding
When frame received:

1. record link associated with sending host


2. index switch table using MAC dest address
3. if entry found for destination
then {
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood

forward on all but the interface


on which the frame arrived
7
Self-learning, forwarding: Source: A

example Dest: A’

A A A’

C’ B

 frame destination 1 2
unknown: flood A6A’ 3
5 4
 destination A
location known: A’ A
C
selective send
B’ A’

MAC addr interface TTL


A 1 60 Switch table
A’ 4 60 (initially empty)

8
Switch and router
 Store and forward
 Switch: datalink layer
 Router: network layer

Host Switch Router Host


9
Wireless LAN

10
802.11 LAN Overview
 Base station = access
Internet point (AP) and wireless
hosts
 Infrastructure mode
hub, switch  Basic Service Set (BSS)
or router  wireless hosts
AP
 access point (AP): base
BSS 1 station
AP
 Ad hoc mode: hosts only

BSS 2 11
Various standards
 802.11b  802.11g
 2.4-5 GHz unlicensed  2.4-5 GHz range
spectrum  up to 54 Mbps
 up to 11 Mbps  802.11n: multiple
 802.11a antennae
 2.4-5 GHz range
 5-6 GHz range
 up to 200 Mbps
 up to 54 Mbps

 all use CSMA/CA for multiple access


 all have base-station and ad-hoc network versions

12
802.11: Channels, association
 Spectrum is divided into 11 channels at different
frequencies
 AP admin chooses frequency for AP

 host: must associate with an AP


 scans channels, listening for beacon frames
containing AP’s name (SSID) and MAC address
 selects AP to associate with

13
Passive/active scanning
BBS 1 BBS 2 BBS 1 BBS 2

AP 1 AP 2 AP 1 1 AP 2
1 1 2 2
2 3
3 4

H1 H1

Passive Scanning: Active Scanning:


(1) beacon frames sent from APs (1) Probe Request frame broadcast
(2) association Request frame sent: from H1
H1 to selected AP (2) Probes response frame sent from
(3) association Response frame sent: APs
H1 to selected AP (3) Association Request frame sent:
H1 to selected AP
(4) Association Response frame
sent: H1 to selected AP
14
IEEE 802.11: multiple access
 802.11: CSMA - sense before transmitting
 802.11: CA – Collision Avoidance
 difficult to receive (sense collisions) when transmitting due
to weak received signals (fading)
 can’t sense all collisions in any case: hidden terminal,
fading

A B C
C
A’s signal C’s signal
B strength strength
A
space 15
IEEE 802.11 MAC Protocol: CSMA/CA
802.11 sender
1 if sense channel idle for DIFS then sender receiver
transmit entire frame (no CD)
2 if sense channel busy then DIFS

start random back-off time


timer counts down while channel idle data
transmit when timer expires
if no ACK, increase random backoff interval,
SIFS
repeat 2
ACK
802.11 receiver
- if frame received OK
return ACK after SIFS (ACK needed due to
hidden terminal problem)
16
Avoiding collisions (more)
idea: allow sender to “reserve” channel rather than random
access of data frames: avoid collisions of long data frames
 sender first transmits small request-to-send (RTS) packets to
BS using CSMA
 RTSs may still collide with each other (but they’re short)
 BS broadcasts clear-to-send CTS in response to RTS
 RTS heard by all nodes
 sender transmits data frame

 other stations defer transmissions

avoid data frame collisions completely


using small reservation packets!
17
Collision Avoidance: RTS-CTS exchange
A B
AP

RTS(A) RTS(B)

reservation collision
RTS(A)

CTS(A) CTS(A)

DATA (A)
defer

time
ACK(A) ACK(A)

18
802.11 frame: addressing
2 2 6 6 6 2 6 0 - 2312 4
frame address address address seq address
duration payload CRC
control 1 2 3 control 4

Address 4: used only in


ad hoc mode
Address 1: MAC address
of wireless host or AP Address 3: MAC address
to receive this frame of router interface to which
AP is attached
Address 2: MAC address
of wireless host or AP
transmitting this frame

19
802.11 frame: addressing

Internet
H1 R1 router
AP

R1 MAC addr AP MAC addr


dest. address source address

802.3 frame

AP MAC addr H1 MAC addr R1 MAC addr


address 1 address 2 address 3

802.11 frame
20
802.11 frame: more
frame seq #
duration of reserved
(for reliable ARQ)
transmission time (RTS/CTS)

2 2 6 6 6 2 6 0 - 2312 4
frame address address address seq address
duration payload CRC
control 1 2 3 control 4

2 2 4 1 1 1 1 1 1 1 1
Protocol To From More Power More
Type Subtype Retry WEP Rsvd
version AP AP frag mgt data

frame type
(RTS, CTS, ACK, data)
21
Summary LAN
 Ethernet LAN
 Interconnecting LAN: Hub, switch, bridge
 WLAN

22
Physical layer

23
Overview
 Transmission problem
 Put the bit stream from sender host to physical
media
 Receive bit stream from physical media to
receiver host
 Some issues
 Physical media
 Modulation
 Encoding
 …
24
From Signals to Packets
Analog Signal

“Digital” Signal

Bit Stream 0 0 1 0 1 1 1 0 0 0 1
0100010101011100101010101011101110000001111010101110101010101101011010111001
Packets
Header/Body Header/Body Header/Body

Packet
Transmission Sender Receiver
25
Physical media
 Guided media
 Twisted Pair
 Coaxial Cable
 Fiber Optics
 Wireless
 Radio Transmission
 Microwave Transmission
 Infrared and Millimeter Waves
 Lightwave Transmission
26
Twisted Pair

(a) Category 3 UTP.


(b) Category 5 UTP.
27
Coaxial Cable
A coaxial cable.

28
Fiber Optics

(a) Three examples of a light ray from inside a silica fiber


impinging on the air/silica boundary at different angles.
(b) Light trapped by total internal reflection.

29
Fiber Cables

(a) Side view of a single fiber.


(b) End view of a sheath with three fibers.
30
The Electromagnetic Spectrum

31
802.15: personal area network
 802.15: evolved from
Bluetooth specification
P
 2.4-2.5 GHz radio band S

 up to 721 kbps P
radius of
M
coverage
 less than 10 m diameter
P
 master/slaves: S P
S

 slaves request permission to


send (to master)
 master grants requests M Master device

S Slave device
P Parked device (inactive)

32
Encoding
 Use two discrete signals, high and low, to encode 0
and 1.
 Transmission is synchronous, i.e., a clock is used to
sample the signal.
 In general, the duration of one bit is equal to one or two
clock ticks
 Receiver’s clock must be synchronized with the sender’s
clock
 Encoding can be done one bit at a time or in blocks
of, e.g., 4 or 8 bits.

33
Non-Return to Zero (NRZ)
0 1 0 0 0 1 1 0 1

.85

V 0

-.85

 1 -> high signal; 0 -> low signal


 Long sequences of 1’s or 0’s can cause problems:
 Sensitive to clock skew, i.e. hard to recover clock
 Difficult to interpret 0’s and 1’s
34
Non-Return to Zero Inverted
(NRZI)
0 1 0 0 0 1 1 0 1

.85

V 0

-.85

 1 -> make transition; 0 -> signal stays the same


 Solves the problem for long sequences of 1’s,
but not for 0’s.
35
Ethernet Manchester Encoding
0 1 1 0

.85

V 0

-.85

.1s

 Positive transition for 0, negative for 1


 Transition every cycle communicates clock (but
need 2 transition times per bit)
36
Other transmission issues
 Modulation
 Multiplexing
 Error…
 ….
 Need more courses and time!

37
Next week: Security
 Virus, mal-ware, security hole and DoS
 Password cracking
 Sniffing, phishing and information protection
 Firewall, Anti-virus
 Encryption

38
Acknowledgement
 This course materials contains charts and texts
provided:
 Some materials from the textbook “Computer Network, a
top down approach” J.F Kurose and K.W. Ross
 Some materials from the textbook “Computer Network”, A.
Tanenbaum

39

You might also like