0% found this document useful (0 votes)
9 views165 pages

Chapter 4.1

The document provides an overview of the application layer in networking, detailing its responsibilities, user applications, and various protocols like HTTP, FTP, and SMTP. It explains client-server and peer-to-peer architectures, as well as the processes involved in communication and addressing. Additionally, it covers the role of DNS and the transport layer protocols, emphasizing the importance of port numbers and multiplexing in data delivery.

Uploaded by

zechariha2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views165 pages

Chapter 4.1

The document provides an overview of the application layer in networking, detailing its responsibilities, user applications, and various protocols like HTTP, FTP, and SMTP. It explains client-server and peer-to-peer architectures, as well as the processes involved in communication and addressing. Additionally, it covers the role of DNS and the transport layer protocols, emphasizing the importance of port numbers and multiplexing in data delivery.

Uploaded by

zechariha2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 165

Application Layer

Application layer
 Principles of network applications
 Web and HTTP
 FTP
 Electronic Mail
 SMTP, POP3, IMAP
 DNS

2
What is the task of application layer?

The application layer is


responsible for providing services
to the user.

3
User Applications, Services and
Protocols
 e-mail  voice over IP
 web  real-time video
 instant messaging conferencing
 remote login  grid computing
 P2P file sharing
 multi-user network
games
 streaming stored video
clips

4
Application architectures
 Client-server
 Peer-to-peer (P2P)
 Hybrid of client-server and P2P

5
Client-Server Model
 The device requesting the information is called a client
 The device responding to the request is called a server
 Application layer protocols describe the format of the
requests and responses between the clients and servers
server:
 always-on host
 permanent IP address
 server farms for
scaling
clients:
 communicate with server
 may be intermittently
connected
 may have dynamic IP
addresses
Ch 3 - 6
Servers
 A server is usually a computer that contains information to
be shared with many client systems
 Some servers may require authentication of user control
information to verify the user has access rights
 rely on a central list of user accounts and authorization
 The server runs a service, or process, called a daemon

– daemon typically runs in


the background
– the daemon “listens” for a
request from a client
– the daemon exchanges
appropriate information
with the client when it
“hears” a request

Ch 3 - 7
Peer-to-Peer Networks
 Two or more computers are connected via a network and
can share resources without having a dedicated server
 every connected end device, known as a peer, can function
either as a client or server
 information can be located anywhere on any connected device

– user accounts and access


rights are set individually
on each peer device
– difficult to enforce security
and access policies
– most current operating
systems support file and
print sharing without
requiring additional server
software

Ch 3 - 8
Peer-to-Peer Applications
 Allows a device to act as both a client and server within the
same communication
 requires each end device to provide a user interface and run a
background service
 Can be used on peer-to-peer networks, client/server
networks and across the Internet

Ch 3 - 9
Hybrid of client-server and P2P
Skype
 voice-over-IP P2P application
 centralized server: finding address of remote
party:
 client-client connection: direct (not through
server)
Instant messaging
 chatting between two users is P2P
 centralized service: client presence
detection/location
 user registers its IP address with central
server when it comes online
 user contacts central server to find IP
addresses of buddies

10
Processes communicating
Process: program
Client process: process
running within a host.
that initiates
 within same host, two
communication
processes
Server process:
communicate using
process that waits to
inter-process
be contacted
communication
(defined by OS).
 Note: applications with P2P
 processes in different
architectures have client
hosts communicate by processes & server processes
exchanging messages

11
Addressing processes
 to receive messages,  identifier includes both
process must have IP address and port
identifier numbers associated
 host device has unique with process on host.
32-bit IP address  Example port numbers:
 Q: Is IP address of host  HTTP server: 80
on which process runs  Mail server: 25
suffice for identifying  to send HTTP message
the process?
 A: No, many processes
to gaia.cs.umass.edu
web server:
can be running on
same host
 IP address:
128.119.245.12
 Port number: 80
12
Web and HTTP
 Web page consists of
objects
 Object can be HTML
file, JPEG image, Java
applet, audio file,…
 Web page consists of
base HTML-file which
includes several
referenced objects
 Each object is
addressable by a URL
 Example URL:
www.someschool.edu/someDept/pic.gif

path name
13host name
HTTP overview
HTTP: hypertext transfer
protocol
 Web’s application layer HT
TP
req
protocol PC running HT ues
TP t
 client/server model Explorer resp
ons
e
 client: browser that
requests, receives, st
ue
“displays” web objects req e Server
TTP o ns
 server: Web server sends H p running
res
TP Apache Web
objects in response to HT
server
requests
Mac running
Navigator

14
HTTP connections
Nonpersistent HTTP Persistent HTTP
 At most one object is  Multiple objects can be
sent over a TCP sent over single TCP
connection. connection between
client and server.

15
Non-Persistent HTTP: Response
time
Round-Trip Time (RTT):
time for a small packet
to travel from client to
server and back. initiate TCP
connection
Response time:
RTT
 one RTT to initiate TCP
request
connection file
time to
 one RTT for HTTP request RTT
transmit
and first few bytes of file
file
HTTP response to return received
 file transmission time
time time
total = 2RTT+transmit
time
18
Persistent HTTP

Nonpersistent HTTP issues: Persistent HTTP


 requires 2 RTTs per object  server leaves connection
 OS overhead for each TCP open after sending
connection response
 browsers often open  subsequent HTTP
parallel TCP connections to messages between same
fetch referenced objects client/server sent over
open connection
 client sends requests as
soon as it encounters a
referenced object
 as little as one RTT for all
the referenced objects

19
HTTP overview (continued)
HTTP is “stateless”
server maintains no information about past
client requests
Protocols that maintain “state” are complex!
 past history (state) must be maintained
 if server/client crashes, their views of “state”
may be inconsistent, must be reconciled

20
FTP: the file transfer protocol

FTP file transfer


FTP
user FTP
client
interface server
user
at host remote file
local file system
system

 transfer file to/from remote host


 client/server model
 client: side that initiates transfer (either to/from
remote)
 server: remote host
 ftp: RFC 959
 ftp server: port 21
21
FTP: separate control, data
connections
 FTP client contacts FTP server TCP control connection
at port 21, TCP is transport port 21
protocol
 client authorized over control TCP data connection
connection FTP port 20 FTP
client server
 client browses remote
directory by sending  server opens another TCP
commands over control
connection.
data connection to transfer
another file.
 when server receives file
 control connection: “out of
transfer command, server
opens 2nd TCP connection (for band”
file) to client  FTP server maintains “state”:
 after transferring one file, current directory, earlier
server closes data connection. authentication

22
Dynamic Host Configuration Protocol
 DHCP uses UDP ports 67 (server) and 68 (client)
 Allows a host to obtain an IP address automatically from a
DHCP server when it connects to the network
 server leases an IP address from a pool to the host for a set
period
 can pose a security risk

• DHCP is preferred on large


LANs or where the user
population changes
frequently
– when accessing the Internet
using wireless hotspots at
airport or coffees shops

Ch 3 - 23
Electronic Mail outgoing
message queue
Three major components: user user mailbox
 user agents agent
 mail servers mail
user
server
agent
 simple mail transfer protocol:
SMTP
SMTP mail
server user
User Agent SMTP agent
 composing, editing, reading
SMTP
mail messages user
mail
 e.g., Eudora, Outlook, elm, server agent
Mozilla, Thunderbird
 outgoing, incoming messages user
stored on server agent
user
agent

24
Electronic Mail: mail servers
Mail Servers
user
 mailbox contains incoming agent
messages for user
mail
user
 message queue of server
agent
outgoing (to be sent) mail SMTP
messages mail
server user
 SMTP protocol between
SMTP agent
mail servers to send email
messages SMTP
 client: sending mail user
mail
agent
server server
 “server”: receiving mail
user
server agent
user
agent
25
Electronic Mail: SMTP [RFC 2821]
 uses TCP to reliably transfer email message from
client to server, port 25
 direct transfer: sending server to receiving server
 three phases of transfer
 handshaking (greeting)
 transfer of messages
 closure
 command/response interaction
 commands: ASCII text
 response: status code and phrase

 messages must be in 7-bit ASCII

26
SMTP and POP(Post Office Protocol )
 POP and POP3 are inbound mail delivery protocols
 MDA listens for a client connection to the server

• SMTP governs the


transfer of
outbound e-mail
from the sending
client to the MDA, as
well as the transport
of e-mail between
MTA
– enables e-mail to
be transported
across data
networks between
different types of
server and client
Ch 3 - 27
Mail message format
SMTP: protocol for
exchanging email msgs
RFC 822: standard for text header
message format: blank
line
 header lines, e.g.,
 To:
 From:
body
 Subject:

different from SMTP


commands!
 body
 the “message”, ASCII
characters only

29
DNS: Domain Name System
People: many identifiers: Domain Name System:
 SSN, name, passport #  distributed database
Internet hosts, routers: implemented in hierarchy of
 IP address (32 bit) - used many name servers
for addressing datagrams  application-layer protocol
 “name”, e.g., host, routers, name servers
www.yahoo.com - used to communicate to resolve
by humans names (address/name
translation)
Q: map between IP  note: core Internet
addresses and name ? function, implemented as
application-layer protocol
 complexity at network’s
“edge”

31
Telnet
 Telnet uses TCP port 23
 Provides a method of emulating text-based terminals over
the network
 allows a local device to access a remote device as if the
keyboard and monitor are connected to the remote device
directly

• AThe
connection using
runsTelnet is called a virtual terminal (VTY)

Telnet server a
session
service called the Telnet
daemon

Ch 3 - 33
Transport Layer
Transport layer
• Responsible for Process-to-Process Delivery:
Provide logical communication between app processes
running on different hosts. Protocols run in end systems
 Send side: breaks app messages
into segments, passes to network layer
 Rcv side: reassembles segments into
messages, passes to app layer

UDP and TCP

35
Process-to-Process Delivery
 Client-Server Paradigm
 Addressing
 Multiplexing
 Demultiplexing
 Connectionless/Connection-Oriented
 Reliable/Unreliable

36
Types of data deliveries

37
Port numbers

A port number is a way


to identify a specific
process to which an
Internet or other network
message is to be
forwarded when it arrives
at a server. For the
Transmission Control
Protocol and the User
Datagram Protocol, a port
number is a 16-bit integer
that is put in the header
appended to a message
unit.

38
IP addresses versus port numbers

IANA ranges

39
Multiplexing and
demultiplexing

Multiplexing (or muxing) is a


way of sending multiple signals
or streams of information over a
communications link at the
same time in the form of a
single, complex signal; the
receiver recovers the separate
signals, a process
called demultiplexing (or
demuxing).

40
Connection Establishment

41
Connection Termination

42
Transport Layer Protocols
 There are five basic protocols for the
Transport Layer:
 Transmission Control Protocol (TCP)
 User Datagram Protocol (UDP)
 Datagram Congestion Control Protocol (DCCP)
 Stream Control Transmission Protocol (SCTP)
 Resource Reservation Protocol (RSVP)

43
UDP

Port Numbers

User Datagram

Applications

44
Note:

UDP is a connectionless,
unreliable protocol that has
no flow and error control. It
uses port numbers to
multiplex data from the
application layer.

45
Well-known ports used by UDP
Port Protocol Description

7 Echo Echoes a received datagram back to the sender

9 Discard Discards any datagram that is received

11 Users Active users


13 Daytime Returns the date and the time
17 Quote Returns a quote of the day
19 Chargen Returns a string of characters

53 Nameserver Domain Name Service

67 Bootps Server port to download bootstrap information

68 Bootpc Client port to download bootstrap information

69 TFTP Trivial File Transfer Protocol


111 RPC Remote Procedure Call
123 NTP Network Time Protocol

161 SNMP Simple Network Management Protocol


46
162 SNMP Simple Network Management Protocol (trap)
User datagram format

47
UDP
 The calculation of checksum and its
inclusion in the user datagram are
optional.
 UDP is not a convenient transport-layer
protocol for applications that provide flow
and error control. It is also used by
multimedia applications.

48
Use of UDP
 UDP is suitable for a process that requires simple request-
response communication with little concern for flow and
error control. It is not usually used for a process such as
FTP that needs to send bulk data
 UDP is suitable for a process with internal flow and error
control mechanisms. For example, the Trivial File Transfer
Protocol (TFTP) process includes flow and error control. It
can easily use UDP.
 UDP is a suitable transport protocol for multicasting.
Multicasting capability is embedded in the UDP software
but not in the TCP software.
 UDP is used for management processes such as SNMP.
 UDP is used for some route updating protocols such as
Routing Information Protocol (RIP)
49
TCP

Port Numbers
Services
Sequence Numbers
Segments
Connection
Transition Diagram
Flow and Error Control
Silly Window Syndrome
50
Well-known ports used by TCP
Port Protocol Description
Echoes a received datagram back to
7 Echo
the sender
Discards any datagram that is
9 Discard
received
11 Users Active users
13 Daytime Returns the date and the time
17 Quote Returns a quote of the day
19 Chargen Returns a string of characters
File Transfer Protocol (data
20 FTP, Data
connection)
FTP, File Transfer Protocol (control
21
Control connection)
23 TELNET Terminal Network
25 SMTP Simple Mail Transfer Protocol
53 DNS Domain Name Server
51
67 BOOTP Bootstrap Protocol
TCP segment format

52
Three-step connection
establishment

53
Four-step connection
termination

54
Network layer

Addressing the Network IP Routing

55
Network layer
TCP UDP Transport
 This layer deals with Layer

Packets (Data Bundles)


 Responsible for logical ICMP IP IGMP Network
Layer
addressing and routing
 Devices Network
ARP Data Link Layer
 Routers, Layer 3 Switches, Access

Firewalls.. Etc.
 Network Layer Protocols  Media
IP – Internet Protocol (Provide packet
 IP delivery)
 ICMP  ARP – Address Resolution Protocol
 ARP (Defined the procedure of network
 RIP address / mac address translation)
 IGRP, IGMP… Etc.  ICMP – Internet Control Message
Protocol (Defined the procedure of
error message transfer)
56
Network layer
 Routes the information in the network
 E.g. IP is a network layer implementation which
defines addresses in such a way that route
selection can be determined.
 Single address space for the entire internetwork
 adds an additional layer of addressing, e.g. IP
address, which is different from MAC address.

57
Addressing the Network IPv4

58
IP Address
 What is an IP address?
 An IP address is a unique global address for a
network interface
 E.g. IPv4, IPv6
 IPV6 provides a platform on new internet
functionality that will be needed in the immediate
future and provide flexibility for future growth
and expansion
 An IPv4 address is 32 bits long
 The IPv4 addresses are unique and universal.

59
IP Addresses

60
IP Address
 The address space of IPv4 is 232 or
4,294,967,296.

61
Classful addressing
 In classful addressing, the address space is
divided into five classes; A, B, C, D, and E .
 Easy to work out but very wasteful.
 Routers and hosts still assume class subnet
masks by default
 Class A /8 255.0.0.0
 Class B /16 255.255.0.0
 Class C /24 255.255.255.0

62
Finding the classes in binary and dotted-decimal notation

63
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111

Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.

64
3 types of address
 Every network has:
 Network address – the first one
 Broadcast address – the last one
 Host addresses – everything in between

66
IP addressing

A 10. 17. 53. 60


network part host part

B 172. 16. 38. 201


network part host part

C 192. 168. 21. 17


network part host part

67
IP addressing
 Classful addressing, which is almost obsolete,
is replaced with classless addressing.
 In IPv4 addressing, a block of
addresses can be defined as:
x.y.z.t /n
in which x.y.z.t defines one of the addresses
and the /n defines the mask.

68
IPv4 address

192. 168. 21. 17


11000000 10101000 00010101 00010001

octet octet octet octet

network part host part


Prefix /24 Subnet mask:
255. 255. 255. 0
11111111 11111111 11111111 00000000

69
Find the network address

192. 168. 21. 17


11000000 10101000 00010101 00010001

In a network address, all the host bits are 0.


192. 168. 21. 0
11000000 10101000 00010101 00000000

The router needs to do this for every packet.

70
Logical AND

192. 168. 21. 17


11000000 10101000 00010101 00010001

255. 255. 255. 0


11111111 11111111 11111111 00000000

192. 168. 21. 0


11000000 10101000 00010101 00000000

Do a logical AND at each position


71
Find the broadcast address

192. 168. 21. 17


11000000 10101000 00010101 00010001

In a broadcast address, all the host bits are 1.


192. 168. 21. 255
11000000 10101000 00010101 11111111

The broadcast is the last address in the network.

72
Classless addressing
 Any suitable prefix can be used
 More flexible, less wasteful.

73
74
Classless addressing /16
 172.16.0.0/16 mask 255.255.0.0
 Broadcast address 172.16.255.255

172. 16. 0. 0
10101100 00010000 00000000 00000000
 Hosts 172.16.0.1 to 172.16.255.254
 65534 host addresses

75
Classless addressing /24
 172.16.0.0/24
 mask 255.255.255.0
 Broadcast address 172.16.0.255
172. 16. 0. 0
10101100 00010000 00000000 00000000

 Hosts 172.16.0.1 to 172.16.0.254


 254 host addresses

76
Classless addressing /22
 172.16.0.0/22
 mask 255.255.252.0

172. 16. 0. 0
10101100 00010000 00000000 00000000
 Broadcast address 172.16.3.255
 Hosts 172.16.0.1 to 172.16.3.254
 1022 host addresses

77
Classless addressing /26

 172.16.0.0/26
 mask 255.255.255.192

172. 16. 0. 0
10101100 00010000 00000000 00000000
 Broadcast address 172.16.0.63
 Hosts 172.16.0.1 to 172.16.0.62
 62 host addresses

78
Classless addressing /28

 172.16.0.0/28 mask 255.255.255.240


 Broadcast address 172.16.0.15

172. 16. 0. 0
10101100 00010000 00000000 00000000
 Hosts 172.16.0.1 to 172.16.0.14
 14 host addresses

79
Calculating addresses
 A host has IP address 192.168.1.70/24
 What is the subnet mask?
 What is the network address?
 What is the broadcast address?
 What is the range of host addresses in the
network?

80
192.168.1.70/24 – fill in the table

Last octet Last octet Full


binary decimal
Host
Subnet mask
Network
Broadcast
First host
Last host
81
192.168.1.70/24

Last octet Last octet Full


binary decimal
Host 01000110 70 192.168.1.70
Subnet mask 00000000 0 255.255.255.0
Network 00000000 0 192.168.1.0
Broadcast 11111111 255 192.168.1.255
First host 00000001 1 192.168.1.1
Last host 11111110 254 192.168.1.254
82
Calculating addresses
 A host has IP address 192.168.1.70/26
 What is the subnet mask?
 What is the network address?
 What is the broadcast address?
 What is the range of host addresses in the
network?

83
192.168.1.70/26 fill in the table

Last octet Last octet Full


binary decimal
Host
Subnet mask
Network
Broadcast
First host
Last host
84
192.168.1.70/26

Last octet Last octet Full


binary decimal
Host 01000110 70 192.168.1.70
Subnet mask 11000000 192 255.255.255.192
Network 01000000 64 192.168.1.64
Broadcast 01 111111 127 192.168.1.127
First host 01000001 65 192.168.1.65
Last host 01 111110 126 192.168.1.126
85
Calculating addresses
 A host has IP address 192.168.1.70/28
 What is the subnet mask?
 What is the network address?
 What is the broadcast address?
 What is the range of host addresses in the
network?

86
192.168.1.70/28 fill in the table

Last octet Last octet Full


binary decimal
Host
Subnet mask
Network
Broadcast
First host
Last host
87
192.168.1.70/28

Last octet Last octet Full


binary decimal
Host 01000110 70 192.168.1.70
Subnet mask 11110000 240 255.255.255.240
Network 01000000 64 192.168.1.64
Broadcast 01001111 79 192.168.1.79
First host 01000001 65 192.168.1.65
Last host 01001110 78 192.168.1.78
88
Unicast, Multicast,
Broadcast

89
Unicast, Multicast, Broadcast
 Unicast – a message addressed to one host
 Broadcast – a message addressed to all hosts
on a network. Uses network’s broadcast
address or 255.255.255.255 locally
 Multicast – a message addressed to a group of
hosts. Uses an address starting 224 - 239

90
Private IP addresses
 Unrestricted use on private networks. Not
routed across the Internet.
 10.0.0.0 – 10.255.255.255 (10.0.0.0/8)
 172.16.0.0 – 172.31.255.255 (172.16.0.0/20)
 192.168.0.0 – 192.168.255.255
(192.168.0.0/24)

91
Public IP addresses
 Routed over the Internet
 Master holder is IANA
 Assigned to regional registries and then to
ISPs
 ISPs allocate them to organisations and
individual users
 Use is strictly controlled as duplicate
addresses are not allowed

92
Special addresses
 0.0.0.0 “all addresses” in default route. Hosts
cannot be given addresses starting 0.
 127.0.0.1 is loopback. Hosts cannot be given
addresses starting 127.
 240.0.0.0 and higher – reserved for experimental
purposes.
 169.254.0.0 - 169.254.255.255 local only
 192.0.2.0 to 192.0.2.255 for teaching

93
Network address translation
 A large number of hosts on a network use private
addresses to communicate with each other.
 The ISP allocates one or a few public addresses.
 NAT allows the hosts to share the public
addresses when they want to use the Internet

94
Addressing hosts
 Static addressing
 Address is configured by an administrator
 Servers, printers, routers, switches need static
addresses
 Dynamic addressing
 Address is allocated automatically by DHCP by
leasing addresses from a pool
 Dynamic addressing is best for workstations

95
Subnetting

96
Problems
 IPv4 address scheme is limited by its 32 bits problems

for the long-term growth of the Internet

 The global internet routing table is huge and continues

to grow

go beyond the capacity of routers

 What if you want to break your big network into

many smaller networks?

97
Solutions
 Subnet masking
 Variable-length subnet masks
 Route summarization
 Classless interdomain routing
 Network address translation
 Address allocation for private internet

98
 solution 1: get netids for all groups; impossible
 solution 2: allow a network to be split into several parts
for internal use but still act like a single network to the
outside world (three levels of hierarchy: site, subnet,
host)

a campus network consisting of LANs for various departments

99
Subnetting
 Split the host number portion of an IP address
into a subnet number and a (smaller) host
number.
 Result is a 3-layer hierarchy
network prefix host number

network prefix subnet number host number

extended network prefix


 Then:
 Subnets can be freely assigned within the organization
 Internally, subnets are treated as separate networks
 Subnet structure is not visible outside the organization

100
Subnetting
router

Subnet 1 Subnet 2 Subnet 3


128.213.1.x 128.213.2.x 128.213.3.x

101
Subneting
 Networks divided into subnets thus:
 saving IP address spaces
 reduce broadcasting
 use the network address more efficient

 Done by reserving bits from host address


 Any number of bits can be borrowed as long as
two bits remain.

102
Subnet Masking

Some of the benefits of


subnetting include:
• Reduced network traffic
• Optimized network performance
• Simplified management
103
Subnetting
 Subnets can simplify routing.
 IP subnet broadcasts have a hostID of all 1s.
 It is possible to have a single wire network with
multiple subnets.

104
How to Create a Subnet

 To create subnetworks, you take bits from the host portion

of the IP address and reserve them to define the subnet


address.
 This means fewer bits for hosts, so the more subnets, the
fewer bits available for defining hosts.

105
Steps Followed
 Determine the number of required network IDs:
 One for each subnet
 One for each wide area network connection
 Determine the number of required host IDs per subnet:
 One for each TCP/IP host
 One for each router interface
 Based on the above requirements, create the following:
 One subnet mask for your entire network
 A unique subnet ID for each physical segment
 A range of host IDs for each subnet

106
Subnet Masks
 subnet mask is 32-bit value that allows the recipient of IP
packets to distinguish the network ID portion of the IP
address from the host ID portion of the IP address.
 When assigning addresses you set both the IP address
and subnet mask.
 Not all networks need subnets, meaning they use the
default subnet mask.
 Default subnet mask is found by setting all network
address to 1 for each class.

107
Restrictions on borrowed bits
 Reserved addresses

 all 0’s= network address, all 1’s broadcast address

 Minimum of 1 bits borrowed from host portion

 Minimum of 2 bits left for host portion

108
The Fast Way
 Before starting, you need to do is answer five simple
questions:

1. How many subnets does the chosen subnet

mask produce?

2. How many valid hosts per subnet are available?

3. What are the valid subnets?

4. What’s the broadcast address of each subnet?

5. What are the valid hosts in each subnet?

109
1. How many subnets?
 2x = number of subnets. x is the number of masked bits,
or the 1s.
 For example, given a class C subnet mask of
255.255.255.192, the number of ones gives us 22 = 4
subnets.
 Note that we only count the number of ones that are found
in the host part of the subnet mask.
 For class C address 255.255.255.0 is the default subnet,
192=11000000 in binary, so there are only 2 ones.

110
2. How many hosts per subnet?
 2y – 2 = number of hosts per subnet. y is the number
of unmasked bits, or the 0s. For example, in 11000000,
the number of zeros gives us 26 – 2 = 62 hosts per subnet.
 You need to subtract two for the subnet address and
the broadcast address, which are not valid hosts.
3. What are the valid subnets?
 First calculate the block size.
 256 – subnet mask = block size, or increment number.
 An example would be 256 – 192 = 64. The block size of
a 192 mask is always 64.
 Second, start counting at zero in blocks of 64 until you
reach the subnet mask value and these are your
subnets. 0, 64, 128, 192.

111
4. What’s the broadcast address for each subnet?
 Since we counted our subnets in the last section as 0,
64, 128, and 192, the broadcast address is always the
number right before the next subnet.
 For example, the 0 subnet has a broadcast address of 63
because the next subnet is 64. The 64 subnet has a
broadcast address of 127 because the next subnet is
128, etc.
 And remember, the broadcast of the last subnet is
always 255 for Class C.

112
5. What are the valid hosts?
 Valid hosts are the numbers between the
subnets, omitting all the 0s and all 1s.
 For example, if 64 is the subnet number and 127
is the broadcast address, then 65–126 is the valid
host range—it’s always the numbers between the
subnet address and the broadcast address.
 These are the addresses you assign to nodes.

113
Example 1
 We’re going to subnet the network address 192.168.10.0 and
subnet mask 255.255.255.224.
1. How many subnets?
 224 is 11100000, so our equation would be 2 3 = 8.

2. How many hosts?


 25 – 2 = 30.

3. What are the valid subnets?


 256 – 224 = 32. We just start at zero and count to the subnet
mask value in blocks (increments) of 32: 0, 32, 64, 96, 128,
160, 192, 224.
4. What’s the broadcast address for each subnet?
 always the number right before the next subnet

5. What are the valid hosts?


 the numbers between the subnet number and the broadcast
114
address
To answer questions 4 and 5, first just write out the subnets,
then write out the broadcast addresses— the number right
before the next subnet. Lastly, fill in the host addresses.
 So now we have
 192.168.10.1/27 – 192.168.10.30/27 ntk 1
 192.168.10.33/27 - 192.168.10.62/27 ntk 2
upto …
 192.168.10.225/27 - 192.168.10.254/27 ntk 8

115
Example 2
Subnetting 192.168.1.0/24

Last octet binary


Address 192.168.1.0 00000000

Subnet mask 255.255.255.0 00000000

Borrow 1 bit from host part, give it to network part, /25

Addresses 192.168.1.0 00000000


192.168.1.128 10000000
Subnet mask 255.255.255.128 10000000

116
Subnetting 192.168.1.0/24

Borrow 2 bits from host part, give to network part, /26


Addresses 192.168.1.0 00000000
192.168.1.64 01000000
192.168.1.128 10000000
192.168.1.192 11000000
Subnet mask 255.255.255.192 11000000

117
Subnetting 192.168.1.0/24

Borrow 3 bits from host part, give to network part, /27


Addresses 192.168.1.0 00000000
192.168.1.32 00100000
192.168.1.64 01000000
192.168.1.96 01100000
192.168.1.128 10000000
192.168.1.160 10100000
192.168.1.192 11000000
192.168.1.224 11100000
Subnet mask 255.255.255.224 11100000

118
Subnetting 192.168.1.0/24

Borrow 4 bits from host part, give to network part, /28


192.168.1.0 192.168.1.128 00000000 10000000
192.168.1.16 192.168.1.144 00010000 10010000
192.168.1.32 192.168.1.160 00100000 10100000
192.168.1.48 192.168.1.176 00110000 10110000
192.168.1.64 192.168.1.192 01000000 11000000
192.168.1.80 192.168.1.208 01010000 11010000
192.168.1.96 192.168.1.224 01100000 11100000
192.168.1.112 192.168.1.240 01110000 11110000

Subnet mask 255.255.255.240 11110000


And so on…
119
Subnetting 192.168.1.0/24

Bits borrowed 1 2 3 4 5 6

No of networks 2 4 8 16 32 64

Prefix /25 /26 /27 /28 /29 /30

Bit value/ 128 64 32 16 8 4


network size
No of hosts 126 62 30 14 6 2

Subnet mask 128 192 224 240 248 252

120
Subnetting 192.168.1.0/24
 Every time you borrow another bit you:
 Double the number of subnets
 Halve the size of the subnets
 Each subnet has a network address, a
broadcast address, and everything in between
is a host address.

121
Exercises
 Do full subnetting for the following addresses.

1. 192.168.10.0/28

2. 192.0.10.0/30

3. 192.1.1.0/25

122
An organization is granted the block
130.34.12.64/26. The organization needs
four subnetworks, each with an equal
number of hosts. Design the subnetworks
and find the information about each
network.

123
124
An organization is granted a block of addresses with the
beginning address 14.24.74.0/24. The organization needs
to have 3 subblocks of addresses to use in its three
subnets as shown below:
❑ One subblock of 120 addresses.
❑ One subblock of 60 addresses.
❑ One subblock of 10 addresses.
Solution
There are 232 − 24 = 256 addresses in this block. The first
address is 14.24.74.0/24; the last address is
14.24.74.255/24.
a. The number of addresses in the first subblock is not a
power of 2. We allocate 128 addresses. The subnet
mask is 25. The first address is 14.24.74.0/25; the last
address is 14.24.74.127/25.
125
b. The number of addresses in the second subblock is
not a power of 2 either. We allocate 64 addresses. The
subnet mask is 26. The first address in this block is
14.24.74.128/26; the last address is 14.24.74.191/26.
c. The number of addresses in the third subblock is not
a power of 2 either. We allocate 16 addresses. The
subnet mask is 28. The first address in this block is
14.24.74.192/28; the last address is 14.24.74.207/28.
d. If we add all addresses in the previous subblocks, the
result is 208 addresses, which means 48 addresses
are left in reserve. The first address in this range is
14.24.74.209. The last address is 14.24.74.255.
e. Figure shows the configuration of blocks. We have
shown the first address in each block.

126
127
Assume a company has three offices: Central, East,
and West. The Central office is connected to the
East and West offices via private, WAN lines. The
company is granted a block of 64 addresses with
the beginning address 70.12.100.128/26. The
management has decided to allocate 32 addresses
for the Central office and divides the rest of
addresses between the two other offices.

128
129
Exercise
An ISP is granted a block of addresses starting with
190.100.0.0/16 (65,536 addresses). The ISP needs to
distribute these addresses to three groups of customers
as follows:
❑ The first group has 64 customers; each needs
approximately 256 addresses.
❑ The second group has 128 customers; each needs
approximately 128 addresses.
❑ The third group has 128 customers; each needs
approximately 64 addresses.
We design the subblocks and find out how many
addresses are still available after these allocations.

130
Data Link layer
 Receives services from physical layer and
provides services to network layer
 Function – responsible for controlling the
transfer of frames across the media.
 Node-to-node delivery
 Local responsibility
 Ensures reliable delivery
 Defines frames
 Physical addressing
 Error control
 Flow control
 Medium access control
ERROR DETECTION AND CORRECTION
 Types of Errors
 Detection
 Correction
Error Detection and Correction
 Errors are inevitable
 Interference
 Corruption as a result of transmission
 Reliable communication is dependent on
being able to detect and correct errors
 How will we know an error occurred?
 Do we retransmit or correct?

133
Types of Errors
 Single-bit error
 Burst error

134
Single-bit Errors
 Only one bit is changed: 0 changed to 1, or a 1 to a
0
 Least likely type of error since noise usually lasts
longer than the time to send one bit
 More likely in parallel transmission

135
Burst Errors
 Two or more bits in data unit are in error, not
necessarily consecutive in order
 Most likely in serial transmission
 Number of bits affected depend on data rate and
noise duration

136
Detection
 Need to detect before message is processed
 Redundancy may be used to add additional
bits to a message for error control
 Process must be handled by destination

137
Redundancy

138
Detection Methods
 Parity Check
 Longitudinal Redundancy Check (LRC)
 Checksum
 Hamming Code
 Cyclical Redundancy Check (CRC)

 Parity and CRC are performed by data link layer;


checksum performed by higher-layer protocols

139
Parity Check
 Most common and least expensive
 In even-parity, a redundant bit (parity bit) is
appended to every data unit so total number of 1
bits is even;
 odd-parity – total should be odd

140
Even-parity Check

141
Simple Parity Performance
 Can detect all single-bit errors
 May detect all burst errors as long as total
number of bits changed is odd
 Cannot detect errors when total number of
bits changed is even since parity check will
pass even though errors had occurred

142
Two-Dimensional Parity Check
 Data unit is divided into rows and columns;
parity checks are performed on
corresponding bits of each column

143
Two-Dimensional Parity
Performance
 Increases likelihood of detecting burst errors
 LRC of n bits can easily detect a burst error of n
bits
 May also detect many burst errors of more than
n bits
 Cannot detect errors when two bits in one data
unit are damaged and two bits in exactly the
same positions in another data unit are
damaged

144
Longitudinal Redundancy Check (LRC)
 Organize data into a table and create a parity for
each column

11100111 11011101 00111001 10101001

11100111
11011101
00111001
10101001
10101010

11100111 11011101 00111001 10101001 10101010


Original Data LRC

145
Checksum
 Performed by higher-layer protocols
 Also based on concept of redundancy

146
Checksum Generator
 At sender, checksum generator subdivides
data unit into k equal segments of n bits.
 Segments are added together using one’s
complement arithmetic to get the SUM.
 SUM is complemented and becomes the
checksum, and appended to the end of the
data.

147
Checksum

148
Checksum

149
Checksum example
 Suppose the following block of 16 bits is to be sent
using a checksum of 8 bits
10101001 00111001
The numbers are added using one’s complement
10101001
00111001

11100010
Checksum 00011101
The pattern sent is 10101001 00111001 00011101

150
Checksum example
The receiver receives with no error
10101001
00111001
00011101
Sum 11111111
Complement 00000000 pattern is ok

151
Checksum Checker
 Receiver subdivides data unit in k sections of
n bits
 Sections are added together using one’s
complement to get the sum
 Sum is complemented
 If result is zero, data are accepted; otherwise,
rejected

152
Performance
 Detects all errors involving odd number of
bits, most errors involving even number of
bits
 Since checksum retains all carries, errors
affecting an even number of bits would still
change the value of the next higher column
and the error would be detected
 If a bit inversion is balanced by an opposite bit
inversion, the error is invisible

153
Cyclic Redundancy Check (CRC)
 Parity checks based on addition; CRC based
on binary division
 A sequence of redundant bits (a CRC or CRC
remainder) is appended to the end of the data
unit
 These bits are later used in calculations to
detect whether or not an error had occurred

154
CRC Steps
 On sender’s end, data unit is divided by a
predetermined divisor; remainder is the CRC
 When appended to the data unit, it should be
exactly divisible by a second predetermined
binary number
 At receiver’s end, data stream is divided by
same number
 If no remainder, data unit is assumed to be
error-free

155
Deriving the CRC
 A string of 0s is appended to the data unit; n
is one less than number of bits in
predetermined divisor
 New data unit is divided by the divisor using
binary division; remainder is CRC
 CRC of n bits replaces appended 0s at end of
data unit

156
CRC Generator
 Uses modulo-2 division
 Resulting remainder is
the CRC

157
CRC Checker
 Performed by receiver
 Data is appended with
CRC
 Same modulo-2
division
 If remainder is 0, data
are accepted
 Otherwise, an error has
occurred

158
Error Correction
 Requires more redundancy bits; must know
not only that an error had occurred, but where
the error occurred in order to correct it
 Correction simply involves flipping the bit
 Hamming code may be applied to identify
location where error occurred by strategically
placed redundancy bits

159
Hamming code
1. Calculating the number of redundancy bits
required.
 Eg 1001101 – number of data bits is 7, the value
of parity bits are calculated as
 2r>= m+r+1
 M=7;r=4, total=11bit of data
2. Determining the positions of various data bits
and redundancy bits. The various r bits are
placed at the position that corresponds to the
power of 2
3. Find the value of the redundant bit

160
Redundancy Bits

161
Example Hamming Code
 For a 11-bit data sequence

r1: bits 1, 3, 5, 7, 9, 11
r2: bits 2, 3, 6, 7, 10, 11
r4: bits 4, 5, 6, 7,
r8: bits 8,9,10,11

162
Example Hamming Code

163
Error Detection using Hamming Code

164
Hamming code
 To check for errors, check all of the parity bits.
The pattern of errors, called the error
syndrome, identifies the bit in error.
 If all parity bits are correct, there is no error.
Otherwise, the sum of the positions of the
erroneous parity bits identifies the erroneous
bit.
 For example, if the parity bits in positions 1, 2
and 8 indicate an error, then bit 1+2+8=11 is
in error. If only one parity bit indicates an error,
the parity bit itself is in error.

165
Standards: agreed-upon rules
 Standards is essential in
 Creating/maintaining open and competitive
markets
 Guaranteeing national/international
interoperability
 Two categories
 De jure (“by law” or “by regulation’) standards
 De facto (“by fact” or ‘by convention’)
standards
 Proprietary standards: closed standards
 Nonproprietary standards: open standards
1-166
Standards Organizations
 Standards are developed by
 Standards creation committees
 Forums
 Regulatory agencies

1-167
Standards Committees
 ITU-T(International Telecommunications
Union-Telecommunication)
 Formerly, CCITT formed by UN
 ANSI(American National Standards Institute)
 Private non-profit corporation in the US
 IEEE(Institute of Electrical and Electronics
Engineers)
 The largest engineering society in the world
 EIA(Electronic Industries Association)
 Non-profit organization in the US
1-168
Conn’t…
 ISO(International Organization for
Standardization)
 headquartered in Geneva, Switzerland,
 collection of standards organizations representing 162
countries.
 ISO’s goal is to establish international technological
standards to facilitate global exchange of information and
barrier free trade.
 ISO not an acronym. iso is the Greek word for equal.
 ISO’s authority is not limited to the information-processing
and communications industries.
 It also applies to the fields of textiles, packaging, distribution
of goods, energy production and utilization, shipbuilding, and
banking and financial services.
 The universal agreements on screw threads, bank cards, and

169even the names for currencies are all products of ISO’s work.
Protocols
Internet Standards
 IETF (Internet Engineering Task Force)
 Internet Draft
 working document with no official
status
 with a 6-month lifetime
 RFC (Request for Comment)
 Edited, assigned a number, and made
available to all interested parties

1-170
Protocols

 IANA and ICANN


 In early Internet history, a nonprofit group called the IANA
(Internet Assigned Numbers Authority) kept records of available
and reserved IP addresses and determined how addresses were
doled out.
 ICANN (Internet Corporation for Assigned
Names and Numbers)
 A private, nonprofit corporation is now ultimately responsible for IP
addressing and domain name management.
 Technically speaking, however, IANA continues to perform the
system administration.

171

You might also like