ECE 428 Computer Networks and Security - Electrical and ...

8 downloads 35 Views 259KB Size Report
Research interest: Computer networks, mobile computing, ... Advance topics in computer networks ... Computer Networks, A. S. Tanenbaum, Prentice Hall.
ECE 428 Computer Networks and Security

1

About the Instructor • Instructor: Sagar Naik • Office: EIT 4174, ECE Dept. • Other courses that I teach – – – –

ECE 355: Software Engineering ECE 453/CS 447/ SE 465: Software Testing and QA ECE 454: Distributed and Network-Centric Computing ECE 750-4: Protocols, Software, and Issues in Mobile Comp.

• Research interest: Computer networks, mobile computing, wireless communication, network-based applications • Book: Software Testing and QA (Wiley, August 2008) 2

Course Outline • Objective #1 – Fundamentals of transporting messages from one process to another process on another computer. • Important communication protocols to access the Internet

• Objective #2 – Fundamentals of network security • Objective #3

– Advance topics in computer networks

3

Course Outline • Objective #1 – To transport messages from a process on one machine to another process on another machine IP

TCP

Client Process

Server Process

DLC

IP

IP

PHY/MAC DNS DNS

4

Course Outline: Realize Objective #1 • • • • •

Physical +Medium Access Control (MAC) layers Data Link Control (DLC) layer Internet Protocol (IP) layer Transmission Control Protocol (TCP) layer Application Layer Protocols

5

Course Outline • Objective #2: Achieve secure communication – Security • • • •

User Authentication Privacy (Confidentiality) Data Authentication (Data Integrity) Techniques – DES, Public-key cryptography, key generation, security protocols

6

Course Outline • Objective #3 – Advance topics in communication networks • Cellular communication network – GSM/ GPRS

• Wireless backbone networks – WiMAX

• Vehicular networks

7

Evaluation • Two assignments • Mid-term exam • Final

15% 25% 60%

8

Reading Resources • Text – Computer Networks, A. S. Tanenbaum, Prentice Hall – Computer Networking, Kurose and Ross, Addison Wesley – TCP/IP Protocol Suite, B. A. Forouzan, McGraw Hill, 3rd ed. – Online notes to be posted

• Course URL – http://www.ece.uwaterloo.ca/~ece428/ 9

Teaching Assistants • Towhidul Islam ([email protected]) • Rajesh Palit ([email protected])

10

Teaching Style • Balanced coverage of functional, non-functional and design aspects of network protocols – Functional aspect: what the protocols do – Non-functional aspect: Quality of Service (QoS) – Design aspects: choices and parameters

• View this course as a window to the larger world of computer networks. • Stay close to real protocols with a combination of abstraction and details. 11

Tutorial Style • Near exam times – Exam related questions and answers

• Otherwise – Protocols and their details related to in-class materials

12

My assumption about class level

Beginner

Moderate

Topically high

13

Physical + MAC layers Wired media C

C

C

Ethernet cable

C

C

C

Hub

Wireless medium

C

C

C

Wireless Access Point

14

Physical + MAC layers • Physical layer – Actual movement of bits over comm. medium – Different communication media • Wire (fiber optics, coaxial cable, telephone line) • Free space  wireless communication

– Main function • Bit stream  electrical signal/ electromagnetic waves • Strive for media efficiency – Concepts: Frequency, Time, and Code division multiplexing

15

Physical + MAC layers • Media – Shared: Ethernet, free space – Dedicated: a dial-up link

• MAC layer – – – –

Uses the services of the underlying PHY layer. Tells the PHY layer WHEN to transmit. Transmission may not be successful: packet loss. Mechanisms for reducing packet loss 16

Data Link Control layer • DLC layer – Runs on top of a MAC layer (unreliable) – Provides a sense of reliability: ACK mechanism – Synchronize source transmission rate with the sink’s acceptance rate.  Flow control – Data multiplexing/ demultiplexing • Data is broken up into frames

17

IP (Network) layer • IP layer – Runs on top of a DLC layer. – Route packets from one computer to another. – Builds routing tables for hop-by-hop routing.

18

Transport layer • TCP layer – Runs on top of IP layer. – Provides “end-to-end” communication symantic. – Packet delivery • • • •

Lossless In-order Single copy (No duplicate) Confirmation

– Two control mechanisms: flow and congestion 19

Applications • Internet Directory Service – DNS • Web Access – HTTP protocol • Session Initiated Protocol (SIP)

20

Communication Protocols • Medium Access Control (MAC) • Lets two nodes communicate directly. • Node: a computer or a router

• Data (Logical) Link Control (DLC/LLC) • Lets us have a reliable link between two adjacent nodes.

• Internet Protocol (IP) • Routes packets from one computer to another. • Uses the services of BGP, OSPF, and RIP

• Transmission Control Protocol (TCP) • Lets us have end-to-end semantics between applications. 21

Media/Physical Layer • Computers are “physically” connected by a medium • Wired medium (Ex.: Ethernet  Local Area Network) • Wireless medium (Ex.: Free space WLAN, Cellular network)

• Physical layer • A layer of protocol controlling the hardware system that actually moves bits from one computer to another • Abstraction: Transmitter and Receiver Tx Node 1 Rx

Rx 0110001100111 Medium

Node 2 Tx

22

Medium Access Control (MAC) Protocols for LAN and WLAN

23

Some Basic Ideas • • • • • •

Concept of layering Segment/ Packet/ Frame Packet Header Five Basic Assumptions Aloha Protocols Throughput 24

Concept of Layering

App. TCP IP DLC1 MAC1

DLC1 MAC1

DLC2 MAC2

App. TCP IP DLC2 MAC2

PHY

PHY

PHY

PHY

IP

LAN1

Note: Protocols are executed in - hardware, kernel space, and user space

LAN2

25

Concepts of segment/packet/frame, and header Packet: A formatted stream of bits with the following info. H - Type: The receiver knows what to do with this. E A - Addresses: Destination and source D E - Control information: Layer related R - Data: optional App. TCP IP DLC1 MAC1 PHY

User Data

User Data

User Data

User Data

User Data

User Data

User Data

User Data

App. TCP IP DLC1 MAC1

User Data

User Data

PHY

User Data

User Data

26

MAC Protocols • Function: Send packets from one node to another sharing the same medium • Sharing => Nodes compete for transmission • Key problem to resolve – Each node finds a good time for transmission with the hope that it will not collide with another. – The decision must be made largely independently • Ignore what others are doing • Look for possible Tx from others (sense carrier) • Take permission from the receiver 27

MAC Protocols (5 key assumptions) • Station Model – Nodes are independent. When a node generates a packet for Tx, subsequent packets are queued up for Tx.

• Single channel model only one can Tx at a time • Collision assumption – Two packets are transmitted at the same time => signal is potentially garbled (collision occurs) at the receiver. – Collision occurs at receivers.  NOTE – Transmitter needs to know the occurrence of collision • A Tx can’t actually detect a collision • A Tx can sometimes infer a collision • Collision detection is not possible in WLAN 28

MAC Protocols (5 key assumptions) • Time model – Continuous: A packet Tx can begin at any instant – Slotted: Packets are transmitted at well-known instants defined by slots.

• Carrier sense – No carrier sense: Don’t try to detect an on-going Tx – Carrier sense • Mechanism to sense carrier • Utilize its absence 29

MAC Protocols • We will study – Aloha protocols – CSMA/CD (Carrier Sense Multiple Access/ Collision Detection) – CSMA/CA (CSMA/ Collision Avoidance)

30

Aloha Protocol • • • •

Developed in the 1970s at U of Hawaii To interconnect terminals with mainframes LAN/ WLAN: Possible, but not used GSM: Phones use this protocol to request a channel from the base stations • Two types – Pure Aloha (Continuous time) – Slotted Aloha 31

Pure Aloha Exponential backoff

Start: i=0

Wait TB = R*Tp

Transmit Frame

R = Random(0,2i-1)

Start a timer T = 2*Tp + Δ

No i > Kmax Yes Error

i++

Timeout

ACK received Cancel timer Success 32

(Pure Aloha: Performance Measure) Throughput: A commonly used performance metric. Input

Throughput: The output rate.

I/O System

Output

Output rate

Input/ Output System

Input rate 33

Pure Aloha: Performance Measure • Throughput – Throughput = • Total input rate (G) * Prob. of successful packet transmission • G*e-2G

– Throughput peaks at G = 0.5 units of packet/X sec, where X is the packet transmission time. – Max throughput = 0.184 packets/X sec.

• Oblivious to collision while transmitting => Loss of available bandwidth 34

Slotted Aloha Protocol • Similar to pure Aloha • Difference – Time is slotted – A terminal transmits a packet at the beginning of a slot. – Throughput • G*e-G • Peaks at G = 1, and throughput = 0.368 packets/X sec

35

Carrier Sense Multiple Access with Collision Detection (CSMA/CD)

36

CSMA/CD Concepts of Carrier Sense and Collision Detection Collision? MAC/ PHY

Data Tx

Compare

Carrier?

Rx

Medium 37

IEEE 802.3: PHY • 10Base5 • Thick co-ax (10 mm diameter) • 500 m segment • Bus

• 10BaseT • Twisted pair • 100 m • Star

38

CSMA/CD • Assumption – A Tx from one node can reach all on the LAN.

39

CSMA/CD

Start: i=0

Sense medium Wait TB = R*Tp R=

Busy N

No

Yes Error

Wait

Transmit frame WHILE detecting collsion

Random(0,2i-1)

i > Kmax

Y

Collision i++

No collision

Send jamming Signal + Abort

Success 40

CSMA/CD – Time for collision detection – 2 * Tp (where Tp is max propagation time between two nodes)

– Propagation time • Includes transceiver delay + physical propagation time • Of the order of 25 microseconds

– Minimum packet length • Frame transmission time is Tf • Tf = 2* Tp • Whatever can be transmitted in Tf

41

Aloha vs. CSMA/CD • • • •

No carrier sense ACK Oblivious to collision No jamming signal

• • • •

Carrier sense No ACK Collision => Abort Jamming signal – Let all hear the collision

• Low throughput

• Higher throughput

42

Wireless LAN IEEE 802.11/a/b/g

43

Note • Reminder – CSMA/CD Assumption • Signal from one node can reach all nodes.

– The assumption may not hold in WLAN – Collision detection is out of question (Use CA) – Two nodes may not be able to comm. directly • Use an intermediate node 0: A node had announced its intention to use the medium now. – NAV = 0: Nobody had announced its intention to use the medium now.

• Transmit condition: When medium is idle – (Absence of carrier) AND (NAV = 0) 58

NAV Update Mechanism • Each node has its own NAV. • NAV represents the length of time for which the medium is likely to remain busy

• Initially: NAV = 0. • With each passing μs • NAV = NAV – 1 • Decrementing stops if NAV = 0.

• NAV is updated using the duration field in a received frame • NAV = Max(NAV, duration) 59

RTS and CTS Frames • Frame format RTS

Frame Duration Control

2

CTS/ ACK

2

Frame Duration Control

2

2

RA

TA

6

6

RA

FCS

6

4

FCS 4

bytes

bytes

FCS: Frame Check Sequence 60

DATA Frame • Frame format Frame Duration/ Control ID

A1

A2

RA

TA

A3

Seq. Control

A4

Frame Body

FCS

61

Timing Intervals • The IEEE 802.11 MAC defines 4 timing intervals – 2 at the PHY level • SIFS: Short InterFrame Space • aSlot

– 2 at the MAC level • PIFS: Priority (in PCF) IFS • DIFS: Distributed IFS

62

Hand-shake using RTS/CTS

Value of “duration” in RTS

A

DIFS

SIFS DATA

RTS

Value of “duration” in CTS SIFS

B

SIFS CTS

ACK

Value of NAV of C C Value of NAV of D D Time

63

DCF with Hand-shake: Tx F: a new data frame to be transmitted i = 0, CW = CWmin

NAV =0?

Idle medium for DIFS interval?

End of backoff

No

Random Backoff

Yes Send an RTS Start a timer

CTS is received

Timeout i: Retry count, CW: Contention Window CWmin: Minimum value of CW (typical value is 32) CWmax: Maximum value of CW (typical value is 256) DIFS: Distributed Interframe Space SIFS < DIFS  Important note

Cancel timer Send DATA (F) Start a timer

ACK is received

Wait for fairness to others

Cancel timer Wait for a random interval

Timeout

i = i+1 CW = CWmin*2i (At some point, CW saturates at CWmax.)

64

Backoff Mechanism • Backoff Time Counter (BTC) = Random(0,CW) • The time unit of BTC is aSlotTime – aSlotTime: propagation + transceiver switching time

• BTC is decremented as follows: – Medium is idle for aSlotTime: BTC = BTC – 1 – Medium is busy: Stop decrementing – Resume decrementing BTC after finding the medium to be idle for DIFS interval. – Subsequent decrementing is done for every aSlotTime of idleness of the medium. 65

Backoff Mechanism Ch. Busy (C)

Ch. Busy (A)

Time

DIFS

DIFS X

B

BTC =

5

4

X

3

X

2

X

2

2

1

0

If the channel is busy, it has to remain idle for DIFS interval for BTC to be decremented by 1. X = aSlotTime

If the channel is idle for at least DIFS interval, it has to remain idle for aSlotTime interval for BTC to be decremented by 1.

66

DCF with Hand-shake: Rx

Receive an RTS

NAV = 0?

Remain silent. No Receive a DATA frame

Yes

Channel is idle for SIFS and the computer is ready to receive?

Yes

No

Ch. idle for SIFS?

No

Yes Send an ACK

Send a CTS

Note: The above two fragments of flow-charts can be easily merged.

67

DCF Mode without Hand-shake • A special case of DCF with hand-shake – RTS/CTS frames are not exchanged

• The idea of NAV is still used in this mode – All stations process the received RTS/CTS of others

• NOTE: A node may broadcast a DATA frame to all – Done in DCF without hand-shake – Receivers do not send back an ACK. 68

PCF Mode of Operation • An AP acts as the controller of a BSS as follows – AP alternates between PCF and DCF modes – AP assumes the role of a controller as follows • AP senses the medium at the start of a CF (Contention-Free) period for a PIFS (Priority IFS) interval. – SIFS < PIFS < DIFS – PIFS = SIFS + aSlotTime – DIFS = SIFS + 2*aSlotTime

• If the medium is idle for PIFS, transmit a beacon frame – Beacon contains a CFPMaxDuration field – (Nodes receiving a beacon update their NAV to CFPMaxDuration) » These nodes perceive the medium to be busy for CFPMaxDuration 69

PCF Mode of Operation (Contd.) – After transmitting a beacon, AP waits for SIFS before transmitting one of the following • • • • •

DATA frame CF Poll frame DATA+CF Poll frame ACK frame CF End frame

70

PCF Mode of Operation (Contd.) CF Poll frame User 1

AP

User 2

CF Poll SIFS

User 1

AP CF Poll

DATA

ACK

The polled user sends data to another user.

DATA SIFS

SIFS

SIFS

ACK

The polled user sends data to the AP.

71

PCF Mode of Operation (Contd.) DATA + CF Poll frame User 1

AP

User 2

DATA+ CF Poll SIFS ACK

DATA

ACK

SIFS

The polled user receives data from the AP and sends data to another user.

72

PCF Mode of Operation (Contd.) • DATA frame – Contains user data from AP to a specific station. – The receiver sends back an ACK after SIFS interval. – AP does not receive an ACK • Retransmit the DATA after a PIFS interval

– AP can broadcast a DATA frame • These are not ACKed.

73

PCF Mode of Operation (Contd.) • CF Poll frame – AP grants permission to another node to transmit DATA to the AP or to a third node. – Receiver of DATA frame sends an ACK to the sender. – If the polled node has no data to send, it sends a null DATA frame. – If the polled station does not receive an ACK, it can not retransmit its data frame until it is polled again.

74

PCF Mode of Operation (Contd.) • CF End frame – Identifies the end of CF period – Sent by an AP under two conditions • An AP has no data to send and no node to poll – Can happen before the pre-announced CFPMaxDuration – Receivers of CF End reset their NAV to 0.

• Normal end of CF period – (Initially: CFPDurRemaining = CFPMaxDuration) – CFPDurRemaining time expires

75

A node joining a WLAN with an AP • (No need for such a procedure in a wired LAN) • Two ways for a node to join a WLAN – Passive scanning • Scan a channel for a Beacon frame • If a Beacon frame is received – Negotiate Authentication and Association processes

– Active Scanning • Transmit a Probe frame • If a Probe Response is received – Negotiate Authentication and Authorization processes 76

Suggest Documents