0% found this document useful (0 votes)
17 views170 pages

Introduction to Networking Basics

The document provides an introduction to networking, covering key concepts such as types of computer networks, data communication methods (circuit switching and packet switching), and the OSI model. It explains the TCP/IP protocol stack, detailing the roles of TCP, UDP, and IP in data transmission. Additionally, it discusses network devices and encapsulation processes involved in data flow across networks.

Uploaded by

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

Introduction to Networking Basics

The document provides an introduction to networking, covering key concepts such as types of computer networks, data communication methods (circuit switching and packet switching), and the OSI model. It explains the TCP/IP protocol stack, detailing the roles of TCP, UDP, and IP in data transmission. Additionally, it discusses network devices and encapsulation processes involved in data flow across networks.

Uploaded by

gypatyxo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

INTRO TO

NETWORKING
Rahul Babu M P
WHOAMI();
 I’m Rahul Babu M P, a college student from CS Dep, who is passionate
about technology.
 He is a Learning Programmer, Cyber Security Enthusiast, Self Learning
Ethical Hacker.
 Speaker and Explainer.
 Skilled in C, C++, Python and have basic knowledge in HTML, CSS, JS.
 Skilled in Linux, Networking, Cyber Sec Tools, Social Engineering.
 Tech Communicator, Trainer, Instructor.
 [Link]/rahulthewhitehat
TABLE OF CONTENTS
 Networking – What & Why?
 Types of Computer Networks
 Data Communication over a network.
 A) Circuit Switching
 B) Packet Switching
 Datagrams
 Network Layered Architecture
 Internetworking Devices
NETWORK
Computer Network :
 A communication system for connecting computers / hosts

Why?
 Better connectivity
 Better communication
 Better sharing of resources
 Bring people together
TYPES OF COMPUTER
NETWORKS
Local Area Network (LAN)
 Connects hosts within a relatively small geographical area.
 Same room/building/campus

Wide Area Network (WAN)


 Hosts may be widely dispersed across campuses
 Across cities / countries/ continents
DATA COMMUNICATION OVER
A NETWORK
• Broadly two approaches:
a) Circuit switching
b) Packet switching

B D F
A
C E G H

6
CIRCUIT
SWITCHING
• A dedicated communication path is established between two stations.
• The path follows a fixed sequence of intermediate links.
• A logical channel gets defined on each physical link.
 Dedicated to the connection.

B D F
A
C E G H

7
CIRCUIT SWITCHING
(CONTD.)
• Three steps are required for communication:
a) Connection establishment
• Required before data transmission.

b) Data transfer
• Can proceed at maximum speed.

c) Connection termination
• Required after data transmission is over.
• For deallocation of network resources.

8
CIRCUIT SWITCHING
(CONTD.)
• Drawbacks:
• Channel capacity is dedicated during the entire duration of
communication.
 Acceptable for voice communication.
 Very inefficient for bursty traffic like data.

• There is an initial delay.


 For connection establishment.

9
PACKET
SWITCHING
• Modern form of long-distance data communication.
• Network resources are not dedicated.
• A link can be shared.

• The basic technology has evolved over time.


• Basic concept has remained the same.

10
PACKET SWITCHING
(CONTD.)
• Data are transmitted in short packets (~ Kbytes).
• A longer message is broken up into smaller
chunks.
• The chunks are called packets.
Message
• Every packet contains a header.
 Relevant information for routing, etc.

H H H
PACKETS

11
PACKET SWITCHING
(CONTD.)
• Packet switching is based on store-and-forward concept.
• Each intermediate network node receives a whole packet.
• Decides the route.
• Forwards the packet along the selected route.

• Each intermediate node (router) maintains a routing table.

12
PACKET SWITCHING
(CONTD.)
• Advantages:
• Links can be shared; so link utilization is better.
• Suitable for computer-generated (bursty) traffic.
• Buffering and data rate conversion can be performed
easily.
• Some packets may be given priority over others, if
desired.

13
PACKET SWITCHING
(CONTD.)
• How are packets transmitted?
• Two alternative
approaches:
a) Virtual Circuits
b) Datagram

• The abstract network model:


B D F
A
C E G H

14
(A) VIRTUAL CIRCUIT
APPROACH
• Similar in concept to circuit switching.
• A route is established before packet transmission
starts.
• All packets follow the same path.
• The links comprising the path are not dedicated.
 Different from circuit switching in this respect.

• Analogy:
• Telephone system.

15
(A) VIRTUAL CIRCUIT
APPROACH (CONTD.)
• How it works?
• Route is established a priori.
• Packet forwarded from one node to the next using store-and-forward
scheme.
• Only the virtual circuit number need to be carried by a packet.
 Each intermediate node maintains a table.
 Created during route establishment.
 Used for packet forwarding.
• No dynamic routing decision is taken by the intermediate nodes.

16
(B) DATAGRAM
APPROACH
• Basic concept:
• No route is established beforehand.
• Each packet is transmitted as an independent
entity.
• Does not maintain any history.

• Analogy:
• Postal system.

17
DATAGRAM APPROACH
(CONTD.)
• Every intermediate node has to take routing decisions dynamically.
• Makes use of a routing table.
• Every packet must contain source and destination addresses.
• Problems:
• Packets may be delivered out of order.
• If a node crashes momentarily, all of its queued packets are lost.
• Duplicate packets may also be generated.

18
DATAGRAM APPROACH
(CONTD.)
• Advantages:
• Faster than virtual circuit for smaller number of
packets.
 No route establishment and termination.
• More flexible.
• Packets between two hosts may follow different
paths.
 Can handle congestion/failed link.

B D
C E F
G H
A
19
COMPARATIVE
STUDY
• Three types of delays must be considered:
a) Propagation Delay
• Time taken by a data signal to propagate from one node
to the next.
b) Transmission Time
• Time taken to send out a packet by the transmitter.
c) Processing Delay
• Time taken by a node to process a packet.

20
CIRCUIT
SWITCHING
• After initial circuit establishment, data bits sent continuously without any delay.

21
VIRTUAL CIRCUIT PACKET
SWITCHING
• The Call Request packet sent from source to destination.
• The Call Accept packet returns back.
• Packets sent sequentially in a pipelined fashion.
• Store-and-forward approach.

22
DATAGRAM PACKET
SWITCHING
• No initial delay.
• The packets are sent out independently.
• May follow different paths.
• Also follows store-and-forward
approach.

23
LAYERED NETWORK
ARCHITECTURE
• Open systems interconnection (OSI) reference model.
• Seven layer model.
• Communication functions are partitioned into a hierarchical set of
layers.

• Objective:
• Systematic approach to design.
• Changes in one layer should not require changes in other layers.

24
THE 7-LAYER OSI
MODEL
Application

Presentation
Host-to-host
Session

Transport

Network

Datalink Point-to-point

Physical

11
LAYER Application

FUNCTIONS Presentation

Session
• Physical
Transport
• Transmit raw bit stream over a physical medium.
• Data Link Network

• Reliable transfer of frames over a point-to-point link (flow control, error Datalink
control).
Physical
• Network
• Establishing, maintaining and terminating connections.
• Routes packets through point-to-point links.

26
LAYER FUNCTIONS Application

(CONTD.) Presentation

Session
• Transport
Transport
• End-to-end reliable data transfer, with error recovery and flow
control. Network

• Session Datalink
• Manages sessions.
Physical
• Presentation
• Provides data independence.
• Application
• Interface point for user applications.

27
HOW DATA
FLOWS APPLICATION
APPLICATION

PRESENTATION PRESENTATION

SESSION SESSION

TRANSPORT TRANSPORT
NETWORK NETWORK
N N
DATA LINK DATA LINK
DL DL
PHYSICAL PHYSICAL
P P

S A B D

28
INTERNETWORKING
DEVICES
• Hub
• Extends the span of a single LAN.
• Bridge / Layer-2 Switch
• Connects two or more LANs together.
• Works at data link layer level.
• Router / Layer-3 Switch
• Connects any combination of LANs and
WANs.
• Works at network layer level.

29
TYPICAL
INTERNETWORKING
STRUCTURE

30
TCP/IP STACK
Rahul Babu M P
OBJECTIVES
 TCP/IP protocol stack

 Basic functions of TCP, UDP and IP

 Data encapsulation

 IP Datagrams

 IP Header fields
INTRODU
CTION
• TCP/IP is the most fundamental protocol used in the Internet.
• Allows computers to communicate / share resources.
• Used as a standard.
• To bridge the gap between non-compatible platforms.

• Work on TCP/IP started in the 1970s.


• Funded by US Military.
• Advanced Research Project Agency (ARPA).

33
NETWORK LAYERING
IN TCP/IP
• In 1978, International Standards Organization (ISO) proposed the 7-layer OSI
reference model for network services and protocols.
• TCP/IP does not strictly follow the OSI model.
• It follows a simplified 4-layer model.

34
The 7-layer OSI Model The 4-layer TCP/IP
Application Model
Application Runs on top of layers 1,2,3
Presentation
Host-to-host
Transport End-to-end message
Session
transfer
Transport
Network Packet delivery across Internet
Network

Datalink Point-to-point Datalink Frame transmission over link

Physical

35
DATA FLOW IN 4-
LAYER MODEL
Application Application

Transport Transport

Network Network Network

Datalink Datalink Datalink

A B C

36
TCP/IP
PROTOCOL SUITE
• Refers to a family of protocols.
• The protocols are built on top of connectionless technology (datagrams).
• Data sent from one node to another as a sequence of datagrams.
• Each datagram is sent independently.
• The datagrams corresponding to the same message may follow different routes.
 Variable delay, arrival order at destination.

37
TCP/IP FAMILY MEMBERS
(PARTIAL LIST)
User
FTP TFTP SMTP SNMP DNS Process

Transmission Control Protocol (TCP) User Datagram Protocol (UDP)

Internet Protocol (IP) ICMP IGMP ARP RARP

Datalink and Hardware Layer (e.g., Ethernet)

38
NETWORK PROTOCOLS
• Address Resolution Protocol (ARP)
• Map IP addresses to hardware (MAC) addresses.

• Reverse Address Resolution Protocol (RARP)


• Map hardware addresses to IP addresses.

• Internet Control Message Protocol (ICMP)


• A network device can send error messages and other information.

• Internet Group Management Protocol (IGMP)


• A node can send its multicast group membership to adjacent routers.
TYPICAL
SCENARIO
User Process User Process

TCP UDP

IP

Datalink and Hardware Layer (e.g., Ethernet)

40
WHAT DOES
IP DO?
• IP transports datagrams (packets) from a source node to a destination node.
• Responsible for routing the packets.
• Breaks a packet into smaller packets, if required.
• Unreliable service.
 A packet may be lost in transit.
 Packets may arrive out of order.
 Duplicate packets may be generated.

41
WHAT DOES
TCP DO?
• TCP provides a connection-oriented, reliable service for sending messages.
• Split a message into packets.
• Reassemble packets at destination.
• Resend packets that were lost in transit.

• Interface with IP:


• Each packet forwarded to IP for delivery.
• Error control is done by TCP.

42
WHAT DOES
UDP DO?
• UDP provides a connectionless, unreliable service for sending datagrams (packets).
• Messages small enough to fit in a packet (e.g., DNS query).
• Simpler (and faster) than TCP.
• Never split data into multiple packets.
• Does not care about error control.
• Interface with IP:
• Each UDP packet sent to IP for delivery.

43
ADDRESSES IN
TCP/IP
User Process User Process

Port Address
TCP UDP
(16 bits)

IP Address
IP
(32 bits)

Physical Address
Datalink and Hardware Layer (e.g., Ethernet) (48 bits)

44
ENCAPSUL
ATION
• Basic concept:
• As data flows down the protocol hierarchy, headers (and trailers) get appended to it.
• As data moves up the hierarchy, headers (and trailers) get stripped off.
TFTP client TFTP server
• An example to illustrate:
• Trivial file transfer protocol (TFTP). UDP UDP
• TFTP client transfers 200 bytes of data. IP IP
• 4 bytes of TFTP header gets added.
Ethernet Ethernet

45
ENCAPSULATION
IN TFTP
Data

H-TFTP Data TFTP message

H-UDP H-TFTP Data UDP packet

H-IP H-UDP H-TFTP Data IP packet

H-Eth H-IP H-UDP H-TFTP Data T-Eth Ethernet frame


14 20 8 4 200 4

46
THE IP
LAYER
• IP layer provides a connectionless, unreliable delivery system for packets.
• Each packet is independent of one another.
• IP layer need not maintain any history.
• Each IP packet must contain the source and destination addresses.
• IP layer does not guarantee delivery of packets.
• IP layer encapsulation
• Receives a data chunk from the higher layer (TCP or UDP).
• Prepends a header of minimum 20 bytes.
 Containing relevant information for handling routing and flow control.

47
ILLUSTRATIO
N
Data

20 bytes IP header Data

48
FORMAT OF IP
0 4 8
DATAGRAM
15 31
VER HLEN Service type 16 Total Length

--------- HEADER --------


Identification Flags Fragment Offset

Time to Live Protocol Header Checksum

Source IP Address

Destination IP Address

Options

DATA

49
IP HEADER
FIELDS
• VER (4 bits)
• Version of the IP protocol in use (typically 4).
• HLEN (4 bits)
• Length of the header, expressed as the number of 32-bit words.
• Minimum size is 5, and maximum 15.
• Total Length (16 bits)
• Length in bytes of the datagram, including headers.
• Maximum datagram size :: 216 = 65536 bytes.

50
IP HEADER FIELDS
(CONTD.)
• Service Type (8 bits)
• Allows packet to be assigned a priority.
• Router can use this field to route packets.
• Time to Live (8 bits)
• Prevents a packet from traveling in a loop.
• Senders sets a value, that is decremented at each hop. If it reaches zero, packet is
discarded.

• Protocol (8 bits)
• Identifies the higher layer protocol being used.

51
IP HEADER FIELDS
(CONTD.)
• Source IP address (32 bits)
• Internet address of the sender.

• Destination IP address (32 bits)


• Internet address of the destination.

• Identification, Flags, Fragment Offset


• Used for handling fragmentation.

• Options (variable width)


• Can be given provided router supports.
• Source routing, for example.

52
IP HEADER FIELDS
(CONTD.)
• Header Checksum (16 bits)
• Covers only the IP header.
• How computed?
 Header treated as a sequence of 16-bit integers.
 The integers are all added using ones complement arithmetic.
 Ones complement of the final sum is taken as the checksum.
• A mismatch in checksum causes the datagram to be discarded.

53
VIEWING IP
PACKETS
• We can use packet sniffers to view IP packets.
• Some popular packet sniffers:
• Wireshark
• Windump
• tcpdump
• Tshark
• SolarWinds
• …. and many more

54
WIRESHA
RK …

55
IPV6 – AN
INTRO
Rahul babu m p
OBJECTIVES
Features of IPv6

IPv6 datagram format

Address translation
INTRODUCTION

•The IP protocol forms the foundation of the Internet.


•IP version 4 is used widely today.
•IPv4 suffers from a number of drawbacks.
•Need to enhance the capabilities of the protocol.
•IP Next Generation
•IPng / IPv6

 3
PROBLEMS WITH IPV4

•Limited address space.


•32‐bit address is inadequate today.
•Applications demanding real‐time response.
•Real‐time audio or video.
•Must avoid changing routes frequently.
•Need for more complex addressing and routing capabilities.
•Two‐level structure of IPv4 may not serve the purpose.

 4
MAIN FEATURES OF IPV6
•Something is common with IPv4:
•IPv6 is connectionless – each datagram contains destination address and is
routed independently.
•Header contains the maximum number of hops a datagram can make before
being discarded.
•Some of the other general characteristics are also retained.
IPV6
•Address size: 128‐bit addresses are used.
2128 total addresses.
6 x 1023 unique addresses per square meter of the earth’s surface.
•Header format:
IPv6 uses a series of fixed‐length headers to handle optional
information.
A datagram consists of a base header followed by zero or more
extension headers.
 6
IPV6
•Support for real‐time traffic:
Allows a pair of stations to establish a high quality path between them.
All datagrams flow through this path.
•Increased flexibility in addressing:
Includes the concept of an anycast address, where a packet is delivered
to one of a set of nodes.
Provides for dynamic assignment of IP addresses.

 7
IPV6 DATAGRAM FORMAT
•An IP datagram begins with a base header, followed by zero or more extension headers,
followed by data (transport‐layer PDU).
•40 bytes base header

Base Header Extension Header 1


IPV6 BASE HEADER FORMAT
 Header
Version
Priority (8 bits) Flow Label (20 bits)
(4
bits)
Payload Length (16 bits) Next Hdr (8 bits) Hop Limit (8 bits)

Source Address (128 bits)

Destination Address (128 bits)

9
THE FIELDS
•Version (4 bits): contains the value 6.
•Priority (8 bits): specifies routing priority class.
•Flow Label (20 bits): used with applications that require performance guarantee.
•Payload Length (16 bits): total length of the extension headers and the transport‐level PDU.
•Next Header (8 bits): identifies the type of information that immediately follows the current
header (IP extension, TCP or UDP).
•Hop Limit: decremented by 1 at each hop; discarded when it reaches 0.
•Source/destination addresses: 16 octets (128 bits) each.

 11

 10
IPV6 EXTENSION HEADERS

•Routing Header
•Provides source routing.
•Hop‐by‐hop Options Header
•Defines special options that are processed at each hop.
•Fragment Header
•For fragmentation and reassembly.
•Authentication Header
•For packet integrity & authentication.
 All Extension headers are chained in a linked list.
•Through Next Hdr field.

 13
A POINT ABOUT FRAGMENTATION

• IPv6 fragmentation is similar to that in IPv4.


• Required information contained in a separate fragment extension header.
• Presence of the fragment header identifies the datagram as a fragment.
• Base header copied into all the fragments.

 14
IPV6 ADDRESSING
•Addresses do not have defined classes.
•A prefix length associated with each address (flexibility).
•Three types of addresses:
•Unicast: corresponds to a single computer.
•Multicast: Refers to a set of computers, possibly at different locations. Packet delivered to
every member of the set.
•Anycast: Refers to a set of computers with the same address prefix. Packet delivered to exactly
one of the computers in the set.
Required to support replication of services.

 15
COLON HEXADECIMAL NOTATION

• An IPv6 address is 128 bits long.


• Dotted decimal notation too long.
• Use colon‐hexadecimal notation. Each group of 16 bits written in hex, with a colon separating groups.
• Example:
 7BD6:3DC:FFFF:FFFF:0:2D:F321:FFFF

• Sequence of zeros is written as two colons. 7BD6:0:0:0:0:0:0:B6  7BD6::B6

 16
AGGREGATE GLOBAL UNICAST
ADDRESS
•TLA: top‐level aggregation
•NLA: next‐level aggregation
•SLA: site‐level aggregation
•Interface Id: typically based on hardware MAC address

TLA NLA Id SLA Interface


001 (32)
Id Id Id
(13) (16) (64)
IPV4‐MAPPED IPV6 ADDRESSES

• Allow a host that supports both IPv4 and IPv6 to communicate with a host that supports
only IPv4.
• IPv6 address is based on IPv4 address.
• 80 0’s, followed by 16 1’s, followed by a 32‐bit IPv4 address.

 18
IPV4 COMPATIBLE IPV6 ADDRESSES

•Allows a host supporting IPv6 to talk IPv6 even if the local routers do not talk IPv6.
•Tell endpoint software to create a tunnel by encapsulating the IPv6 packet in an IPv4 packet.
•80 0’s, followed by 16 0’s, followed by a 32‐bit IP address.

 19
TUNNELLING
•Done automatically by the OS kernel when IPv4‐compatible IPv6 addresses are used.
•Encapsulates IPv6 packets in IPv4 packets.
•Use a IPv4 network for packet delivery.
TUNNELLING

IPv4 IPv4 IPv6


Router Router Host

IPv6 Datagram
TRANSITION FROM IPV4 TO IPV6

• Three alternate transition strategies:


a) Dual stack: Both IPv4 and IPv6 protocol stacks supported in the gateway.
b) Tunneling: An IPv6 datagram flows through an intermediate IPv4
network by encapsulating the whole IPv6 packet as payload.
c) Header translation: An IPv4 address is translated into a IPv6 address,
and vice versa.

 21
IP ADDRESSING
& ROUTING
Rahul Babu M P
OBJECTIVES
 IP Packets Fragmentation
 Transparent/Non Transparent Fragmentation
 IP Addressing Basics
FRAGMENTATION
•Why needed?
•The IP layer injects a packet into the datalink layer.
•Not responsible for the reliable transport of these packets.
•Each layer imposes some maximum size of packets, due to various
reasons.
•Called Maximum Transfer Unit (MTU).
•Suppose a large packet travels through a network whose MTU is too
small.
•Fragmentation (and also reassembly) is required.
•Each fragment is transmitted as a separate IP packet.
•Fragmentation is typically done by routers.
•Fragments reassembled later: transparent or non‐transparent
CONNECTION OF
NETWORKS
R N2 R

R
N1 R N3

H
H
R R
N4
TRANSPARENT
FRAGMENTATION
•Fragmentation is transparent to subsequent networks, through
which the packet pass.
•Basic concept:
•An oversized packet reaches a router, which breaks it up into
fragments.
•All fragments sent to the same exit router (say, RE).
•RE reassembles the fragments before forwarding to the next
network.
•Why called transparent?
•Subsequent networks are not even aware that fragmentation had
occurred.
•A packet may get fragmented several times.
TRANSPARENT
FRAGMENTATION (CONTD.)
•Drawbacks:
•All packets must be routed via the same exit router.
•Exit router must know when all the pieces have been received.
•Either a count field or end‐of‐packet field must be stored in each
packet.
•Lot of overhead.
•A large packet may be fragmented and reassembled repeatedly.
NON‐TRANSPARENT FRAGMENTATION

•Fragmentation is not transparent to subsequent networks.


•Basic concept:
•Packet fragments are not reassembled at any intermediate router.
•Each fragment is treated as an independent packet.
•The fragments are reassembled at the final destination host.
•IP uses this philosophy.

8
NON‐TRANSPARENT
FRAGMENTATION (CONTD.)
•Advantage:
•Multiple exit routers may be used.
•Higher throughput.
•Drawback:
•When a large packet is fragmented, overhead increases.
•Each fragment must have a header (minimum 20 bytes).
•IP protocol uses non‐transparent fragmentation.
FORMAT OF IP
0 4 8
DATAGRAM
15 31
VER HLEN Service type 16 Total Length

--------- HEADER --------


Identification Flags Fragment Offset

Time to Live Protocol Header Checksum

Source IP Address

Destination IP Address

Options

DATA

84
WHAT DOES IP DO?
•To allow fragment reassembly at the final destination, IP uses
the following fields in the header:
•Identification (16 bits)
A datagram id set by the source.
•Fragment offset (13 bits)
Indicates where in the original datagram this fragment
belongs to.
Specified in multiple of 8 bytes.
•Flags (3 bits) ‐‐‐ two flags are defined
 D bit :: don’t fragment; prevents fragmentation from
taking place.
 M bit :: more fragment; specifies if this fragment is the
last one in the original packet or not.
EXAMPLE :: IP
FRAGMENTATION

N1 N2
1000 Bytes of
data
MTU of 600 MTU of 400
Bytes of data Bytes of data
BASIC IP ADDRESSING
•Each host connected to the Internet is identified by a unique IP address.
•An IP address is a 32‐bit quantity.
•Expressed as a dotted‐decimal notation W.X.Y.Z, where dots are
used to separate each of the four octets of the address.
•Consists of two logical parts:
a)A network number
b)A host number
•This partition defines the IP address classes.


HIERARCHICAL ADDRESSING
•A computer on the Internet is addressed using a two‐tuple:

•The network number

Assigned and managed by central authority.

•The host number

Assigned and managed by local network administrator.

•When routing a packet to the destination network, only the network

number

is looked at.
SPECIAL‐PURPOSE IP
ADDRESSES
Reserved for private use
•10.x.x.x (Class A)
•172.16.x.x – 172.31.x.x (Class B)
•192.168.x.x (Class C)
•Loopback/local address
•[Link] – [Link]
•Default network
•[Link]
•Limited broadcast => [Link]

 12
SOME CONVENTIONS
•Within a particular network (Class A, B or C), the first and last
addresses serve special functions.
•The first address represents the network number.
For example, [Link]
•The last address represents the directed broadcast address of
the network.
For example, [Link]
CLASSES OF IP
Rahul Babu M P
IP ADDRESS CLASSES
•There are five defined IP address classes.
•Class A UNICAST
•Class B UNICAST
•Class C UNICAST
•Class D MULTICAST
•Class E RESERVED
•Identified by the first few bits in the IP address.
•There also exists some special‐purpose IP addresses.
•The class‐based addressing is also known as the classful model.

6
CLASS A ADDRESS
Class A Address

 0 NETWORK HOST HOST HOST

•Network bits : 7
•Number of networks = 27 – 1 = 127
•Host bits: 24
•Number of hosts = 224 – 2 = 16,777,214
•Address range:
•[Link] to [Link]
CLASS B ADDRESS
Class B Address

 10 NETWORK NETWORK HOST HOST

•Network bits : 14
•Number of networks = 214 – 1 = 16,383
•Host bits: 16
•Number of hosts = 216 – 2 = 65,534
•Address range:
•[Link] to [Link]
CLASS C ADDRESS
Class C Address

 110 NETWORK
Network NETWORK NETWORK HOST

•Network bits : 21
•Number of networks = 221 – 1 = 2,097,151
•Host bits: 8
•Number of hosts = 28 – 2 = 254
•Address range:
•[Link] to [Link]
CLASS D ADDRESS
 Class D Address
 1110 MULTICAST ADDRESS

 Address range:
•[Link] to [Link]

 10
IP SUBNETTING
Rahul Babu M P
OBJECTIVES

IP subnets and masks

Variable length subnet mask (VLSM)

Classless internet domain routing (CIDR)


IP SUBNET
•A subnet is a subset of a class A, B or C network.
•IP addresses without subnets consists of a network portion, and a host portion.
•Represents a static two‐level hierarchical addressing model.
•IP subnets introduces a third level of hierarchy.
a) a network portion
b) a subnet portion
c) a host portion
•Allow more efficient (and structured) utilization of the addresses.
•Uses network masks.

3
NATURAL MASKS
•Network mask [Link] is applied to a class A network [Link].
•In binary, the mask is a series of contiguous 1’s followed by a series of contiguous 0’s.
 11111111 00000000 0000000000000000
NATURAL MASKS (CONTD.)
•Provide a mechanism to split the IP address [Link] into
•a network portion of 10, and
•a host portion of 20.
 Decimal
 IP address: [Link]
 Mask: [Link]
 Binary
00001010 00000000 00000000 00010100
 11111111 00000000 00000000 00000000
Network Host
CREATING SUBNETS USING MASKS
•Masks are very flexible.
•Using masks, networks can be divided into smaller subnets.
•By extending the network portion of the address into the host portion.
•Advantage:
•We can create a large number of subnets from one network.
•Can have less number of hosts per network.
EXAMPLE: SUBNETS

•Network mask [Link] is applied to a class A network [Link].


•This divides the IP address [Link] into
•a network portion of 10,
•a subnet portion of 5, and
•a host portion of 20.
•The [Link] mask borrows a portion of the host space, and applies it to
network space.
•What happens?
•Initially it was a single large Class A network (224 – 2 hosts).
•We have now split the network into 256 subnets.
•From [Link] to [Link].
•The hosts pet subnet decreases to 65,534.
 Decimal Binary
IP address: [Link] 00001010 00000101 00000000 00010100

Mask: [Link] 11111111 11111111 00000000 00000000

 Network Subnet Host


VARIABLE LENGTH SUBNET MASKS
(VLSM)
•Basic concept
•The same network can be configured with different masks.
•Can have subnets of different sizes.
•Allows better utilization of available addresses.
EXAMPLE: VLSM
•Suppose we are assigned a Class C network [Link].
•To be divided into three subnets.
Corresponding to three departments.
With 110, 45 and 50 hosts respectively.
•Available subnet options
•The network mask will be the Class C natural mask [Link]
•Subnet masks of the form 255.255.255.X
Can be used to divide the network into more subnets.
THE VLSM OPTION
•Basic concept:
•Use the mask [Link] to divide the network address into two subnets
with 128 hosts each.
•[Link] (.0 to .127)
•[Link] (.128 to .255)

• Next subnet the second .128 subnet using a mask of [Link].


 (Creates two subnets, 64 hosts each)
•[Link] (.128 to .191)
•[Link] (.192 to .255)
CLASSLESS INTERNET DOMAIN
ROUTING (CIDR)
•CIDR is a new concept to manage IP networks.
•Classless Inter Domain Routing.
•No concept of class A, B, C networks.
•Reduces sizes of routing tables.
•An IP address is represented by a prefix, which is the IP address of the network.
•It is followed by a slash, followed by a number M.
•M: number of leftmost contiguous bits to be used for the network mask.
•Example: [Link] / 18
CIDR: AN IMPORTANT RULE
•The number of addresses in each block must be a power of 2.
•The beginning address in each block must be divisible by the number of
addresses in the block.
•A block that contains 16 addresses cannot have beginning address as
[Link].
•But the address [Link] is possible.
EXAMPLE: CIDR
•An organization is allotted a block with beginning address:
 [Link] / 29
 What is the range of the block?

 Start addr: 10010000 00011000 11000000 00011000


 End addr: 10010000 00011000 11000000 00011111

 There are 8 addresses in the block.


PRESENT TREND
•Use CIDR addressing.
•Existing classful networks can also be represented using this notation.
•Class A: W.X.Y.Z / 8
•Class B: W.X.Y.Z / 16
•Class C: W.X.Y.Z / 24
•All routers today support CIDR.
TCP/UDP
PROTOCOLS
Rahul Babu M P
OBJECTIVES
 TCP and UDP
 Port Numbers
 TCP Header Fields
 TCP Connection Establishment
 UDP Header Fields
INTRODUCTION
•In TCP/IP, the transport layer consists of two different protocols.
a) Transmission control protocol (TCP).
b) User datagram protocol (UDP).
•Basic idea:
•User processes (applications) interact with the TCP/IP protocol
suite by sending/receiving TCP or UDP data.
•Both TCP and UDP in turn uses the IP layer for delivery of
packets.
TYPICAL
SCENARIO
User Process User Process

TCP UDP

IP

Datalink and Hardware Layer (e.g., Ethernet)

11
5
ROLE OF TCP
•Provides a connection‐oriented, reliable, full‐duplex, byte‐stream service.
•Underlying IP layer is unreliable and provides connectionless delivery service.
•TCP provides end‐to‐end reliability using
Checksum
Positive acknowledgements
Timeouts
End‐to‐end flow control.
•TCP also handles
•Establishment and termination of connections between processes.
•Sequencing of data that might reach the destination in any arbitrary order.

 5
ROLE OF UDP
•UDP provides a connectionless and unreliable datagram service.
•Very similar to IP in this respect.
•Provides two features that are not there in IP:
A checksum to verify the integrity of the UDP packet.
Port numbers to identify the processes at the two ends.
PORT NUMBERS
•Multiple user processes on a machine may use TCP or UDP at the same time.
•There is need for a mechanism to uniquely identify the data packets associated with each
process.
PORT NUMBERS (CONTD.)
•How this is done?
•Both TCP and UDP uses 16‐bit integer port numbers.
•Different applications are identified by different port numbers.
•Port numbers are stored in the headers of TCP or UDP packets.
ADDRESSES IN
TCP/IP
User Process User Process

Port Address
TCP UDP
(16 bits)

IP Address
IP
(32 bits)

Physical Address
Datalink and Hardware Layer (e.g., Ethernet) (48 bits)

12
0
PORT NUMBERS (CONTD.)
•Client‐server scenario
•By knowing the 32‐bit IP address of the server host, a client host can connect to the server.
•To identify a particular process running on the server host, the client must also know the
corresponding port number.
•Well‐known port numbers
•Predefined, and publicly known.
•FTP uses port 21, SMTP uses port 25.

 11
PORT NUMBERS (CONTD.)
•Well‐known port numbers are stored in a particular file on the host machine.
•Unix:: /etc/services
•Windows:: C:\WINDOWS\system32\drivers\etc\services
•Each line has the format:
 <service name> <port number>/<protocol> [aliases...] [#<comment>]
•Few lines of the file are shown next.

 12
EPHEMERAL PORT NUMBERS
•A typical scenario:
•A client process sends a message to a server process located on some host at port 1534.
•How will the server know where to respond?
Client process requests an unused port number from the TCP/UDP module on its local host.
These are temporary port numbers, called ephemeral port numbers.
Send along with the TCP or UDP header.
•How are the port numbers assigned?
•Port numbers from 1 to 1023 are reserved for well‐known ports.
Has been extended to 4095.
•Numbers beyond this and up to 65535 used as ephemeral port numbers.

 14
CONNECTION ESTABLISHMENT
•A hierarchical addressing scheme is used to define a connection path between two hosts.
•IP address
Identifies the communicating hosts.
•Protocol identifier
Identifies the transport later protocol being used (TCP, UDP or anything else).
•Port number
Identifies the communicating processes in the two hosts.

 15
ASSOCIATION
•A set of five values that describe a unique process‐to‐process connection is called an
association.
•The protocol (TCP or UDP).
•Local host IP address (32‐bit value).
•Local port number (16‐bit value).
•Remote host IP address (32‐bit value).
•Remote port number (16‐bit value).

•Example of an association:
 {TCP, [Link], 1785, [Link],21}

 16
TRANSMISSION CONTROL
PROTOCOL (TCP)
•TCP supports host‐to‐host communication with the following features:
•Process‐to‐process communication
•Stream delivery service
•Full‐duplex communication
•Multiplexing and de‐multiplexing
•Connection‐oriented reliable service
TCP HEADER FIELDS
•Source port (16 bits)
•Identifies the process at the local end.
•Destination port (16 bits)
•Identifies the process at the remote end.
•Sequence number (32 bits)
•Used for reliable delivery of message.
•Each byte of message is assigned a 32‐bit number that is incremented sequentially.
•The field holds the number of the first byte in that TCP segment.

•Acknowledgement Number (32 bits)


•Used by remote host to acknowledge receipt of data.
•Contains the number of the next byte expected to be received.

•HLEN (4 bits)
•Specifies the header length in number of 32‐bit words.
TCP HEADER FIELDS (CONTD.)
• Acknowledgement Number (32 bits)
• Used by remote host to acknowledge receipt of data.
• Contains the number of the next byte expected to be received.

• HLEN (4 bits)
• Specifies the header length in number of 32‐bit words.

• Flags (6 bits)
• There are six flags.
URG is set to 1 if the urgent pointer is in use.
A connection request is sent by making SYN=1 and ACK=0.
A connection is confirmed by sending SYN=1 and ACK=1.
When the sender has no more data, FIN=1 is sent to release the connection.
RST bit is used to reset a connection. It is also used to reject a connection attempt.
PSH bit indicates the push function. Used to indicate end of message.
TCP HEADER FIELDS (CONTD.)
•Checksum (16 bits)
•Applies to the entire segment and a pseudo‐header.
•The pseudo‐header contains the following IP header fields:
Source IP address, destination IP address, protocol, segment length.
TCP protects itself from mis delivery by IP (delivered to wrong host).
•Same algorithm as used in IP.
TCP CONNECTION
ESTABLISHMENT
UDP HEADER FIELDS
•Source port (16 bits)
•Identifies the process at the local end.
•Destination port (16 bits)
•Identifies the process at the remote end.
•Message length (16 bits)
•Specifies the size of the datagram in bytes (UDP header plus data).
•Checksum (16 bits)
•Computed in the same way as TCP.
•This is optional; set to zero if not used.

 17
ROUTING
PROTOCOLS
Rahul Babu M P
OBJECTIVES
 Packet delivery options

 Routing Methods

 Interior and exterior routing protocols

 Routing information protocol (RIP)

 Open shortest path first (OSPF)

 Border gateway protocol (BGP)

 Message types in BGP


CONNECTION OPTIONS

•Broadly two options:


a) Connection‐oriented
• Network layer protocol first makes a connection.
• All packets delivered as per the connection.
b) Connection‐less
• Network layer protocol treats each packet independently.
• No relationship between packets.
•IP protocol uses connection‐less approach for packet delivery.

 4
PACKET DELIVERY OPTIONS
1. Direct Delivery
•Host‐to‐host
•Router‐to‐host

HOST NETWORK HOST


PACKET DELIVERY OPTIONS
2. Indirect Delivery
•Through one or more routers.

HOST N1 R1 N2 R2

HOST N3
ROUTING METHODS

• Several alternatives possible:


a) Next‐hop routing
b) Network‐specific routing
c) Host‐specific routing
d) Default routing

 7
A) NEXT‐HOP ROUTING
•Routing tables based on next hop.

H1 R1 R2 H2

Dest Next Dest Next Dest Next

Hop Hop Hop


H2 R1 H2 R2 H2 ‐‐
B) NETWORK‐SPECIFIC ROUTING
 Routing table based on destination network address.
Next
R1
Hop
Dest N2

R1 H2

N1 N2

H1
C) HOST‐SPECIFIC ROUTING
•Can specify the address of a host.

Dest Next Hop


H2 R2
N2 R1
N3 R2
R3
N2
R1

N1 H2

H1 R2
N3

10
D) DEFAULT ROUTING
•Follow a default path if no match found.

H1
R1

N2
N1

R2
Dest Next Hop
N2 R1
Default R2
TYPES OF ROUTING TABLE

1. Static
•Contains information inserted manually.
•Does not change with time.
2. Dynamic
•Updated periodically depending on network condition.
•Uses protocols like RIP, OSPF, BGP, etc.

 12
TYPICAL FIELDS IN A ROUTING TABLE

•Subnet mask
•Destination IP address
•Next hop address
•Flags
 U : router is up and running
 G : destination is in another network H : host‐specific address
 D : added by redirection
 M : modified by redirection
•Interface

 13
EXAMPLE (ROUTING TABLE FOR R1)
 TABLE!!
Mask Dest NextHop Interface
[Link] [Link] ‐‐ M0

[Link] [Link] ‐‐ M1

[Link] [Link] [Link] M0

M0
R1 [Link] R2

M1

[Link]

14
HOW TO VIEW THE ROUTING TABLE?

•On Unix / Linux system:


 netstat –r

•On Windows system:


 route print
ROUTING PROTOCOLS

• Two broad classes of protocols are used in the Internet:


a) Interior
Routing Information Protocol (RIP)
Open Shortest Path First (OSPF)

b) Exterior
Border Gateway Protocol (BGP)

 4
AUTONOMOUS SYSTEMS (AS)
•What is an AS?
•A set of routers and networks managed by a single organization.
•The routers within the AS exchange information using a common routing protocol.
•The AS graph is connected (in the absence of failure).
•Every autonomous system is assigned a unique AS number.
•Routing protocols within an AS and across different AS’s can be different.
•Interior versus Exterior.

 5
 Autonomous Systems

R N
R N

N AS‐ R
N AS‐ R
2
1 N
N R
R

R N

N AS‐ R
3
N
R
MORE

•Which class of protocols to use?


•Use interior router protocols to exchange information between routers
within an AS.
RIP or OSPF.
•Use exterior routing protocol to pass exchange routing information
between routers in different AS’s.
BGP.

 7
ROUTING INFORMATION PROTOCOL
(RIP)
•It is an interior routing protocol.
•Routers within an autonomous system exchange messages.
•Distance vector routing using hop count.
•Table entries updated using values received from neighbors.
•Maintain timers to detect failed links.
•Used in first generation ARPANET.

 8
PROBLEMS WITH RIP

•Slow convergence for larger networks.


•If a network becomes inaccessible, it may take a long time for all other routing
tables to know this.
•After a number of message transfers.
•A drawback of routing table updation using distance vectors.
•Routing loops may take a long time to be detected.
•Counting to infinity problem.
•Too much bandwidth consumed by routing updates.
OPEN SHORTEST PATH FIRST (OSPF)

•Widely used as the interior routing protocol in TCP/IP networks.


•Updates routing tables based on link state advertisements.
•Basic concept:
•Computes a route that incurs the least cost.
User configurable: delay, data rate, cost, etc.
•Each router maintains a database.
Topology of the autonomous system to which the router belongs.
Vertices and edges.
OSPF
• Two types of vertices:
a) Router
b) Network
• Two types of (weighted) edges:
a) Two routers connected to each other by direct point‐to‐point link.
b) A router is directly connected to a network.
• A router calculates the least‐cost path to all destination networks.
• Using Dijkstra’s algorithm.
• Only the next hop to the destination is used in the forwarding process.
 11
OSPF

•In the steady state


•All routers know the same network topology.
“Hello” packets sent every 10 seconds (configurable) to neighbors.
•Link State Advertisement (LSA) flooded initially from each router.
•Absence of “Hello” packet for 40 seconds indicate failure of neighbor.
Causes LSA to be flooded again.
•LSAs re‐flooded every 30 minutes anyway.

 12
OSPF HEADER FORMAT

31
Version Type Message Length

Source Address

Area Id

Checksum

Authentication Type

Authentication

13

ROUTING DATA
Authentication
OSPF PACKETS
Packet types :
1. Hello (check if neighbor is up)
2. Database Description (synchronize database at beginning)
3. Link State Request (request specific LSA)
4. Link State Update (LSAs flooded)
5. Link State Acknowledgement (flooded LSAs are explicitly ack‐ed – reliable flooding)

• Authentication type:
• Cleartext
• Encrypted (MD5 Hash, others possible)
BGP
 What is BGP?

•Most widely used exterior router protocol for the Internet.


•Allows routers belonging to different autonomous systems to exchange
routing information.
•Sent as messages over TCP connections.
•The router tables get updated.

 4
BGP OVERVIEW

•Currently in version 4.
•Inter‐AS routing protocol for exchanging network reachability information among
BGP routers.
•Uses TCP on port number 179 to send routing messages.
•It is a distance vector protocol.
•Unlike RIP, BGP contain complete routes.
BGP ILLUSTRATION
R N

R
BGP N R
N AS‐
2
R N
N AS‐ R
1
N
R BGP
R N

BGP N R
AS‐
3
N
R
MESSAGE TYPES IN BGP

• Four types of messages:


1) Open: used to open a neighbor connection with another router.
2) Update: used to transmit information about a single route, advertise new routes,
withdraw infeasible paths.
3) Keepalive: used to periodically confirm the neighbor connection.
4) Notification: used to notify about some error condition.

 7
THE BASIC IDEA

•Two BGP routers exchanging information on a connection are called peers.


•Initially, BGP peers exchange the entire BGP routing table.
•Subsequently, only incremental updates are sent as the routing tables change.
•Keepalive messages are sent periodically to ensure that the connection between
the BGP peers is alive.
•Notification messages are sent in response to errors or special conditions.
•BGP can also be used by routers within the same AS.
ERRORS

• Types of error conditions reported:


•Message header error – authentication and syntax.
•Open message error – syntax errors and unrecognized options.
•Update message error.
•Hold timer expired – used to close a connection if periodic messages are
not received.
•Cease – used by a router to close a connection with another router in the
absence of any other error.

 9
FUNCTIONAL PROCEDURES IN BGP

a)Neighbor Acquisition
•Two routers agree to be neighbors by exchanging messages.

b)Neighbor Reachability
•Check if the neighbor is still alive, and is maintaining the relationship.

c)Network Reachability
•Each router maintains a list of the networks that it can reach, and the preferred
routes.
INFO
•All modern‐day routers support BGP.
•The routers that are managed by ISPs actually run BGP.
•Organizational networks in many cases do not run BGP.
•Rely on the ISP’s routers to route packets to the outside world.
•Default route will be to the ISP router.
EXERCISES
Rahul babu m p
EXAMPLE 1
 For the following routing table of a router, on which interface will the router forward packets
addressed to the destinations [Link] and [Link] ?
Destination Subnet Mask Interface

[Link] [Link] eth0

[Link] [Link] eth1

[Link] [Link] eth2

default [Link] eth3


EXAMPLE 2
 For the following routing table of a router, on which interface will the router forward packets
addressed to the destination [Link]?
Destination Subnet Mask Interface

[Link] [Link] eth0

[Link] [Link] eth1

[Link] [Link] eth2

[Link] [Link] eth3

default [Link] eth1


EXAMPLE 3
•For the network as shown, the IP addresses of the four subnets are:
•Subnet A: [Link]
Subnet A Subnet B
•Subnet B: [Link]
a b
•Subnet C: [Link] R
c d
•Subnet D: [Link] e
Subnet C Subnet D
•The routing table of the internal router R is:
Destination Subnet Mask Interface

[Link] [Link] a
Rext
[Link] [Link] b

[Link] [Link] c
5
[Link] [Link] d

Default [Link] e
•How will packets with the following destination IP addresses be forwarded by the
router R?
 a) [Link]
 b) [Link]
 c) [Link]
 d) 215.1.2 200

You might also like