This document provides an overview of IP and networking basics. It discusses the origins of TCP/IP which was developed by ARPA to create a distributed and decentralized network. It then covers the OSI model and compares it to the TCP/IP architecture. The networking layer uses IP to provide addressing and routing functions across different underlying networks. IP addressing is hierarchical, using both network and host portions. Special addresses like broadcast and loopback are also defined.
3. Origins of TCP/IP
ï”1950âs â 1960âs â US Govt. requirement for
âruggedâ network that would continue to work
in case of a nuclear attack
ï”RAND Corporation (Americaâs leading think
thank) & DoD formed ARPA (Advanced
Research Project Agency)
ï”1968 â ARPA engineers proposed Distributed
network design for ARPANET Network
4. Distributed Network Design
ï”Pre-ARPANET networks
â âconnection orientedâ
â Management & control was centralized
ï”âNewâ Network â ARPANET
â Connectionless
â Decentralised
ï”Modern Internet has evolved from the
ARPANET
6. Internetworks
ï” Start with lots of little networks
ï” Many different types
â Ethernet, dedicated leased lines, dialup, ATM, Frame Relay,
FDDI
ï” Each type has its own idea of addressing and protocols
ï” Want to connect them all together and provide a
unified view of the whole lot (i.e. act as a single large
network)
8. The unifying effect of the network
layer
ï”Define a protocol that works in the same way
with any underlying network
ï”Call it the network layer (IP)
ï”IP routers operate at the network layer
ï”There are defined ways of using:
» IP over Ethernet
» IP over ATM
» IP over FDDI
» IP over serial lines (PPP)
» IP over almost anything
10. What is TCP/IP?
ï”In simple terms is a language that enables
communication between computers
ï”A set of rules (protocol) that defines how two
computers address each other and send data to
each other
ï”Is a suite of protocols named after the two most
important protocols TCP and IP but includes
other protocols such as UDP, RTP, etc
11. Open Systems & TCP/IP
ï” TCP/IP formed from standardized communications
procedures that were platform independent and open
ï” Open systems
â open architecture - readily available to all
ï” What is open system networking?
â network based on well known and standardized protocols
â standards readily available
â networking open systems using a network protocol
12. OSI - Layered Model Concept
ï” Open Systems Interconnection Reference Model (OSI-
RM) adopted as a standard for networking
ï” Divide-and-conquer approach
ï” Dividing requirements into groups, e.g transporting of
data, packaging of messages, end user applications
ï” Each group can be referred to as a layer
â Upper layers are logically closer to the user and deal with
more abstract data, relying on lower layer protocols to
translate data into forms that can eventually be physically
transmitted.
14. OSI Model
APPLICATION
âą Upper Layers
âą Application oriented
âą Independent of layers below
TRANSPORT
âą Lower Layers
âą Transmission of data
âą No differentiation of upper layers
1
3
2
4
5
6
7 Application
Presentation
Session
Transport
Network
Data Link
Physical
15. Layers 7, 6, 5
ï”7: Application layer
â Provides different services to the applications
â Uses the underlying layers to carry out work
» e.g. SMTP (mail), HTTP (web), Telnet, FTP, DNS
ï”6: Presentation layer
â Converts data from applications into common
format and vice versa
ï”5: Session layer
â organizes and synchronizes the exchange of data
between application processes
16. Layer 4
ï”4: Transport layer
â Provides end to end transportation of segments
â E.g. TCP
» encapsulates TCP segments in network layer packets
» adds reliability by detecting and retransmitting lost
packets
» uses acknowledgements and sequence numbers to keep
track of successful, out-of-order, and lost packets
» timers help differentiate between loss and delay
â UDP is much simpler: no reliability features
17. Layer 3
ï”3: 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.
18. Layer 3
ï” 3: Network layer (e.g. IP)
â Unreliable (best effort)
» if packet gets lost, network layer doesnât care for higher layers can
resend lost packets
â Forwards packets hop by hop
» encapsulates network layer packet inside data link layer frame
» different framing on different underlying network types
» receive from one link, forward to another link
» There can be many hops from source to destination
19. Layer 3
ï”3: Network layer (e.g. IP)
â Makes routing decisions
» how can the packet be sent closer to its destination?
» forwarding and routing tables embody âknowledgeâ of
network topology
» routers can talk to each other to exchange information
about network topology
20. Layer 2
ï”2: Data Link layer
â Provides reliable transit of data across a physical
network link
â bundles bits into frames and moves frames between
hosts on the same link
â a frame has a definite start, end, size
â often also a definite source and destination link-layer
address (e.g. Ethernet MAC address)
â some link layers detect corrupted frames while other
layers re-send corrupted frames (NOT Ethernet)
21. Layer 1
ï”1: Physical layer
â moves bits using voltage, light, radio, etc.
â no concept of bytes or frames
â bits are defined by voltage levels, or similar
physical properties
1101001000
22. OSI and TCP/IP
TCP/UDP â end to end reliability
IP - Forwarding (best-effort)
Framing, delivery
Raw signal
Mail, Web, etc.
1
3
2
4
5
6
7 Application
Presentation
Session
Transport
Network
Data Link
Physical
Application
Transport
Network
Data Link &
Physical
OSI TCP/IP
23. Protocol Layers:
The TCP/IP Hourglass Model
Network layer
Token
Ring
ATM X.25 PPP
Frame
Relay
HDLC
Ethernet
IP
UDP
TCP
HTTP FTP Telnet DNS
SMTP Audio Video
RTP
Data link layer
Transport layer
Application layer
24. Layer Interaction
ï”Application, Presentation and Session protocols are
end-to-end
ï”Transport protocol is end-to-end
â encapsulation/decapsulation over network protocol on end
systems
ï”Network protocol is throughout the internetwork
â encapsulation/decapsulation over data link protocol at each
hop
â Link and physical layers may be different on each hop
25. Layer Interaction:
OSI 7-Layer Model
Host Router Router Host
Application
Presentation
Session
Transport
Network
Link
Physical
Network
Link Link
Network
Link Link
Application
Presentation
Session
Transport
Network
Link
Physical
Physical
Hop
by
hop
End
to
end
26. Layer Interaction:
TCP/IP Model
Host Router Router Host
Application
TCP or UDP
IP
Link
Physical
IP
Link Link
IP
Link Link
Application
TCP or UDP
IP
Link
Physical
Physical
Hop
by
hop
End
to
end
No session or presentation layers in TCP/IP model
27. Encapsulation & Decapsulation
ï”Lower layers add headers (and sometimes
trailers) to data from higher layers
Application
Transport
Network
Data Link
Data Link
Network
Data
Transport Layer Data
Header
Network Layer Data
Header
Data
Header
Header
Link Layer Data
Data
Header
Header
Header
Header
Trailer
Trailer
28. Frame, Datagram, Segment, Packet
ï”Different names for packets at different layers
â Ethernet (link layer) frame
â IP (network layer) datagram
â TCP (transport layer) segment
ï”Terminology is not strictly followed
â we often just use the term âpacketâ at any layer
29. ï”Destination and source are 48-bit MAC
addresses
ï”Type 0x0800 means that the data portion of the
Ethernet frame contains an IP datagram. Type
0x0806 for ARP.
Layer 2 - Ethernet frame
Preamble Dest
6 bytes
Source
6 bytes
Length
2 bytes
Data
46 to 1500
bytes
CRC
4 bytes
Type
2 bytes
30. ï” Protocol = 6 means data
portion contains a TCP
segment. Protocol = 17
means UDP.
Layer 3 - IP datagram
IHL Type of Service Total Length
Version
Fragment Offset
Identification Flags
Time to Live Protocol Header Checksum
Source Address
Destination Address
ï”Version = 4
ï”If no options, IHL = 5
ï”Source and Destination
are 32-bit IP addresses
Data
Padding
Options
31. Source and Destination are 16-bit TCP port numbers (IP
addresses are implied by the IP header)
If no options, Data Offset = 5 (which means 20 octets)
Layer 4 - TCP segment
Source Port Destination Port
Sequence Number
Acknowledgement Number
Data
Offset
Window
Reserved A
C
K
U
R
G
E
O
L
R
S
T
S
Y
N
F
I
N
Checksum Urgent Pointer
Data
Padding
Options
33. Purpose of an IP address
ï”Unique Identification of
â Source
Sometimes used for security or policy-based
filtering of data
â Destination
So the networks know where to send the data
ï”Network Independent Format
â IP over anything
34. Purpose of an IP Address
ï”Identifies a machineâs connection to a network
ï”Physically moving a machine from one network
to another requires changing the IP address
ï”Assigned by an appropriate authority such as
RIPE, ARIN, AFRINIC, etc. or Local Internet
Registries (LIRs)
ï”TCP/IP uses unique 32-bit addresses
35. Basic Structure of an IP Address
133 27 162 125
10000101 00011011 10100010 01111101
85 1B A2 7D
ï”32 bit number (4 octet number):
(e.g. 133.27.162.125)
ï”Decimal Representation:
ï”Binary Representation:
ï”Hexadecimal Representation:
37. Address Exercise
ï”Construct an IP address for your routerâs
connection to the backbone network.
ï”196.200.220.x
ï”x = 1 for row A, 2 for row B, etc.
ï”Write it in decimal form as well as binary form.
38. Addressing in Internetworks
ï”The problem we have
â More than one physical network
â Different Locations
â Larger number of computers
ï”Need structure in IP addresses
â network part identifies which network in the
internetwork (e.g. the Internet)
â host part identifies host on that network
39. Address Structure Revisited
ï”Hierarchical Division in IPAddress:
â Network Part (Prefix)
» describes which physical network
â Host Part (Host Address)
» describes which host on that network
â Boundary can be anywhere
» very often NOT at a multiple of 8 bits
Network Host
205 . 154 . 8 1
11001101 10011010 00001000 00000001
40. Network Masks
ï” Network Masks help define which bits are used to
describe the Network Part and which for hosts
ï” Different Representations:
â decimal dot notation: 255.255.224.0
â binary: 11111111 11111111 11100000 00000000
â hexadecimal: 0xFFFFE000
â number of network bits: /19
ï” Binary AND of 32 bit IP address with 32 bit netmask
yields network part of address
42. Special Addresses
ï”All 0âs in host part: Represents Network
â e.g. 193.0.0.0/24
â e.g. 138.37.128.0/17
ï”All 1âs in host part: Broadcast
â e.g. 137.156.255.255 (137.156.0.0/16)
â e.g. 134.132.100.255 (134.132.100.0/24)
â e.g. 190.0.127.255 (190.0.0.0/17)
ï”127.0.0.0/8: Loopback address (127.0.0.1)
ï”0.0.0.0: Various special purposes
43. Allocating IP Addresses
ï”The subnet mask is used to define size of a
network
ï”E.g a subnet mask of 255.255.255.0 or /24
implies 32-24=8 host bits
â 2^8 minus 2 = 254 possible hosts
ï”Similarly a subnet mask of 255.255.255.224 or
/27 implies 32-27=5 hosts bits
â 2^5 minus 2 = 30 possible hosts
44. More Address Exercises
ï”Assuming there are 11 routers on the classroom
backbone network:
â what is the minimum number of host bits needed to
address each router with a unique IP address?
â what is the corresponding prefix length?
â what is the corresponding netmask (in decimal)?
â how many hosts could be handled with that
netmask?
45. More levels of address hierarchy
ï”Remember hierarchical division of IP address
into network part and host part
ï”Similarly, we can group several networks into a
larger block, or divide a large block into several
smaller blocks
â arbitrary number of levels of hierarchy
â blocks donât all need to be the same size
ï”Old systems used more restrictive rules
â New rules are âclasslessâ
â Old style used Class A, B, C networks
46. Old-style classes of IP addresses
ï” Different classes used to represent different sizes of network
(small, medium, large)
ï” Class A networks (large):
â 8 bits network, 24 bits host (/8, 255.0.0.0)
â First byte in range 0-127
ï” Class B networks (medium):
â 16 bits network, 16 bits host (/16 ,255.255.0.0)
â First byte in range 128-191
ï” Class C networks (small):
â 24 bits network, 8 bits host (/24, 255.255.255.0)
â First byte in range 192-223
47. Old-style classes of IP addresses
ï”Just look at the address to tell what class it is.
â Class A: 0.0.0.0 to 127.255.255.255
» binary 0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
â Class B: 128.0.0.0 to 191.255.255.255
» binary 10xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
â Class C: 192.0.0.0 to 223.255.255.255
» binary 110xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
â Class D: (multicast) 224.0.0.0 to 239.255.255.255
» binary 1110xxxxxxxxxxxxxxxxxxxxxxxxxxxx
â Class E: (reserved) 240.0.0.0 to 255.255.255.255
48. Netmasks of classful addresses
ï”A classful network has a ânaturalâ or âimpliedâ
prefix length or netmask:
â Class A: prefix length /8 (netmask 255.0.0.0)
â Class B: prefix length /16 (netmask 255.255.0.0)
â Class C: prefix length /24 (netmask 255.255.255.0)
ï”Old routing systems often used implied
netmasks
ï”Modern routing systems always use explicit
prefix lengths or netmasks
49. Traditional subnetting of classful
networks
ï”Old routing systems allowed a classful network
to be divided into subnets
â All subnets (of the same classful net) had to be the
same size and have the same netmask
â Subnets could not be subdivided any further
ï”None of these restrictions apply in modern
systems
50. Traditional Supernetting
ï”Some traditional routing systems allowed
supernets to be formed by combining adjacent
classful nets.
â e.g. combine two Class C networks (with
consecutive numbers) into a supernet with netmask
255.255.254.0
ï”Modern systems use more general classless
mechanisms.
51. Classless Addressing
ï”Forget old Class A, Class B, Class C
terminology and restrictions
ï”Internet routing and address management today
is classless
ï”CIDR = Classless Inter-Domain Routing
â routing does not assume that class A,B,C implies
prefix length /8,/16,/24
ï”VLSM = Variable-Length Subnet Masks
â routing does not assume that all subnets are the
same size
52. Classless Addressing
ï”IP address with the subnet mask defines the
range of addresses in the block
â E.g 10.1.1.32/28 (subnet mask 255.255.255.240)
defines the range 10.1.1.32 to 10.1.1.47
â 10.1.1.32 is the network address
â 10.1.1.47 is the broadcast address
â 10.1.1.33 ->46 assignable addresses
53. Grouping of decimal numbers
ï”Given a lot of 4-digit numbers (0000 to 9999)
â 10^4 = 10000 numbers altogether
ï”Can have 10^1 (10) groups of 10^3 (1000)
ï”Can have 10^2 (100) groups of 10^2 (100)
ï”Can have 10^3 (1000) groups of 10^1 (10)
ï”Can have 10^4 (10000) groups of 1
ï”Any large group can be divided into smaller
groups, recursively
54. Grouping of binary numbers
ï”Given a lot of 4-bit binary numbers (0000 to
1111)
â 2^4 = 16 numbers altogether
ï”Can have 2^1 (2) groups of 2^3 (8)
ï”Can have 2^2 (4) groups of 2^2 (4)
ï”Can have 2^3 (8) groups of 2^1 (2)
ï”Can have 2^4 (16) groups of 1
ï”Any large group can be divided into smaller
groups, recursively
55. Grouping of binary numbers
ï”Given a lot of 32-bit numbers (0000...0000 to
1111...1111)
â Can have 2^0 (1) groups of 2^32 numbers
â Can have 2^8 (256) groups of 2^24 numbers
â Can have 2^25 groups of 2^7 numbers
ï”Consider one group of 2^7 (128) numbers
» e.g. 1101000110100011011010010xxxxxxx
â Can divide it into 2^1 (2) groups of 2^6 (64)
â Can divide it into 2^3 (8) groups of 2^4 (16)
56. Classless addressing example
ï”A large ISP gets a large block of addresses
â e.g., a /16 prefix, or 65536 separate addresses
ï”Allocate smaller blocks to customers
â e.g., a /22 prefix (1024 addresses) to one customer,
and a /28 prefix (16 addresses) to another customer
ï”An organisation that gets a /22 prefix from their
ISP divides it into smaller blocks
â e.g. a /26 prefix (64 addresses) for one department,
and a /27 prefix (32 addresses) for another
department
57. Classless addressing exercise
ï”Consider the address block 133.27.162.0/23
ï”Allocate 8 separate /29 blocks, and one /28
block
ï”What are the IP addresses of each block?
â in prefix length notation
â netmasks in decimal
â IP address ranges
ï”What is the largest block that is still available?
ï”What other blocks are still available?
59. Large Networks
ï”As networks grow larger it becomes necessary
to split them into smaller networks that are
interconnected
ï” Since each network needs to be connected to
every other network, the number of links can be
quite high: N (N-1)/2
ï” 4 LANs would require six links!
60. WAN Design
ï”Goal: To minimize the number of
interconnecting links
ï”Removing the direct links means that a
mechanism must move data packets from their
source, through other intermediate nodes and
on to the final destination.
ï”This function is performed by a Router
61. An IP Router
ï”A device with more than one link-layer
interface
ï”Different IP addresses (from different subnets)
on different interfaces
ï”Receives packets on one interface, and
forwards them (usually out of another interface)
to get them closer to their destination
ï”Maintains forwarding tables
62. IP router - action for each packet
ï”Packet is received on one interface
ï”Checks whether the destination address is the
router itself
ï”Decrement TTL (time to live), and discard
packet if it reaches zero
ï”Look up the destination IP address in the
forwarding table
ï”Destination could be on a directly attached
link, or through another router
63. Forwarding is hop by hop
ï”Each router tries to get the packet one hop
closer to the destination
ï”Each router makes an independent decision,
based on its own forwarding table
ï”Different routers have different forwarding
tables
ï”Routers talk routing protocols to each other, to
help update routing and forwarding tables
65. Router Functions
ï” Determine optimum routing paths through a network
» Lowest delay
» Highest reliability
ï” Transport packets through the network
» Examines destination address in packet
» Makes a decision on which port to forward the packet through
» Decision is based on the Routing Table
ï” Interconnected Routers exchange routing tables in
order to maintain a clear picture of the network
ï” In a large network, the routing table updates can
consume a lot of bandwidth
» a protocol for route updates is required
66. Forwarding table structure
ï”We don't list every IP number on the Internet - the
table would be huge
ï”Instead, the forwarding table contains prefixes
(network numbers)
â "If the first /n bits matches this entry, send the
datagram this way"
ï”If more than one prefix matches, the longest prefix
wins (more specific route)
ï”0.0.0.0/0 is "default route" - matches anything, but
only if no other prefix matches
68. Encapsulation (reminder)
ï”Lower layers add headers (and sometimes
trailers) to data from higher layers
Application
Transport
Network
Data Link
Data Link
Network
Data
Transport Layer Data
Header
Network Layer Data
Header
Data
Header
Header
Link Layer Data
Data
Header
Header
Header
Header
Trailer
Trailer
69. Classes of Links
ï”Different strategies for encapsulation and
delivery of IP packets over different classes of
links
ï”Point to Point (e.g. PPP)
ï”Broadcast (e.g. Ethernet)
ï”Non-broadcast multi-access (e.g. Frame Relay,
X.25, ATM)
70. Point to Point Links
ï”Two hosts connected by a point-to-point link
â data sent by one host is received by the other
ï”Sender takes IP datagram, encapsulates it in
some way (PPP, SLIP, HDLC, ...), and sends it
ï”Receiver removes link layer encapsulation
ï”Check integrity, discard bad packets, process
good packets
71. Broadcast links
ï”Many hosts connected to a broadcast medium
â Data sent by one host can be received by all other
hosts
â example: radio, ethernet
72. Broadcast links
ï”Have a mechanism for protecting against
interference from simultaneous transmissions
(eg Carrier Sense Multiple Access/Collision Detection for Ethernet)
ï”Address individual hosts
â so hosts know what packets to process and which to
ignore
â link layer address is very different from network
layer address
ï”Mapping between network and link address
(e.g. ARP)
73. NBMA links
(Non-broadcast multi-access)
ï”e.g. X.25, Frame Relay, SMDS
ï”Many hosts
ï”Each host has a different link layer address
ï”Each host can potentially send a packet to any
other host
ï”Each packet is typically received by only one
host
ï”Broadcast might be available in some cases
75. Ethernet Essentials
ï”Ethernet is a broadcast medium
ï”Structure of Ethernet frame:
ï”Entire IP packet makes data part of Ethernet
frame
ï”Delivery mechanism (CSMA/CD)
â back off and try again when collision is detected
Preamble Dest Source Length Data CRC
Type
76. Ethernet/IP Address Resolution
ï”Internet Address
â Unique worldwide (excepting private nets)
â Independent of Physical Network
ï”Ethernet Address
â Unique worldwide (excepting errors)
â Ethernet Only
ï”Need to map from higher layer to lower
(i.e. IP to Ethernet, using ARP)
77. Address Resolution Protocol
ï”Check ARP cache for matching IP address
ï”If not found, broadcast packet with IP address
to every host on Ethernet
ï”âOwnerâ of the IP address responds
ï”Response cached in ARP table for future use
ï”Old cache entries removed by timeout
78. ARP Procedure
1. ARP Cache is checked
2. ARP Request is Sent using broadcast
3. ARP Entry is added
4. ARP Reply is sent unicast
5. ARP Entry is added
79. ARP Table
IP Address Hardware Address Age (Sec)
192.168.0.2 08-00-20-08-70-54 3
192.168.0.65 05-02-20-08-88-33 120
192.168.0.34 07-01-20-08-73-22 43
80. ARP Frame
ï”ARP message is encapsulated in an Ethernet
frame
Dest
Addr
Source
Addr
Frame
Type Frame Data
0x806 Arp Message
81. Format of an ARP Message
0 8 16 31
Hardware Type Protocol Type
HLEN PLEN Operation
Sender HA
Sender HA Sender IP Address
Sender IP Address Target HA
Target HA
Target IP
82. Types of ARP Messages
ï” ARP request
â Who is IP addr X.X.X.X tell IP addr Y.Y.Y.Y
ï” ARP reply
â IP addr X.X.X.X is Ethernet Address
hh:hh:hh:hh:hh:hh
83. Reverse ARP - RARP
ï” For host machines that don't know their IP
address â e.g diskless systems
ï”RARP enables them to request their IP address
from the gateway's ARP cache
ï”Need an RARP server
ï”See RFC 903
ï”NOTE: This is not used much nowadays
â DHCP does same function