Anda di halaman 1dari 172

ISM 6225

Distributed
Information Systems
LEC T UR E 9 – N E T WORKING BAS I CS : OS I MODE L
BA S E D ON AG R AWA L A N D S HA R MA , P ROS PEC T P R ESS
Agenda
1. Networking overview
2. Physical layer
3. Data link layer
4. Network layer
5. Transport layer
6. Application layer
7. Wide area networks

Useful links at: http://www.ismlab.usf.edu/dcom/

2
1. Networking overview
• Definition
• Utility of computer networking
• Technology milestones
• Packetization
• Layering
• TCP/ IP model
• OSI model
• Principles of Internet protocols

3
Typical data network
ISP network

Optical fiber

Campus network

Home
network
Web server
Unique features of computer
networks
• Common set of technologies support all networked computer
applications
◦ Email, IM, browsing, client-server etc
◦ Therefore, any laptop can perform all these functions

• Basic principles unchanged for over 4 decades


◦ Likely to persist in near future

• An essential component of modern economy


Overarching principle in
networking
• Maximize resource utilization efficiency
◦ Primarily in the cable plant
◦ Also in energy efficiency
◦ Increase in technical complexity is acceptable
◦ Because dedicated hardware for networking tasks is affordable
◦ E.g. routers
◦ Secondary principles
◦ Simplify end user equipment
◦ Hide all complexity in dedicated network equipment

• Seen in analogy with transportation

6
Packetization overview
• Packetization is
◦ breaking down user data into small segments
◦ packaging these segments appropriately so that they can be delivered and
reassembled across the network

• Each segment or packet has two parts


◦ Data to be delivered
◦ Overhead required for successful delivery and integration with other
packets

7
Packets analogy
Packet Letter

To: John Doe To: John Doe


From: Jill Wright Header From: Jill Wright
Sub: Soccer schedule
~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~ Dear Sir
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Body
~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
~~~~~~~
Sincerely
Jill
Packetization in retail
Traffic aggregation
Advantages of packetization
• Communication link costs are now very high relative to switching costs
◦ Efficient utilization of communication links is more important than
conserving computation effort
◦ Dedicated computers can be used as routers

• Eliminates single points of failure in data communication systems


◦ Primary motivation for federal interest in packet communication systems

• Ease of transport

11
Layering
• Arranging functionality in a hierarchical manner, such that
◦ lower layers provide functions and services that support the functions and
services of higher layers

• This is how we create and process packets


• Example (corporate)
◦ VPs help CEOs reach their goals. Managers help VPs reach their goals.
Workers work with tools and machines to help managers reach their goals.

12
Layering examples
• Example (software) Analysts,
regulators,
◦ Similarly, computer applications shareholders

delegate many tasks to operating Browser


systems, which further delegate CEO
tasks to drivers for execution VP Windows

Manager Print driver

Worker

Machines,
tools, work

13
Advantages of layering
• Specializes technology development
• Separation of functionality
◦ Simplification in upgrades
◦ Change from IPv4 to IPv6 does not require change in email clients or
browsers

• Simplification in adding new technology


◦ Adding wireless network capability does not require change in web site
addresses (URLs)

14
Layering in data
communication

End user uses web


browser

Web browser uses network software

Layered network software

Signals sent over physical medium towards web server


Typical packet structure
• Five important datacomm tasks
◦ User needs (e.g. get web page, web page body)
◦ Segmentation and reassembly
◦ Identifying and locating destination
◦ Error control
◦ Signaling - Converting data into a form suitable for transmission over wires

16
Typical packet structure
• These and other related datacomm tasks are accomplished by adding
additional required information to information packets
◦ Packet header
◦ Organized in a layered structure
◦ Routers and end stations use this header information to handle packets
appropriately

• Routers perform packet switching

17
Important header information
Networking task Header information

Specify user needs User commands

Segmentation and reassembly of packets Sequence numbers

Identifying and locating destination Address

Error control Error check

Signaling None
Typical packet structure
• A typical packet contains
◦ Information sent from the layers above
◦ and
◦ Additional information (called headers) specific to the functions of each layer
◦ At a high level, looks like this:

User commands
Error check

Destination

Sequence
address

number

User data

19
5-layered TCP/ IP stack
• Modern computer networks implement layering in 5 layers
• Called the TCP/ IP stack
◦ After the core set of technologies
◦ TCP
◦ IP

• Integrates two popular sets of technologies


◦ TCP/ IP and Ethernet

20
Layer names and tasks
Layer Layer name Networking task Header information
number
5 Application Specify user needs User commands

4 Transport Segmentation and reassembly of packets Sequence numbers

3 Network Identifying and locating destination Address

2 Data-link Error control Error check

1 Physical Signaling None


Principles of Internet protocols
• The Internet would be a network of multiple independent networks
– Each independent network could be of arbitrary design or technology
• These translate to the data link layer in the OSI model (see typical computer network)

• Multiple applications could use the Internet, including those not yet
conceived
– This translates to multiple applications using the same TCP/ IP services for
connectivity

22
Principles of Internet protocols
• Standardized message block to serve any application
-- Baran 1964
◦ Simplifies design of network equipment
◦ All network traffic can be processed in a cookie-cutter manner by routers,
irrespective of application

23
TCP/ IP technologies by layer
Application Application
Application Application Application Application Application layer layer
layer layer layer layer layer
SIP NFS/ SMB
HTTP SMTP FTP SSH IM (File & printer
(VoIP) sharing)

Transport Transport
layer layer

TCP UDP

Network
layer

IP

Data link Data link


Data link layer Data link layer Data link
layer layer layer
Frame Wireless
MPLS Ethernet ATM
Relay LAN
Physical
Physical Physical Physical
layer
layer layer layer
Manchester
SONET QAM(Phone CDMA
encoding
(Optical fiber) modem) (Cell phone)
(Ethernet)

24
A typical computer network

Verizon FiOS network


Cogent network

Legend

Peer
in g po
int

Wireless link
Campus backbone

Optical fiber
Department LAN

Wireless SONET
router
link
(DNS
and Home PC Web server
DHCP
server)
Router

25
Standards reference
• Internet technology standards are publicly available as
Requests For Comment (RFCs)
◦ http://www.ietf.org/rfc.html
• Highly recommended standards
◦ Email: http://www.ietf.org/rfc/rfc0821.txt
◦ HTTP: http://www.ietf.org/rfc/rfc2616.txt
◦ TCP: http://www.ietf.org/rfc/rfc0793.txt
◦ IP: http://www.ietf.org/rfc/rfc0791.txt
◦ TCP/ IP tutorial: http://www.ietf.org/rfc/rfc1180.txt
◦ Domain names: http://www.ietf.org/rfc/rfc1034.txt

26
2. Physical layer
• Functions of the Physical Layer
• Physical media and their properties
• Signals and their properties
• Importance of binary signals
• Signal representation of data
• Multiplexing

27
Physical layer service
definition
• Provide transparent transmission of a bit stream over a circuit built
from some physical communications medium
• ATIS Telecom glossary
◦ http://www.atis.org/glossary/default.aspx
◦ Earlier versions
◦ Federal Standard 1037C
◦ http://www.its.bldrdoc.gov/fs-1037
◦ ANS T1.523-2001, Telecom Glossary 2000
◦ http://www.atis.org/tg2k/

28
The need for signals
• Data cannot be transmitted
◦ E.g. How will you send a word document over a long distance?

• But data can be converted to signals


◦ And signals can be transmitted

• Signal are detectable transmitted energy that can be used to carry


information
• E.g. How are you reading this slide
◦ Light reaches your eyes, the brain interprets the patterns of black and white
as letters and words
Data to signal
Data link layer
10001100 Data from data-link layer

Physical layer

data to signal
transforms
Physical layer

+5V
Signal representation of data
-5V
1 0 0 0 1 1 0 0

Ethernet cable

30
Special feature of the Physical Layer
• Physical layer interacts with nature
– Layer where we are at the mercy of nature
– Depend upon wires, optical fibers or air to transmit signals
• Signal transmitting properties of chosen media are important
• Signals generated by physical layer comply with properties of the medium
• E.g. voltages with copper, light with fiber

31
Physical media and their
properties
• The physical medium is the transmission path along which a signal
propagates
– e.g.: a wire pair, coaxial cable, optical fiber, radio path
• Media are chosen for their special properties that enable efficient
transmission (movement) of signals
– e.g.: most plastics cannot be used as physical media because they do not
efficiently conduct electricity, light, heat or other forms of energy
– Common media are copper wire and optical fiber

32
Copper wire as physical
medium
• Copper is a very good conductor of electricity and is relatively
abundantly available

• When used as a physical medium in computer networking, 8 individual


strands of copper wire are organized as four pairs
– This is called Unshielded twisted-pair (UTP)
– Each pair of wires is twisted around each other
– Twisting reduces interference from induction
– Tighter twisting improves data rates

33
Categories of UTP cables
Cat 3 cable

Cat 5 cable

34
Cable connectors
• Cat5e cables end in RJ 45 connectors
Conductor identification Color code Use
Pair 1 White-Blue/ Blue -
Pair 2 White-Orange/ Orange Transmit data
Pair 3 White-Green/ Green Receive data
Pair 4 White-Brown/ Brown -
PAIR 3

PAIR 2 PAIR 1 PAIR 4

1 2 3 4 5 6 7 8
W-O O W-G BL W-BL G W-BR BR

35
Optical fiber as physical
medium
• Optical fiber is a thin strand of glass that guides light along its length
◦ Can carry large volumes of data over long distances
◦ Weighs much less than copper
◦ Hence dominant in long distance communications

• Typically aggregate traffic is carried over fiber


Aggregating network traffic
from copper to fiber
Optical fiber

Switch

Copper cables

Laptop Laptop Laptop Laptop Laptop Laptop Laptop Laptop


Construction of optical fiber
Cable jacket

Cladding

Core

Coating

Strengthening
fibers

38
Data vs. Signals
• Data:
◦ Representation of facts in a formalized manner suitable for
communication, interpretation, or processing by humans or by
automatic means
◦ e.g.: thoughts in humans or numbers in computer spreadsheets

• Signal:
◦ Detectable transmitted energy that can be used to carry information
or
◦ A time-dependent variation of a characteristic of a physical
phenomenon, used to convey information
◦ e.g.: voice in humans or wire voltage in computer networks

39
Impact of noise on signals
Transmitted signal Received signal
Signal value

Signal value
1 2 3 4 1 2 3 4

Bit period Bit period

• The received signal can get seriously affected by noise. The receiver has to be
able to interpret the result correctly for reliable data transmission

40
Need for binary signals
• Computer systems use binary 2-level signal transmitted
representation for all data

Signal value
◦ Helps reliable reception in the
presence of noise 1 2 3 4

• Consider AM (easy to understand)


Bit period

Data = 0 3-level
Datasignal
=1 transmitted
Data = 2 Data = 0

Signal value

1 2 3 4

Bit period

41
Binary signals 2-level signal + noise
• Detection rule for 2 level signal
(binary)

Signal value
◦ If amplitude < first gridline,
data = 0 1 2 3 4
else data = 1
• Detection rule for 3 level signal
(ternary)
◦ If amplitude < first gridline, Bit period

data = 0 3-level signal + noise


else if amplitude between 2
gridlines
data = 1
Signal value

else data = 2
1 2 3 4

• Clearly ternary systems are


more prone to errors
Bit period

42
Shannon’s theorem (not for tests)
• How much data can you send over a medium?
◦ Defined by the Shannon-Hartley theorem
𝑆
◦ 𝐶 = 𝐵. 𝑙𝑜𝑔2 (1 + )
𝑁
◦ C is the channel capacity in bits/ second
◦ B is the channel bandwidth in Hertz
◦ S and N are the signal and noise levels in Watts
◦ S/N ratio commonly known as the signal-to-noise ratio (SNR)
Hertz
• Unit of frequency
◦ One cycle per second

• Phone line
◦ Sends signals in frequency range 0Hz – 3,400 Hz
◦ Bandwidth = 3,400 – 0 = 3,400 Hz
Signaling
• Sending data as signals
• Consider sending the word “Hello”
• How to send letters h, e, l, l, o on the wire
◦ Sender side
◦ Step 1: Encode letters as binary numbers
◦ Step 2: Modulate carrier signal with binary numbers
◦ Receiver side
◦ Step 3: Demodulate signal into binary numbers
◦ Step 4: Decode binary numbers as letters

45
ASCII code for binary
representation of data
• Standard method to convert characters to binary is ASCII code
◦ Numbers 0-127 represent common characters
◦ http://www.asciitable.com
◦ Decimal to binary conversion shown later (with IP addresses), just accept for
now

Letter Decimal Binary


h 104 01101000
e 101 01100101
l 108 01101100
o 111 01101111

46
Unicode
• Used to represent characters in almost all languages
◦ Including over 75,000 Chinese characters

• ASCII code = Unicode for English characters


• Other characters
◦ 945 – 969 for the Greek characters α – ω
◦ 03b1 – 03c9 in hex (hex discussed in ch 3)
◦ Try typing 03c9 Alt+x in Word
Amplitude modulation
signaling

h e l l o
0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1

Direction of signal flow

48
Receiver operation
• The receiver keeps track of bit periods
◦ If a wave is received during the bit period, it is interpreted as 1, otherwise 0

• These bits are decoded as letters


◦ And the sender’s message is received
Summary
• Signaling at physical layer
• Properties of nature enable signaling
• Good signals enable reliable detection in the presence of noise and
other signals
• UTP – Cat3 (slow) and Cat5e (faster)
• Optical fiber - Multi-mode (short-range) and single-mode (long-range)
• Multiplexing enables efficient utilization of media
3. Data link layer
• Functions of the data-link layer
• Ethernet overview
• CSMA/ CD
• Error detection and correction
• Ethernet frame structure
• Switches

51
Functions of the Data-Link
layer
• ATIS Telecom glossary 2007
◦ Transfer data between devices on the same network
◦ Detect and possibly correct errors that may occur in the Physical Layer

• Ethernet is the most common end-user implementation of the data-


link layer
◦ Most corporate desktops

52
Ethernet
• Most common data link layer technology for end users
• Patented in 1977
◦ But, basis of current end user networks
◦ Easily understood

• Ethernet is a low-cost, high-speed communication technology for small


networks
• An Ethernet network can be up to 100 meters in radius and have up to
250 devices
Early Ethernet diagram
(Robert M. Metcalfe and Dave R. Boggs (1976))

54
Ethernet operation
• A typical end-user network looks like this:

Wireless access point

PC A PC B

Wireless laptop
Ethernet network

File server Network printer


55
Packet in the medium

Wireless access point

PC A PC B

B Data Data B
Wireless laptop
Ethernet network

File server Network printer

56
Ethernet data transmission
• When PC A wants to send data to PC B, it first adds B’s address before
the data
◦ Like putting a letter in an envelope and putting a To: address on top
◦ This is our first example of packetizing

• The packet is then sent into the medium


◦ Similar to dropping the letter into the mailbox

57
Broadcast in Ethernet
• Signal is transmitted to all stations connected to the wire
– Ethernet operation is based on broadcast
– Signal is transmitted to all stations connected to the wire
– All computers on the network get the packet
– But only B opens it

• Note that the receipt process is different from the mail system
– Ethernet packets go to every computer on the network
– But mail only goes to the intended receiver

58
Packet receipt in Ethernet

Wireless access point

Receive and
PC A PC B

process

Data B
Ignore

B Data
Wireless laptop
Ethernet network

Data B
Data B

Ignore

Ignore
File server Network printer
59
Ethernet data reception
• In broadcast, the network does not direct the packet to its correct
destination
– Instead, the packet is simply sent to every computer on the network
• Packet is sure to reach its destination
• Greatly simplifies the technology
• But increases the processing load on each computer on the network
– So, Ethernet cannot be indefinitely large

60
CSMA/ CD - collision
• What if multiple senders want to send data at the same time?
• The outcome is called a collision
• The solution to this problem is called
Carrier Sense Multiple Access with Collision Detection (CSMA/ CD)

61
CSMA/ CD - collision

Wireless access point

PC A PC B

A Data
Data B
Wireless laptop
Ethernet network

File server Network printer


62
CSMA/ CD esentials
• Senders send only when they sense that the medium is silent
◦ All clear; no other computing is sending data

• Continue to listen while sending data


◦ Needed to detect a collision

• If a collision is detected, stop immediately


◦ Wait for some time and try sending again

63
Error detection
• As the packet moves from source to destination, it can get errors
◦ Just as cars can get flat tires from driving

• Errors are caused due to the imperfections of the physical world


◦ Noise from power spikes, outages etc.

• These errors have to be detected


◦ And corrected

64
Error correction in human
communication
• Some human error-correction techniques
◦ Receiver reads back on telephone
◦ credit card number, phone number etc.
◦ Not reliable in computer networks because of possible error-cancellation
◦ Redundant data
◦ Don’t just say tomorrow
◦ Say tomorrow, Thursday, Nov. 16, 2000
◦ Sender contact information
◦ For clarification if necessary

65
Error correction in computer
communication
• The general approach to error detection in data communications is to
add some meta-data to the original data
◦ The meta-data is generated from the data itself
◦ The receiver can re-compute the meta-data and compare the result with
the meta-data sent by the sender

• Accept if results match, reject otherwise

66
Ethernet frames with CRC
Wireless access point

PC A PC B

B Data CRC CRC Data B


Wireless laptop
Ethernet network

File server Network printer

67
Ethernet frame structure
• Previous sections show destination address and CRC fields in Ethernet
• Other information also necessary
– E.g.
• source address – destination for replies
• start of frame – alert receiver about packet arrival
• frame length – inform receiver about packet end

• Source for Ethernet standards:


– http://standards.ieee.org/getieee802/portfolio.html

68
Ethernet frame structure
Destination

Length/ Type
Preamble

address

address
Source Data from IP layer

FCS
SFD

and
Padding

7 Bytes 6 Bytes 6 Bytes 46 – 1500 Bytes

1 Byte 2 Bytes 4 Bytes

Direction of data flow

LSB b0 b1 b2 b3 b4 b5 b6 b7 MSB

Bits within frame transmitted least significant bit first

69
Ethernet fields
• Preamble: Allows receiver to synchronize with sender
◦ 10101010 10101010 10101010 10101010 10101010 10101010 10101010
◦ Bit pattern produces a periodic waveform in the medium when encoded by
the physical layer using Manchester encoding

• Start Frame Delimiter: Indicates start of frame


◦ 10101011

70
Ethernet fields
• Address
◦ 48 bits in length
◦ All 1’s in the destination address is pre-defined to be the broadcast address
on the LAN
◦ Addresses may be universally administered
◦ Assigned by manufacturer
◦ http://standards.ieee.org/faqs/OUI.html
◦ Or locally administered
◦ Assigned by network administrator

71
Ethernet address
representation

72
Ethernet address
• Address
3 Bytes 3 Bytes

Organizationally unique identifier NIC-specific identifier

8 bits of most significant byte

LSB b0 b1 b2 b3 b4 b5 b6 b7 MSB

0: globally administered (OUI)


1: locally administered

73
Ethernet address
representation
• Hexadecimal notation
◦ Address broken up into 12 4-bit blocks
◦ Each 4-bit block is represented as a hexadecimal digit 0-f

Bits Hex Bits Hex Bits Hex Bits Hex


0000 0 0100 4 1000 8 1100 c
0001 1 0101 5 1001 9 1101 d
0010 2 0110 6 1010 a 1110 e
0011 3 0111 7 1011 b 1111 f

74
Ethernet address
representation
• Example Note: Globally unique

0000 0000 0001 0101 1100 0101 0101 0111 0001 1101 0001 1010
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0 0 1 5 c 5 5 7 1 d 1 a

75
Switched Ethernet - state of
the market
• Hubs vs. switches
• Hubs send data out to all computers
– Old technology, but useful for network diagnostics
• Switches only send the data to the intended destination
– This speeds up the network, at extremely low cost
– The map of computers connected to each port is called the forwarding table
– forwarding table of the switch is initially empty
– By reading the source addresses of incoming frames, switches learn the addresses of the
computers connected to each port

76
From Ethernet to the outside world
Internet

Carrier router

Ethernet LAN

Hub/
Switch
File/ DHCP/ DNS
server
Printer
PCs

77
Next chapter
• Ethernet can reliably send data between computers on one network
• To get bigger networks, we connect networks together
• The network layer figures out how to find the correct path from source
to destination through these networks
◦ Without broadcasting
◦ Called point-to-point
Summary
• Why broadcast?
• Why CSMA/ CD?
• Why CRC?
• Why Switches over hubs?

79
4. Network layer
• Functions of network layer
• Internet protocol (IP)
• IP Header
• IP Addresses

• CIDR notation
• Obtaining IP addresses
• IP version 6

80
Functions of the Network layer
• Transfer variable length data packets from a source network to a
destination network via one or more networks
◦ Can optionally maintain different qualities of service

• This task is called Routing


◦ Performed in the network by devices called Routers

81
PC
user
IP data
IP destination =
Web server’s IP
address
IP source = PC

Data Link 1
DL destination = R1's
DL address
DL source = PC’s DL
address

(R1)
Router 1
IP data
IP destination =
Web server’s IP
address
IP source = PC

Data Link 2
DL destination = R2's
DL address
DL source = R1's DL
address

(R2)
Router 2

IP data
IP destination =
Web server’s IP
address
IP source = PC
Data Link 3

DL destination = R3's
DL address
DL source = R2's DL
address
(R3)
Router 3

IP data
IP destination =
Web server’s IP
address
IP source = PC
Data Link 4

DL destination = Web
server’s DL address
DL source = R3's DL
address
Functions of the Network layer

82
Web
server
Routing and road trips
• Consider a long distance road trip

• The source and final destination are like network layer addresses

• Each interstate exit is like a data link layer address


Internet protocol (IP) overview
• Most common protocol at the Network Layer
◦ Estimated usage exceeds 75% of all network traffic

• Specified in RFC 791 (Sep 1981)


• First used on a large scale in BSD UNIX
◦ http://www.isoc.org/internet/history/brief.shtml
◦ Now used by default in all operating systems

84
IP packet within data link
frame
layer Header

layer FCS
Data-Link

Data-Link
IP Data passed to IP from Transport
Header layer

Data
from IP
layer to
data link
layer
IP Header
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Header
Version Type of service Total length
length
Identification Flags Fragment offset

Time to live Protocol Header checksum

Source address

Destination address

Options Padding

Note: Each tick mark represents a bit position

86
IP Addresses
• An address is a unique label that helps locate an entity on a network
• 32-bit values in source and destination address fields
• Every communication interface on every computer on the Internet has
an IP address
• Unlike MAC (Ethernet) addresses, IP addresses are assigned by
network administrators
◦ Provides flexibility in addressing

87
Binary numbers overview
• Binary numbers are extremely important in data communications
◦ IP addresses use binary numbers

• Maximum computer network sizes depend upon sizes of binary


numbers
• You should be able to convert from 8-bit binary numbers to decimal
and vice-versa

88
Using binary numbers
• The most important use of binary numbers in this class is to assign
computer addresses
◦ In this chapter, we focus on assigning computers with a unique label
◦ Using the label to locate the device is covered in the chapters on subnetting and routing
◦ You should be able to determine the maximum number of addresses
possible given the number of binary digits (bits) available for labeling/
addressing

89
Binary numbers as labels
Bits Labels Number of Formula for
labels label count
1 0, 1 ID: 0 ID: 1
2 21

2 00, 01, 10, 11 4 22


ID: 00 ID: 01 ID: 10 ID: 11

3 000, 001, 010, 011, 8 23


100, 101, 110, 111
n 2n

90
Converting from decimal to binary
•Used to compute subnet sizes, broadcast addresses etc.
– You should be comfortable with binary numbers with up to 8 digits
•One technique is to fill-in-the-blanks
– Start with template below
– Place 1 in the leftmost-possible position
– Subtract place-value and repeat until subtraction yields 0

128 64 32 16 8 4 2 1

91
Place values
3 5 8 Digit
100 10 1 Decimal (Base 10)
(102) (101) (100) Place value

1 0 1 Digit
4 2 1 Binary (Base 2)
(22) (21) (20) Place value
Converting from decimal to binary
e.g.: 13310
◦ 128 is less than 133
◦ Hence place 1 over 128, remainder is 133 – 128 = 5
1
128 64 32 16 8 4 2 1

• Largest number less than 5 is 4


– Hence place 1 over 4
– Remainder is 5 - 4 = 1
1 0 0 0 0 1
128 64 32 16 8 4 2 1
• Largest number less than or equal to 1 is 1
– Hence place 1 over 1
– You get: 100001012
93
Converting from decimal to binary
• Try converting the following numbers to binary
◦ 13410
◦ 20010
◦ 24010
◦ 25010

• Hint: When numbers become large, subtraction from 255 may be


easier

94
Converting from binary to decimal
• Use the same template as before
• Add the place values corresponding to the
locations that have 1 in the number
• E.g.: 111000112
1 1 1 0 0 0 1 1
128 64 32 16 8 4 2 1

• In decimal, this number is:


1*128 + 1*64 + 1*32 + 1*2 + 1*1
= 22710
95
Converting from binary to decimal
You should be comfortable working with binary numbers with up to 8 bits
◦ e.g.: 100110112

1 0 0 1 1 0 1 1
128 64 32 16 8 4 2 1

• This number is equal to:


1*128 + 0*64 + 0*32 + 1*16 + 1*8 + 0*4 + 1*2 + 1*1
= 155
• Largest possible number with 8 digits?
96
Converting from binary to decimal
• Try converting the following numbers to decimal
◦ 100001102
◦ 110010002
◦ 111100002
◦ 111110102

97
Dotted decimal notation
• IP addresses are written in dotted decimal notation
◦ 32 bit addresses broken into 4 blocks of 8 bits each
◦ Each block converted to decimal representation
◦ Decimals are separated by dots
◦ E.g.. 192.168.1.5

98
IP Addresses (dotted decimal notation)
• Examples

11000000 10101000 00000001 00000101

192 . 168 . 1 5

99
IP addresses – structure
• IP addresses are not assigned at random like MAC addresses
– Or even on first-come-first-serve basis
• IP addresses have a structure
– Split into network part and host part
• The first few address bits define the organization to which the address
belongs
– Remaining bits are unique to the computer (host) within the organization

100
IP Addresses - structure
• Network part identifies the network (autonomous
system) to which the address belongs
◦ Most commonly associated with telecom carriers
◦ Also, with large organizations such as state universities
• Host part identifies the host within the network
• Host part is generally broken further into subnets
◦ Subnet ID
◦ Host ID
◦ Covered in subnetting chapter

101
IP addresses - structure
Network/ Organization part of IP address Host part of IP address

• Quite analogous to street


10000011 01011011 10000000 01010100
addresses
◦ Home address identifies network as
131 . 91 . 128 . 84
well as host
◦ Street name analogous to network Network ID
part of IP address (FAU)
House number
◦ Home number analogous to host
Home
part of IP address addresses
11 13 15 17

Street address: Sago St.

Full address 11 Sago St. 13 Sago St. 15 Sago St. 17 Sago St.

Computer address

Computer
addresses
0.0.14.11 0.0.14.13 0.0.14.15 0.0.14.17
Network address: 131.91.0.0
131.91.0.0

Full address 131.91.14.11 131.91.14.13 131.91.14.15 131.91.14.17


IP addresses – structure
• This is similar to phone numbers
– 1 (813) 974 - 6716
– NA Tampa USF Office

• Or credit card numbers


◦ 4 31412 34 5678 432 1
◦ Visa Bank Account number Checksum

◦ The last digit is actually an error-detecting checksum


◦ Luhn algorithm

103
IP addresses – structure
• Or zip codes
◦ 3 36 47
◦ State group Region Delivery address (PO)
• Visualization at http://benfry.com/zipdecode

104
Special IP Addresses
• 255.255.255.255
◦ Broadcast on local network to which the host is connected

• 0.0.0.0
◦ Default route

• 127.0.0.1
◦ This computer, or localhost

• All 0’s in the host part


◦ The network address

• All 1’s in the host part


◦ Broadcast on a network to which the host is not connected
◦ E.g. packet addressed to 10.255.255.255

• Reusable addresses
◦ Discussed in support services chapter

105
Obtaining IP addresses
• Regional registries
– IP addresses distributed around the globe
• American Registry for Internet Numbers
– North America and parts of the Caribbean
• RIPE Network Coordination Centre (RIPE NCC)
– Europe, the Middle East and Central Asia
• Asia-Pacific Network Information Centre (APNIC)
– Asia and the Pacific region
• Latin American and Caribbean Internet Address Registry (LACNIC)
– Latin America and parts of the Caribbean region
• African Network Information Centre (AfriNIC)
– Africa

106
Obtaining IP addresses
• Registries prefer allocating large address pools to large carriers
– Simplifies routing
• RFC 2050
– Sec 2.1: ISPs who exchange routing information with other ISPs at multiple
locations and operate without default routing may request space directly
from the regional registry in its geographical area
• Most organizations will obtain IP addresses from these carriers (ISPs)

107
Obtaining IP addresses
• Requesting initial allocation from ARIN
– http://www.arin.net/registration/guidelines/ipv4_initial_alloc.html
• ARIN allocation pre-requisites
– http://www.arin.net/policy/nrpm.html#four
• Assigned network addresses
– RFC 790 (1981)
– http://www.iana.org/assignments/ipv4-address-space (current)

108
IP version 6
• Current version of IP is 4
◦ IPv4 has one major limitation
◦ Running out of IP addresses
◦ Problem particularly acute outside U.S.
◦ Total IPv4 address pool
◦ 232 = 4,294,967,296 (about 4 billion)
◦ Approx 1 IP address per person
◦ But allocation is not very efficient
◦ Could run out of addresses at about 15% utilization

109
IP version 6 overview
• IPv6 defined in RFC 2460
• Primarily expands source and destination address fields
• Also simplifies packet processing at routers
◦ Eliminates header checksum
◦ Modern networks assumed to be fairly robust

• And adds some telecom carrier-friendly features such as flow labels

110
IP version 6 address pool
• IP version 6 is mainly intended to eliminate shortage of IP addresses
◦ Total address pool = 2128 addresses =
◦ 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses (340 * 1036)

• Surface area of earth = 510,007,200,000,000 m2 (510*1012 m2)


◦ 600 billion trillion IP addresses per square meter of the Earth’s surface
(including oceans, deserts etc)

111
IP version 6 header
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Version Traffic class Flow label

Payload length Next header Hop limit

Source address

Destination address

Note: Each tick mark represents a bit position

112
IP version 6 header fields
• Version
◦ 6

• Traffic class
◦ Similar to IPv4 TOS field
◦ Allows sender to specify service priority for data

• Flow label
◦ Allows sender to label a few packets for special handling

113
IP version 6 header fields
• Payload length
◦ Length of data in packet
◦ Similar to total length field in IPv4

• Next header
◦ Transport layer user of IP
◦ Same as protocol field in IPv4
◦ Specified in RFC 1700

• Hop limit
◦ Same as TTL field of IPv4

114
IPv6 addressing example - USF

115
IPv6 addressing example - USF
• Arrived after numerous iterations
◦ First 8 bits in host part are currently reserved
◦ i.e. unused
◦ future-proofing
◦ Remaining bits
◦ First distributed among branch campuses
◦ Each institution partitions available bits according to its needs

116
IPv6 address notation - hex
• 128 bits written as 8 blocks of 4 hex characters each
◦ Each hex character represents 4 bits
◦ Ref: Ethernet chapter
◦ 8*4*4 = 128
◦ E.g. 2001:abcd:2346:1234:a1b5:fedc:0011:35ac

• Compaction rules specified in RFC 5952

117
IPv6 address compaction rules
• Leading zeros in an individual 16-bit field must be omitted, e.g.
◦ 2001:0db8:aaaa:0000:0000:0000:eeee:0001
◦ Must be written as
◦ 2001:db8:aaaa:0000:0000:0000:eeee:1

• A single 0000 field must be written as 0, e.g.


◦ Above IP address must be written as
◦ 2001:db8:aaaa:0:0:0:eeee:1

118
IPv6 address compaction rules
• :: indicates successive blocks of 0 fields
◦ Can only appear once in an address
◦ Must be used to its maximum capability

• Above address must be further compressed as


◦ 2001:db8:aaaa::eeee:1

• Address 2001:0:0:1:0:0:0:1 must be written as


◦ 2001:0:0:1::1
◦ since it compresses 3 fields.

119
IPv6 address compaction rules
• When there is a tie for possible uses of ::
◦ First possible occurrence of :: must be used

• The hex characters a, b, c, d, e, f must be written in lower case


◦ Ensures compatibility with computer string matching algorithms

• Result is guaranteed to be a unique representation of an address

120
Summary
• Functions of IP
• Why different parts of IP addresses
• Why CIDR
• Obtaining IP addresses
• IP version 6
5. Transport layer
• Need for TCP
• TCP functions
– Segmentation
– Reliability
– Flow-control
– Multiplexing
– Connection establishment
• TCP Header
• UDP

122
The need for a Transport layer
• The network layer (IP) sends packets of data to their correct
destinations with best effort
– Packets may get lost in transit
• Therefore, network layer is not adequate for most applications to
work correctly
• The maximum packet size in IP is 65,536 bytes
– What happens if the application wants to send a file of size 5,000,000
bytes?
– Need to break files into smaller blocks at the sender end and re-assemble these blocks into the
file at the receiving end

• Port addressing
◦ Distinguish between applications on computers

123
The Transport layer in the
stack
Other
Application
http smtp sip application
layer
protocols

Transport
Transport layer
layer

Network
IP
layer

Data Link
Local network
layer
Transport Control Protocol
(TCP)
• These (and other related jobs) are performed by the Transport layer
– TCP (Transmission Control Protocol) is the most popular protocol at the
transport layer
– For simpler tasks, another protocol – UDP is also defined
• TCP is a highly reliable host-to-host transport layer protocol over
packet switched networks
– Defined in RFC 793 (Sep 1981)

125
Transport layer - reference
• TCP
◦ RFC 793 (Sep 1981)

• UDP
◦ RFC 768 (Aug 1980)

126
TCP – Overview of operation
• At the sending end, the application creates the data to be sent and
passes it to its TCP module for transmission
◦ TCP fragments the data, adds sequence numbers to the fragments and
hands them off to IP

• At the receiving end, TCP collects all fragments from IP, reassembles
them into the original data and passes it to the receiving application

127
TCP functions
• TCP provides a reliable application-to-application communication
service over a network of arbitrary complexity and unreliability
◦ Applications (such as browsers and email) simply pass the data to be
transferred to TCP and leave all communication complexities to TCP

128
TCP functions
• TCP corrects for all possible imperfections of IP
• Therefore TCP has to perform many tasks
– Segmentation
– Reliability
– Multiplexing
– Flow-control
– Connection establishment

129
TCP functions - segmentation
• TCP allows IP to transfer arbitrarily large data blocks
◦ Accomplished by breaking data into segments
◦ A sequence number is assigned to each datagram
◦ Sequence numbers help receiver order datagrams even when received out
of order

130
Sequence numbers
Application layer data

Data length = 930 Bytes

To transport layer

Segmentation by transport layer

TCP segment 1 TCP segment 2 TCP segment 3

Sequence number = 1 Sequence number = 301 Sequence number = 621


Length = 300 Length = 320 Length = 310
transmission

transmission

transmission
To IP for

To IP for

To IP for
Sequence number of a TCP sequence number of the previous segment
=
segment + length of previous segment
131
TCP functions - reliability
• TCP recovers from network damage to data
• Basic mechanism
◦ Receiver sends a positive acknowledgment (ACK) if all goes well
◦ If the ACK is not received within a timeout interval, the sender retransmits
the data

• Datagrams may also get duplicated


◦ Sequence numbers help identify these duplicates

132
Sequence numbers and
reliability
Sender Receiver

TCP segment 1

Sequence number = 1 TCP segment 1


Length = 300
Sequence number = 1
ACK 301 Length = 300

TCP segment 2

Sequence number = 301 TCP segment 2


Length = 320
Sequence number = 301
ACK 622
Length = 320

Sender times out

TCP segment 2

Sequence number = 301 TCP segment 2


Length = 320
Sequence number = 301
ACK 622 Length = 320

133
TCP functions - reliability
• Datagrams may get seriously damaged during transmission
◦ If datagrams are further fragmented by IP, some IP fragments may get lost
during transmission
◦ These errors cannot be detected by Ethernet
◦ Such damage is corrected by adding a checksum to each datagram and
comparing it at the receiver
◦ Damaged datagrams are discarded and retransmitted by sender since no ACK is received

134
TCP functions - multiplexing
• Modern computers are capable of multi-tasking
◦ Including simultaneous communication tasks
• TCP supports multiplexing by providing multiple port addresses within
each host
◦ one communication channel per port
• A network address and port address together is called a socket
◦ A pair of sockets uniquely identifies each connection

135
Port addresses and
multiplexing
Windows file share
131.247.95.252
Port 445 (smb)

Port
56244

Port Quicken application server


52279 12.149.160.223
Port 443 (https)
Port
52336

Port Yahoo web server


52277
68.142.213.132
Client PC Port Port 80 (http)
131.247.95.132 61331

USF file server


131.247.100.8
Port 21 (ftp)

College of Business DNS server


131.247.92.208
Port 53 (dns)
136
TCP ports and airport gates

ru n Gate B25 to
wa
y Lansing, MI

Airport code
GSO
Gate B26 to
Phoenix, AZ

Data packets Port 1856


Web to yahoo

cable

Computer address:
216.149.56.68
Port 1857
IM to MSN
137
TCP port assignment
• On the sender side, the operating system assigns one of the free ports
to an application that requires network connectivity

• How do you know what port to connect to on the receiver side?


◦ On what port is the web server listening?

138
Standard ports
• Standard ports
– Assigned by IANA: Internet Assigned Numbers Authority
• To see list
– In Windows:
• C:/Windows/System32/drivers/etc/services
– In UNIX/ Linux
• /etc/services

• Used ports displayed by netstat utility

139
Standard ports
• Typically ports 1 – 1023 are reserved for defined services
– Applications may use the remaining port numbers 1024 – 65535
• Common ports
– 80 : web (http)
– 25 : email (smtp)
– 443: SSL (https)
– 445: microsoft-ds (smb)

140
etc\services file

141
Viewing ports usage with
netstat

Ports on local desktop Ports on remote servers


142
Viewing ports usage with
netstat

Invoking application Invoked port


143
TCP functions – flow control
• If the receiver is slow, it will not be able to process the packets
reaching it
– Causes unnecessary network traffic
• Therefore, TCP enables the receiver to limit the sender’s data rate
• If sender is slow, it only tests the patience of receivers
– There is no packet loss
– Also, sender is already transmitting at max possible rate

144
V. simple flow control
mechanism
Sender Receiver

TCP segment 1

Sequence number = 0 TCP segment 1


Length = 300
Sequence number = 0
ACK 301 Length = 300

TCP segment 2

Sequence number = 301 TCP segment 2


Length = 320
Sequence number = 301
ACK 621 Length = 320

145
TCP functions – flow control
• Flow control mechanism shown earlier is called stop-and-wait
– Sender waits for ACK before sending next datagram
• Very slow

• TCP flow control is accomplished by returning a “window” with every


ACK
• “Window” indicates how many bytes of data the sender may transmit
before receiving any more ACK

146
TCP flow control with window
size
Sender Receiver

ize 700
Window S

TCP segment 1

Sequence number = 1 TCP segment 1


Length = 300
Sequence number = 1
Length = 300
TCP segment 2

Sequence number = 301 TCP segment 2


Length = 320
Sequence number = 301
ACK 621 Length = 320

147
Sliding window
• Flow control is the regulation by the receiver of the amount of data
the sender may send
• Creates a “sliding window” at the sender
• Packets that have received permission for transmission are within the
window
• Window slides as receiver acknowledges packets or modifies window
size

148
Sliding window
Sender Receiver

Window Size 700

Seg 1 Seg 2 Seg 3 Seg 4


SN = 1 SN = 301 SN = 601 SN = 901 More data
Len = 300 Len = 300 Len = 300 Len = 300
Segments permitted
Segments waiting
for transmission
for permission
“SENT window”

Seg 1 Seg 2
SN = 1 SN = 301
ACK 601; Window Size 900
Len = 300 Len = 300
Seg 13 Seg 2 Seg 3 Seg 4 Seg 5 Seg 6
SN = 1 SN = 301 SN = 601 SN = 901 SN = 1201 SN = 1501 More data
Len = 300 Len = 300 Len = 300 Len = 300 Len = 300 Len = 300
Segments
Segments permitted
Segments successfully waiting
for transmission
transmitted for
“SENT window”
permission
Seg 3 Seg 4 Seg 5
SN = 601 SN = 901 SN = 1201
Len = 300 Len = 300 Len = 300

149
TCP Header
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Source port Destination port

Sequence number

Acknowledgment number
U A P R S F
Data offset Reserved R
G
C
K
S
H
S
T
Y
N
I
N
Window

Checksum Urgent pointer

Options Padding

Note: Each tick mark represents a bit position

150
TCP header fields
• Port addresses have 16 bits
◦ 216 possible ports

◦ 216 = 65,536 ports possible per host

◦ If computing resources are available, a single computer running TCP can


support 65,536 simultaneous network connections
◦ Compare to telephone – no concept of port
◦ only one network connection possible at a time

151
User Datagram Protocol (UDP)
• Defined in RFC 768 (1980)
• Many applications do not need TCP, e.g..

• In these cases, if we can avoid TCP, we eliminate the overhead of


keeping track of sequence numbers, window sizes etc.

152
UDP Header

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Source port Destination port


Length Checksum

Note: Each tick mark represents a bit position

153
Summary
• Why segmentation
• Why sequence numbers
• Why sliding window
• Why port numbers
• Why three-way handshake
• Why UDP
6. Application layer
• Overview of the application layer
• Overview of the Web

155
Application layer overview
• The application layer specifies
◦ End-user activity supported by the protocol
◦ Commands to accomplish protocol functions

• End users only know about application layer interfaces


◦ Details of TCP and IP are hidden from user

156
Application layer in TCP/ IP
stack
User User User User

HTTP SMTP FTP ... Other applications

TCP

IP

Local network

157
Application vs. lower layers
• Unlike lower layers, each supported end-user task has a different
application layer protocol associated with it
◦ SMTP for email, HTTP for web
◦ All use TCP or UDP for data transfer

• RFC 1123 defined the operation of an initial set of application layer


protocols
◦ SMTP (for mail transfer)
◦ Telnet (for remote login)

◦ Now superseded by SSH


◦ FTP (for file transfer)

158
Application protocols
evolution
• These days, HTTP is more popular than these protocols
• New applications are emerging or have become popular
◦ Voice over IP
◦ Instant messaging
◦ Bit-torrent

• All these applications use the same underlying TCP/ IP infrastructure

159
HTTP
• The web is the lay person’s interpretation of the Internet
– Most common service to retrieve information from the Internet
– Uses HTTP
• Any user can access a huge amount of interesting and/ or useful
information across the world using the web
– Coupons/ Comparison shopping
– Facebook/ MySpace
– Assignments

160
Web structure
• The web consists of pages linked to each other through hyperlinks

• Pages are linked to each other through hyperlinks form a web of pages
◦ Linked pages can be anywhere in the world
◦ Hence the name: world wide web

161
Web structure

Asia Pacific - Red


Europe/Middle Asia/Africa - Green
North America - Blue
Latin American and Caribbean - Yellow
RFC1918 IP Addresses - Cyan
Unknown - White

162
Web pages
• Web pages are written in hypertext markup language (HTML)

• Special feature of web pages


◦ The items of information are linked to each other through hyperlinks
◦ Allows immediate access to related information
◦ Those who bought this also bought …
◦ Jane’s friends

163
Web page example
<html>
<head>
<title>HTML 101</title>
</head>
<body>
<h1>Welcome to html page at
<a href = “www.usf.edu”>USF</a> </h1>
<p>Please check back later</p>
</body>
</html>

164
The HTTP protocol
• Defined in RFC 2616 (1999)
• General purpose protocol for data transfer
• Based on request/ response
• Client sends request to server
• Server responds with status code, meta-information and data
• HTTP transaction for web page example is shown

165
HTTP example

166
HTTP features
• Web transfers contain meta information about the data being
transferred
◦ Client knows the data type of the data being transferred – txt/pdf/ jpg etc

• Web transfers can be modified


◦ Google routinely compresses web page with search results before transfer

167
Content-encoding for
compression

168
URLs
• Web pages are accessed by URLs
◦ Uniform Resource Locator
◦ RFC 1738, 1994

• Syntax
◦ protocol://host [:port ]/[abs_path[?query]]

• Examples
◦ http://www.usf.edu:8080/acad_calendar.html
◦ http://www.usf.edu:8080/grades?fName=joe
◦ http://www.google.com/search?q=usf

169
URL defaults
• To simplify access to web pages, web servers recognize defaults
– http://www.usf.edu is the same as http://www.usf.edu:80/index.asp
• Other default files include index.html, index.php

• URLs can be used to specify other kinds of network connections


– mysql://ismlab.usf.edu:3036/ism4220
• Connect to ism4220 database on mysql server listening on port 3036 at host ismlab.usf.edu

170
Anatomy of a web request

DHCP server Administrators 2


configure routers Prior configuration
1 DNS server (chapter 8)
4
PC gets IP address from DHCP

DNS gives IP address of etsu

ISP networks (chapter 10) Real time use


User network

Packets routed hop by 7


(chapter 7)

(chapter 7)

8
hop
Web page sent in response to request
(chapter 4)
(chapter 6)

Router

Router Router Response broken into 9


datagrams
6 (chapter 5) Web server
Packets sent as signals
User requests web page3 www.etsu.edu
(chapter 2)
www.etsu.edu (chapters 12-13)
(chapter 6) 1
0
Defend against intruders
(chapter 11)
5
Request sent as packets
(chapter 3)
Summary
1. Networking overview
2. Physical layer
3. Data link layer
4. Network layer
5. Transport layer
6. Application layer
7. Wide area networks

172