welcome - jie bo's home pagetijiebo.com/material/cs2105/cs2105 - revision.docx · web viewip...

39
QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS Layer Overview Objectives Protocols/Mechanisms Application- layer message Supports network applications, client-server/P2P/Hybrid e.g. FTP, SMTP, HTTP, DNS Assumes that socket is black box so just pick up the data. Therefore, transport layer should take note of reliability, throughput, delay and security Types of messages exchanged Message syntax Message semantics Rules for when and how applications send & respond to messages Transport- layer segment Process-to-process data transfer e.g., TCP, UDP Data Integrity Reliable data transfer Handle delays/reordering Throughput Security Network- layer datagram Routing of datagrams from source to destination, host-to-host e.g., IP Runs on routers Delivers packets to receiving hosts DHCP 1 CIDR 2 RIP 3 NAT 4 IP Fragmentat ion ICMP 5 Link-layer frame Data transfer between neighbouring network elements e.g., Ethernet, WiFi Error Detection Error Correction CRC (Cyclic Redundancy Check) TDMA FDMA ALOHA CSMA MAC Addressing ARP 1 Dynamic Host Configuration Protocol – Runs in Transport Layer 2 Classless Inter-Domain Routing 3 Routing Information Protocol 4 Network Address Translation 5 Internet Control Message Protocol 1

Upload: others

Post on 15-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Layer Overview Objectives Protocols/MechanismsApplication-layer message

Supports network applications, client-server/P2P/Hybride.g. FTP, SMTP, HTTP, DNS

Assumes that socket is black box so just pick up the data. Therefore, transport layer should take note of reliability, throughput, delay and security

Types of messages exchanged

Message syntax

Message semantics

Rules for when and how applications send & respond to messages

Transport-layer segment

Process-to-process data transfere.g., TCP, UDP

Data Integrity Reliable data transfer

Handle delays/reordering

Throughput

Security

Network-layer datagram

Routing of datagrams from source to destination, host-to-hoste.g., IPRuns on routers

Delivers packets to receiving hosts DHCP1

CIDR2

RIP3

NAT4

IP FragmentationICMP5

Link-layer frame Data transfer between neighbouring network elementse.g., Ethernet, WiFi

Error DetectionError Correction

CRC (Cyclic Redundancy Check)TDMAFDMA

ALOHACSMAMAC AddressingARP

Physical Bits “on the wire”

Overview

1 Dynamic Host Configuration Protocol – Runs in Transport Layer2 Classless Inter-Domain Routing3 Routing Information Protocol4 Network Address Translation5 Internet Control Message Protocol

1

Page 2: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

2

Page 3: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Lecture 1: Introduction

TerminologyCircuit Switching Traditional telephone networks, no congestion no delay

Before sending data, links are reserved for the connectionGood for networks involving long sessions with predictable smooth bandwidth requirements so wastage is minimized

Packet Switching Sends packet-by-packetEntire packet must arrive at a router before transmitting forward

Throughput Bits communicated per unit timeE.g., Send F bits for two links with link capacity R s and Rc bits/s respectively

Throughput= FFRc

+ FR s

, the denominator is basically the total time needed to route

Four sources of packet delay:

Processing Delay Occurs in the router when the router processes the packet (e.g., check bit errors or determine output link)In the milliseconds

Queuing Delay Occurs in the router. Time spent waiting at output link for transmission. Dependant on queue sizeFor this course, queuing delay is the time needed for packets before it to be transmitted

dqueue=nL+ (L−x )

Rwhere L is packet size, n is number of packets in front, and x is bytes currently being transmitted

Depends on congestion level of routerTransmission Delay

Time taken to get the last byte of the packet into the link. Hence, if packet size is a lot bigger than link bandwidth, have to wait

d trans=Packet ¿¿Link Bandwidth¿

Without Message Segmentationt=File ¿¿ LinkBandwidth×no .of links ¿

Message Segmentationt=time ¿one link ×no . if links+¿

(no .of packets−1 )×time ¿one linkOR

t=time ¿ first link×(no .of packets+no .of links−1)

E.g., no. of packets = 4000, no. of links = 3t=L/R×4000+2

Propagation Delay

Time taken for signal to travel from start to end of wire. Dependant on length of physical link

d¿=Length of physical link

Propagation Speed∈mediummaximumbits∈the link at giventime=min¿¿bandwidth delay product=R ∙d¿

3

Page 4: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Lecture 2 & 3: Application Layer

Application Layer defines:

- Types of messages exchanged- Message syntax- Message semantics- Rules for when and how applications send & respond to messages

HTTP – Hypertext Transfer Protocol

A protocol uses handshaking if two entities first exchange control packets before sending packets over.

1.0: Non-persistent

Need to establish handshake for each object(2×RTT+File transmissiontime) per object

1.1: Persistent

Sends request for referenced objects asapWith pipelining, can have one RTT for ALL referenced

objects (bounded by link bandwidth)Request MessageGET /~jiebo/index.html HTTP/1.1Host: www.comp.nus.edu.sgUser-Agent: Mozilla/5.0Connection: close\r\n

Response MessageHTTP/1.1 200 OKDate: Thu, 15 Jan 2015 13:02:41 GMTServer: Apache/2.4.6 (Unix)Content-Type: text/html\r\n

See Glossary for Cheat Sheet

HTTP, FTP, SMTP, and POP3 all run on TCP because they require all application data to be received in the right order without gaps.

HTTP uses Content-Length header field to indicate the length of a message body

DNS – Domain Name System

Host Local DNS Server (cache) Top-level domain servers OR Authoritative servers Lower level DNS server (if needed)

A DNS server higher in the DNS hierarchy delegates a DNS query to a DNS server lower in the hierarchy by sending back to the DNS client the name of that lower-level DNS server

4

Server/client can at any time send Connection: close to terminate persistent connection

Page 5: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Sockets

Applications run in hosts as processes.Within the same host, two processes communicate using inter-process communication (OS)

Between different hosts, communication is done by exchanging messages (protocol)

IP No. finds the computer, Port No. finds the process (wrong port data sent to wrong process error)

Stream Socket (TCP Socket) Datagram Socket (UDP Socket)Socket is the software interface between processes and transport layer protocols

Processes treat the Internet as a black box, sending and receiving messages through socketsConnection-oriented, reliable Connection-less, unreliable (data may be lost,

corrupted, or received out of order)Server is running and listening for clientUpon contact, server opens a new socket for client (client SHOULD not have more than 2 connections)When connection is established, data flows in continuous streams

Client explicitly attaches destination IP and port number to every packetServer extracts and reply if neededONE socket for all clientIf overflow? Can overflow?

Server Code// Server is waitingServerSocket welcome = new ServerSocket(port);

while (true) { // accept() returns a new socket Socket s = welcome.accept();

// getInputStream() reads from socket Scanner sc = new Scanner(s.getInputStream()); String str = sc.nextLine();

PrintWriter wr; wr = new PrintWriter(s.getOutputStream(), true);

wr.printIn();}

Note: ServerSocket VS Socket

// Server is waitingDatagramSocket s = new DatagramSocket(port);

// Need this to receive the packetsbyte[] buffer = new byte[1000];

while(true) { DatagramPacket pkt; pkt = new DatagramPacket(buffer, buffer.length);

// Receive packet s.receive(pkt); String data = new String(pkt.getData(), 0, pkt.getLength();

// Create packet to be sent InetAddress clientAdd = pkt.getAddress(); int clientPort = pkt.getPort(); pkt = new DatagramPacket(str.getBytes(), str.length, clientAdd, clientPort);

// Send packet s.send(pkt); }

Client Code// Create client socket and connect to serverSocket s = new Socket(serverIP, serverPort);

// Output to serverPrintWriter wr;wr = new PrintWriter(s.getOutputStream(), true);wr.printIn(); // Can be anything

// Read from serverScanner sc = new Scanner(s.getInputStream());String str = sc.nextLine();

s.close();

// Create client socketDatagramSocket s = new DatagramSocket();

// Create packet to sendDatagramPacket pkt = new DatagramPacket(sendData.getBytes(), sendData.length, serverAdd, serverPort);s.send(pkt);

// Receive packetbyte[] buffer = new byte[1000];pkt = new DatagramPacket(buffer, buffer.length);s.receive(pkt);String str = new String(pkt.getData(), 0, pkt.getLength();

s.close();

5

Page 6: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Lecture 4 & 5: Transport Layer

Transport layer is responsible for:

Sender side: break application message into segments and pass them to the network layerReceiver side: Reassemble segments into message and pass it to application laterPacket switches (router) in between: only check destination IP address to decide routing

UDP can be done in one RTT (client send, server accept). TCP at least 2 RTTs, first to set up.UDP also doesn’t have TCP’s flow & congestion control which is not necessary for applications like VoIPUDP has more control and specify what is in one packet unlike TCP which writes to connection send buffer

Reliable Data Transfer (underlying concepts of TCP)

rdt 1.0 – Assume underlying channel is perfectly reliable Sender just sends, receiver just receives. All’s good. Nothing much, moving on!

rdt 2.0 – Assume underlying channel is may flip bits in packets (i.e., no packet loss) Receiver will use checksum to detect bit errors Use ACK & NAK for recovery

rdt 2.1 – rdt 2.0 + packet sequence number (1s or 0s)

Sender transmits packet sequence number so receiver knows it’s duplicate and can discard.Can handle 1) corrupted ACK; and 2) corrupted packet

6

This is wrong. Should send pkt0

Since Receiver has no mechanisms to check for duplicate packets, this is a problem

Page 7: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

rdt 2.2 – ACK0/ACK1 instead of ACK/NAK

rdt 3.0 – Channel may: 1) Flip bits; 2) Packet loss; 3) Long packet delay; 4) WILL NOT reorderUtilization Formula

7

This is wrong. Should send pkt0

Page 8: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

U sender=L/R

RTT+L/R,basically , transmission delay

propagationdelay+transmissiondelay

8

Page 9: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Pipelining: Go-bank-N

GBN Sender GBN Receiver- Up to N unacknowledged packets in pipeline

(window size N)- Insert sequence number in packet header- Sliding window tracks unacknowledged

packets- Timeout for oldest unacknowledged

retransmit packet n and all subsequent packets in the window

- Acknowledge packets that arrive in order only remember expectedSeqNum

- Discard out-of-order packets and acknowledge last in-order packet

“ACKM” means all packets up to M are received

9

Page 10: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Pipelining: Selective Repeat

SR Sender SR Receiver- Maintains timer for each unacknowledged

packet when timeout, retransmit only that

packet

- Individually acknowledges all correctly received packets

Buffer out-of-order packets

Note: Sender & Receiver window may not always be synchronized sender is unable to proceed until ACK (see below)

SR Sender Behaviour SR Receiver BehaviourData from application layer: If next sequence number available in window,

sendtimeout(n) Resend pkt(n), restart timer

ACK(n) is within window Mark pkt(n) as received If n is the smallest, advance window to next

unacknowledged number

pkt(n) in forward window Send ACK(n) If out-of-order, buffer If in-order, advance window to next not-yet-

received packetpkt(n) in rear window [base-N, base-1] ACK(n)

otherwise (i.e., pkt too far forward or back) Ignore (can cause window sync problems)

Summary

Defence Mechanism Problem rdt1.0 rdt2.0 rdt2.1/2.2 rdt3.0Timeout & retransmission Packet Delay YSequence Number Duplicate data Y (1s & 0s) Y (1s & 0s)Acknowledgement Packet Loss/Corruption Y Y YChecksum Corruption Y Y Y

10

Page 11: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

TCP – Transport Control Protocol

1) Connection-oriented: handshaking before sending app data2) Reliable, in-order byte stream: application processes pass data to TCP; TCP forms packets with

Maximum Segment Size (UDP forms packet as DatagramPacket)

TCP Sender TCP ReceiverData from application layer:

Create TCP segment, NextSeqNum If(timer not running) start timer;Pass segment to Network layerNextSeqNum += length(data);

timeoutResend not-yet-acknowledged segment

with smallest sequence numberStart timer

ACK=1, ACK field=yif(y > SendBase) {

SendBase = y; if(some unacknowledged segment)

start timer;}

Arrival of in-order segment and all data up-to-dateWait for 500ms to see if another segment

is coming. If nothing, send ACK If next segment arrives, send just ONE

single ACK for both segmentsArrival of out-of-order segment (higher than expected SEQ number) gap is formed

Send duplicate ACK, expecting the correct segment

Arrival of segment that partially/completely fills gapSend ACK if some gap is filled

11

Both sides will randomly generate a SEQ number. It is used as the initial offset

Page 12: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

TCP Timeout Value

EstimatedRTT= (1−α )× EstimatedRTT+α×SampleRTTDevRTT=(1−β )×DevRTT +β ×|SampleRTT−EstimatedRTT|

TimeoutInterval=EstimatedRTT +4×DevRTT

Note: For workings, see textbook exercises, Chap3, P29

12

Page 13: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Lecture 6 & 7: Network Layer

Network layer provides communication service between any two hosts, i.e., forwarding and routingHosts normally have one IP, while routers have one for each interface

Covered in this layer are:

1) DHCP2) IP Addressing and subnet masks, CIDR & Forwarding Tables3) Routing protocols 4) NAT 5) IP Fragmentation6) ICMP (refer to Lecture 7)

DHCP – Dynamic Host Configuration Protocol (runs over UDP)

D iscovery DHCP server Port always 68DHCP client Port always 67Source IP 0.0.0.0 is special for DHCPDest IP 255.255.255.255 is broadcast addr

O ffer ≥ one DHCP server may reply to client

R equest Client will broadcast their accepted IP

A cknowledge Owning DHCP server will acknowledge

IP Addressing and subnet masks & Forwarding Tables

a .b . c . d / x ,where x isthe number of bits∈subnet prefix of IPaddress

Subnet prefix Host IDIP Address in binary 11001000 00010111 0001000 0 00101010Subnet Mask in binary 11111111 11111111 1111111 0 00000000Subnet Mask in decimal 255.255.255.254.0

A Forwarding Table within a Router looks at (only) the destination IP address and checks all entries in its forwarding table to decide which interface to use

E.g. Forwarding Table

Net Mask Net mask in binary Link Interface/Router200.23.16.0/20 11001000 00010111 00010000 00000000 0200.23.18.0/23 11001000 00010111 00010010 00000000 1199.31.0.0/16 11000111 00011111 00000000 00000000 1

200.23.19.3 1

13

Page 14: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Refer to Lecture 6 for Longest Prefix Match

14

Page 15: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Routing Protocols: Routing Information Protocol (RIP), UDP Port 520

d x ( y )=min {c ( x , v )+d v ( y ) }

- Uses hop count as cost metric, i.e., will take shorter path even if it’s highly congested- Entries in routing table of each router are the subnet masks (e.g., 255.255.254.0/23)- RIP runs on UDP faster, don’t need 3-way handshake as in TCP- Routing table exchanged every 30s over UDP port 520- If no update from neighbour router for 3min, remove neighbour from routing table

Network Address Translation

1: OutgoingREPLACE source IP & port NAT IP & new port

2. OutgoingREMEMBER mapping in translation table

NAT translation tableWAN side LAN side

137.132.228.5, 5001 172.26.184.3, 3213

3. IncomingREMEMBER mapping from translation table

4. IncomingREPLACE NAT IP & new port source IP and port

IP Fragmentation

Refer to Lecture 7 for IP Datagram Header format

Fragmentation is done by the routers

IPv4’s header size is always 20 bytes; Max Transfer Unit is max amount of data a link-level frame can carry, i.e., including header size

1200 byte datagram500 bytes MTU

offset is in units of 8 bytes

flag = 0 no more segments behind

1180 = 480 + 480 + 220

15

Page 16: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Lecture 9 & 10: Link Layer

Link layer sends datagram between adjacent nodes over a single linkLink layer is implemented in the Network Interface Card; Host normally have two, while router has multiple

Covered in this layer are:

- Error Detection & Correction: Parity and CRC- Point-to-point link simple, bi-directional so no collisions- Multiple Access Protocols- MAC Address + ARP- Switches and switching

Multiple Access ProtocolsChannel Partitioning Taking Turns Random AccessTDMAFDMA

PollingToken Passing

Slotted ALOHAPure ALOHACSMA/CDCSMA/CA

Error Detection & Correction

Refer to Lecture 9 for Parity Checking

Cyclic Redundancy Check (CRC)

CRC calculation is done in bit-wise XOR operation without carry or borrowSender appends remainder at the end of data bits so that when receiver divides it by G no remainderG has r+1 bits remainder has r bits

Multiple Access Protocols – Channel Partitioning

Time Division Multiple Access Frequency Division Multiple Access

Unused slots 2, 5, and 6 are idle

E.g. Radio

Frequency bands 2, 5, and 6 are idle

Multiple Access Protocols – “Taking Turns”

Polling Token PassingMaster node acts as marshaller, inviting nodes to transmit in turns. Normally there’s a time limit

Con: At least one RTT for each nodeCon: Single point of failure, master node down, GG

Control token passed from one node to anotherNormally there’s a time limit

Con: Extra time to send to next node: dprop of tokenCon: Single point of failure. If token corrupted, GG

Multiple Access Protocols – Random Access Protocols

This Protocol has WASTAGE

Random Access protocols specifies: 1) How to detect collisions; 2) How to recover from collisions

Refer to Lecture 9 for ALOHA because it’s pretty stupid

16

Page 17: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

CSMA Overview

Sense the channel before transmission, if (idle) { transmit } else if ( busy ) { defer sending, choose k={1…2m-1} }Collisions can still occur because of propagation delay

Carrier Sense Multiple Access/Collision Detection

Used in Ethernet

Principles:1) To ensure that dprop will never be too large

such that a collision is unnoticed min frame ¿bandwidth×RTT min frame ¿ L>2×d¿×R

2) Once a collision in detected while transmitting, operation is aborted

3) After aborting, NIC enters binary back-offa. After mth collision, NIC chooses K at

random from where P (K )= 12m

b. NIC waits K ×512 bit time

Carrier Sense Multiple Access/Collision Avoidance

Used in WiFi

Process:1) If sensed that channel is idle, begin

transmission2) Else choose a backoff value using

exponential backoff3) Transmit the entire frame and wait for

acknowledgement4) If ACK is received, begin next frame

A lot of waiting because the whole point is to avoid collisions since collisions cannot be

detected. Hence, when one sends, it sends the WHOLE THING

17

Page 18: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

MAC Address + ARP

EVERY NIC HAS A MAC ADDRESSAddressing Resolution Protocol translates: network-layer (IP) link-layer (MAC) addresses

Same subnet1.Two IP addresses are encapsulated as part of the link layer’s payload

2.All nodes receive but only B will process

Different subnet1.Router sees that IP is not local, it will check its routing table and if it has a route to dest IP, reply with its own MAC addr

2.Router extracts IP datagram, creates new frame with it then send Note changes in

MAC addresses

Switches and switching

Refer to Lecture 10 for Ethernet Frame Structure. Preamble is the weird part

Self-learning:

1) When receiving a frame from A, note down location in switch table2) If B is found in table, forward frame to B only3) Else, broadcast frame to all outgoing links (minus origin)

18

Page 19: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Lecture 11: Physical Layer

Basically two different medium of transmission, Digital and Analog

Digital

0 1 0 0 1 1 1 0

NRZ-L time

NRZ-I time

0 1 0 0

RZ time

Manchester time

Non-Return-to-Zero-LevelAbsolute voltage level determines value of bite.g., High 0, Low 1

Non-Return-to-Zero-InvertInvert the voltage if bit 1 is encounteredStarting volt level should be specified

Return-to-ZeroThree voltage levels, always return voltage to zero halfway through bit interval.

ManchesterInverts signal in the middle of bit intervalE.g., -ve to +ve 1

+ve to -ve 0

Analog

ShannonCapacity=B× log2 (1+SNR )Bandwidthof achannel ,B=Highest f−Lowest fSignal ¿Noise Ratio, SNR=Strength of Signal /Noise

Frequency Shift KeyingAmplitude and phase remain constantFSK limited by bandwidth

2 freq 1 bit4 freq 2 bits

BUT more susceptible to noise

Amplitude Shift KeyingVary the amplitude to signal data valuesASK susceptible to noise

Phase Shit KeyingChange the phase of the signal to represent dataMore phases

Difference between phases is smaller Channel can distort phases

E.g., 8-PSK means 3-bits per signal

Quadrature Amplitude ModulationCombination of ASK and PSK. Every signal differ in either amplitude or phase

A signal unit in a 2k-QAM represents k bitsBaud rate is number of signal units sent per secondBit rate is number of bits receiver receives per second

Bit Rate=μ×Baud Rate×kμ is proportion of signalsreceived by receiver

19

Page 20: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Lecture 8: Network Security

Objectives Strategy MechanismMessage confidentiality Encrypt message so nobody can read 1) Symmetric key

2) Public keyMessage Integrity Implement check that original message

is not modifiedCryptographic hash functions

Message Authenticity Ensure message is indeed sent by sender

1) Message Authentication Code2) Digital Signature

Symmetric Key VS Public Key

Symmetric Key Public Key

Con: How do you agree on a key in the first place? Key distribution is a problem

Popular Algorithms: Data Encryption Standard, Advanced Encryption Standard, WEP for WiFi

Alice can encrypt with private key which Bob can then decrypt with public key Alice is the real sender

Popular Algorithms: RSAIn practice, Alice and Bob use RSA to exchange symmetric key (session key) KS.

Once both have KS, they use symmetric key cryptography

Hashing

Hashing should be one-way & no two message should have same hash H (m )≠ H (m')

Popular Algorithms: MD5, SHA-1

Message Authentication Code VS Digital Signature

Message Authentication Code Digital SignatureShared key is part of the message digest generation, i.e., MD5 enhanced. Sends m+H (m+s)Receiver extracts m’ and generates H (m'+s ) using own copy of sand compares the two digestSince key is shared, impossible to key who authored the message

Sender encrypts message (or hash) with own private key the sent message must be written by sender

Since key is private, message must be authored by sender

Refer to Lecture 8 for Message Authentication in action

20

Page 21: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Glossary

request-header

Accept: Used to specify certain media types acceptable for the response, e.g., JSONAccept-Charset: Indicate what character sets are acceptable for the responseAuthorization: Consists of credentials containing the authentication information of the user agentExpect: To indicate server behaviours requested by client. If unable to fulfil, respond with ERROR 417From: SHOULD contain email address for human user Host: Specifies internet host and port number of resource being requested If-Modified-Since: If requested variant not modified since time specified, server will NOT return anything (304) Max-Forwards: A mechanism for TRACE and OPTIONS methods to limit number of forward requestsRange: Byte-rangeReferer: Used to generate lists of back-lists to resources for interest, logging, optimized cachingUser-Agent: Information about user agent originating the request. Product token listed in order of significance

response-header

Date: The date and time at which the message was originatedServer: Software used by origin server to handle request, e.g. ApacheAccept-Ranges: What partial content range types this server supportsContent-Type: Indicates the media type of the entity-body sent Content-Length: The length of the response body in bytesStatus: Status of the HTTP response, e.g. 200Keep-Alive: timeout-time host will allow idle connection to remain open before closing; max-maximum number of requests that a client will make on the persistent connection

21

Page 22: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

Network Commands

tracert <IP Address OR URL>

1 is the internet gateway on my network. i.e., my home’s IP address2 is the ISP6 is the Singapore Internet Exchange7 – 8 is the Singapore Open Exchange9 is Dynamic DNS Service16 is the computer which comp.nus.edu.sg is hosted on

Each hop is tested 3 times 3 columns of timingsTimeout meant that there was no response from the router, so another one was tried

-d Specifies to not resolve addresses to host names

-h maximum_hops Specifies the maximum number of hops to search for the target

-j host-list Specifies loose source route along the host-list

-w timeout Waits the number of milliseconds specified by timeout for each reply

target_host Specifies the name or IP address of the target host

22

Page 23: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

ping <IP Address> |-L <number> (to increase packet size)

Outcome Probable CauseFour replies (see above) Workstation able to communicate with specified host at TCP/IP levelFour timeouts TTL expired:

- Communication problems between two machines (cable/routing table)

- Has communications but too slow for ping (network congestion?)- Firewalls blocking ICMP

Some replies, some timeouts Network congestion, bad network cabling, or faulty hardwareTransit failed TCP/IP not configured correctly on current workstation.Can ping IP but not domain name

DNS server may be wrongly configure

To troubleshoot:

1) Ping default gateway (see ipconfig) Can reach gateway router2) Ping DNS server (see ipconfig) Can reach DNS server3) nslookup (see nslookup) the destination domain name DNS server can resolve the domain name4) Ping the returned IP addr from (3) Can reach destination server5)

23

Page 24: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

ipconfig /all

ipconfig /flushdns to clear DNS cache value on your computer. DNS uses TTL (Time-To-Live) value which let the intermediate name servers to cache DNS information. If you changed your DNS settings, and your computer doesn't see the change immediately, you may perform "ipconfig /flushdns" to clear the DNS cache.

24

Private IP assigned by

router

Page 25: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

nslookup

If IP Address is listed, DNS query was successful.

If IP addr is different from the destination IP, DNS poisoning may have occurred. In which case,

ipconfig /flushdns

netstat

netstat used to view your active network connections and TCP/IP connections. Determine what ports are open and used, what programs are using your ports and what kind of TCP and UDP connections are present.

25

Dropbox

Page 26: Welcome - Jie Bo's Home Pagetijiebo.com/material/CS2105/CS2105 - Revision.docx · Web viewIP Addressing and subnet masks & Forwarding Tables a.b.c.d/x, where x is the number of bits

QUICK REFERENCE GUIDE CS2105 – INTRODUCTION TO COMPUTER NETWORKS

getmac

Mine has 4 Network Interface cards

arp –a

If I search 9C:5C:8E:B6:6D:E0, I get ASUSTEK Computer INC., which is correct

26

From ipconfig, we know that this is the

default gateway