Chapter 1. Networking Fundamentals
Chapter 1. Networking Fundamentals
03/02/2020 2
1
03/02/2020
03/02/2020 3
1 2 3 4 5 6
03/02/2020 4
2
03/02/2020
Data encoding
Signal generation: electro-magnetic signals to be transmitted over a
transmission medium
Synchronization: timing of signals between the transmitter and receiver
Error detection and correction: ensuring that transmission errors are
detected and corrected
Flow control: ensuring that the source does not overwhelm the
destination by sending data faster than the receiver can handle
Multiplexing: make more efficient use of a transmission facility. This
technique is used at different levels of communication
Addressing: indicating the identity of the intended destination
Routing: selecting appropriate paths for data being transmitted
Message formatting: conforming to the appropriate format
Security: ensuring secure message transmission
Systems management
03/02/2020 5
3
03/02/2020
03/02/2020 7
4
03/02/2020
Resource Sharing
o Hardware (computing resources, disks, printers)
o Software (application software)
Information Sharing
o Easy accessibility from anywhere (files, databases)
o Search Capability (WWW)
Communication
o Email
o Message broadcast
Remote computing
Distributed processing (GRID Computing)
03/02/2020 9
03/02/2020 10
5
03/02/2020
03/02/2020 11
03/02/2020 12
6
03/02/2020
Advantage:
o Easy to implement and extend
o Well suited for temporary networks that must be set up in a hurry
o Typically the least cheapest topology to implement
o Failure of one station does not affect others
Disadvantage
o Difficult to administer/troubleshoot
o Limited cable length and number of stations
o A cable break can disable the entire network; no redundancy
o Maintenance costs may be higher in the long run
o Performance degrades as additional computers are added
03/02/2020 13
03/02/2020 14
7
03/02/2020
Advantage
o This type of network topology is very organized
o Performance is better than that of Bus topology
o No need for network server to control the connectivity between
workstations
o Additional components do not affect the performance of network
o Each computer has equal access to resources
Disadvantage:
o Each packet of data must pass through all the computers between
source and destination, slower than star topology
o If one workstation or port goes down, the entire network gets affected
o Network is highly dependent on the wire which connects different
components
03/02/2020 15
03/02/2020 16
8
03/02/2020
Advantage:
o Compare to bus: gives far much better performance
o Easy to connect new nodes or devices
o Centralized management.
o Failure of one node or link doesn’t affect the rest of network
Disadvantage:
o If central device fails whole network goes down
o The use of hub, a router or a switch as central device increases the
overall cost of the network
o Performance and as well number of nodes which can be added in
such topology is depended on capacity of central device
03/02/2020 17
03/02/2020 18
9
03/02/2020
Advantages
o Each connection can carry its own data load.
o It is robust.
o Fault is diagnosed easily.
o Provides security and privacy.
Disadvantages:
o Installation and configuration is difficult.
o Cabling cost is more.
o Bulk wiring is required.
03/02/2020 19
03/02/2020 20
10
03/02/2020
03/02/2020 21
Physical Media
o Cable,
Interconnecting Devices
o Router, switch, hub…
Computers
o Server, client
Networking Software
o Protocol, Network OS
Applications
o Mail, web….
03/02/2020 22
11
03/02/2020
03/02/2020 23
03/02/2020 24
12
03/02/2020
Introduction to Internet
The Network Edge
The Network core
o Switching Techniques: Circuit and Packet
03/02/2020 25
26
13
03/02/2020
27
14
03/02/2020
29
15
03/02/2020
Scale
How to manage such a large system,
growing rapidly and uncontrollably,
consisting of heterogeneous devices,
managed by multiple entities
having limited resources
31
03/02/2020 32
16
03/02/2020
03/02/2020 33
03/02/2020 34
17
03/02/2020
03/02/2020 35
36
18
03/02/2020
37
38
19
03/02/2020
Mobile network
PC
Millions of connected devices:
o Hosts = end systems Global ISP
Server
o Running network apps
Wireless
laptop Home
Communication links
• network
Regional ISP
Smartphone
– Fiber, copper, radio,
satellite
– Transmission rate:
Wireless bandwidth
links
Wired
Enterprise
links network
03/02/2020 40
20
03/02/2020
Network:
o Mobile
o Home
o Enterprise
03/02/2020 41
03/02/2020 42
21
03/02/2020
DSL
FTTH
03/02/2020 43
03/02/2020 44
22
03/02/2020
03/02/2020 45
03/02/2020 46
23
03/02/2020
Network Structure 1
o interconnects all of the access ISPs with a single global transit ISP - a
network of routers and communication links that not only spans the
globe, but also has at least one router near each of the hundreds of
thousands of access ISPs
Network Structure 2,
o consists of the hundreds of thousands of access ISPs and multiple global
transit ISPs (the top tier and access ISPs at the bottom tier)
Network Structure 3
o multi-tier hierarchy – Internet
o Add more points of presence (PoPs) - group of routers in the provider’s
network
Network Structure 4
o ISPs, regional ISPs, tier-1 ISPs, PoPs, multi-homing, peering, and IXPs
Network Structure 5
o Network Structure 4 by adding content provider networks
03/02/2020 47
03/02/2020 48
24
03/02/2020
The switching technique will decide the best route for data
transmission.
03/02/2020 49
Message Switching
03/02/2020 50
25
03/02/2020
03/02/2020 51
26
03/02/2020
The message splits into packets that are given a unique number
to identify their order at the receiving end.
Every packet contains some information in its headers such as
source address, destination address and sequence numbe
Sequence of A & B packets does not have fixed pattern,
bandwidth shared on demand => statistical multiplexing.
TDM: each host gets same slot in revolving TDM frame
03/02/2020 53
27
03/02/2020
03/02/2020 55
03/02/2020 56
28
03/02/2020
03/02/2020 57
58
29
03/02/2020
Ex:
R=1kbps, L=1Kb
T=?
59
d=20km, dprop ?
03/02/2020 60
30
03/02/2020
Cars now “propagate” at Yes! After 7 min, 1st car at 2nd booth
and 3 cars still at 1st booth.
1000 km/hr
Toll booth now takes 1 min to 1st bit of packet can arrive at 2nd
service a car router before packet is fully
transmitted at 1st router!
Q: Will cars arrive to 2nd booth
before all cars serviced at 1st See Ethernet applet at AWL
Web site
booth?
the first bits in a packet can arrive at a router while many of the
remaining bits in the packet are still waiting to be transmitted by the
03/02/2020 61
preceding router
31
03/02/2020
Note: speed of processor is very high, dqueue and dproc are less
03/02/2020 63
64
32
03/02/2020
03/02/2020 65
33
03/02/2020
03/02/2020 67
03/02/2020 68
34
03/02/2020
35
03/02/2020
Layered Architecture
o Ex: Taking an airplane trip: actions
03/02/2020 71
03/02/2020 72
36
03/02/2020
■ Less complex: network models break the concepts into smaller parts.
■ Standard interfaces: allow multiple vendors to create products that fill a
particular role, with all the benefits of open competition.
■ Easier to learn: more easily discuss and learn about the many details of a
protocol specification.
■ Easier to develop: Reduced complexity allows easier program changes and
faster product development.
■ Multivendor interoperability: meet the same networking standards means
that computers and networking gear from multiple vendors can work in the
same network.
■ Modular engineering: implements higher layers, another vendor can write
software that implements the lower layers
03/02/2020 73
03/02/2020 74
37
03/02/2020
03/02/2020 76
38
03/02/2020
03/02/2020 77
39
03/02/2020
03/02/2020 79
03/02/2020 80
40
03/02/2020
03/02/2020 81
03/02/2020 82
41
03/02/2020
03/02/2020 83
03/02/2020 84
42
03/02/2020
Introduction
TCP/IP Encapsulation
Internet protocol stack
Application layer
Transport layer
Network layer
Link layer
03/02/2020 85
03/02/2020 86
43
03/02/2020
03/02/2020 87
03/02/2020 88
44
03/02/2020
03/02/2020 89
Introduction
Application architectures
Socket programming
03/02/2020 90
45
03/02/2020
03/02/2020 92
46
03/02/2020
Hybrid of client-
server and P2P
03/02/2020 93
Socket
o process sends/receives messages to/from its socket
o socket analogous to door
• sending process shoves message out door
• sending process relies on transport infrastructure on other side of door to
deliver message to socket at receiving process
application application
socket controlled by
process process app developer
transport transport
physical physical
47
03/02/2020
2-96
48
03/02/2020
2-98
49
03/02/2020
application underlying
application layer protocol transport protocol
50
03/02/2020
TCP/IP Encapsulation
Internet protocol stack
Application layer
Transport layer
Network layer
Link layer
03/02/2020 101
Introduction
TCP and UDP
TCP - reliable data transfer
TCP Connection Management
TCP flow Control
TCP Congestion Control
03/02/2020 102
51
03/02/2020
03/02/2020 104
52
03/02/2020
03/02/2020 105
32 bits
How demultiplexing works
source port # dest port #
host receives IP datagrams
each datagram has source IP
address, destination IP address other header fields
each datagram carries one
transport-layer segment
each segment has source, application
destination port number data
host uses IP addresses & port (payload)
numbers to direct segment to
appropriate socket
TCP/UDP segment format
53
03/02/2020
03/02/2020 107
TCP UDP
reliable transport between sending unreliable data transfer between
and receiving process
flow control: sender won’t sending and receiving process
overwhelm receiver does not provide: reliability, flow
congestion control: throttle sender control, congestion control, timing,
when network overloaded throughput guarantee, security,
does not provide: timing, minimum
throughput guarantee, security orconnection setup,
connection-oriented: setup required
between client and server processes Q: why bother? Why is there a UDP?
54
03/02/2020
03/02/2020 109
03/02/2020 110
55
03/02/2020
5. Data Offset (4-bits) - implies both, the size of TCP header (32-bit words) and the offset of
data in current packet in the whole TCP segment.
6. Reserved (3-bits) - for future use and all are set zero by default
7. Flags(1-bit each):
URG - Urgent Pointer field has significant data and should be processed.
ACK - If ACK is cleared to 0, it indicates that packet does not contain ack.
PSH - When set, it is a request to the receiving station to PUSH data (as soon as it
comes) to the receiving application without buffering it.
RST - It is used to restart a connection.
SYN - This flag is used to set up a connection between hosts.
FIN - release a connection and no more data is exchanged thereafter.
8. Windows Size - is used for flow control between two stations and indicates the amount of
buffer (in bytes) the receiver has allocated for a segment, i.e. how much data is the receiver
expecting.
9. Checksum - contains the checksum of Header, Data and Pseudo Headers.
10. Urgent Pointer - It points to the urgent data byte if URG flag is set to 1.
11. Options - It facilitates additional options which are not covered by the regular header.
03/02/2020 112
56
03/02/2020
03/02/2020 113
03/02/2020 114
57
03/02/2020
58
03/02/2020
sender receiver
sender receiver send pkt0 pkt0
send pkt0 pkt0
rcv pkt0
ack0 send ack0
rcv pkt0
send ack0 rcv ack0
ack0 send pkt1 pkt1
rcv ack0 rcv pkt1
send pkt1 pkt1
send ack1
rcv pkt1
ack1 ack1
send ack1
X
loss timeout
resend pkt1 pkt1
timeout rcv pkt1
resend pkt1 pkt1 rcv ack1 (detect duplicate)
rcv pkt1 pkt0
send ack1
send pkt0
(detect duplicate) ack1
ack1 send ack1 rcv ack1 rcv pkt0
rcv ack1 send pkt0
ack0 send ack0
pkt0
send pkt0 pkt0
rcv pkt0
rcv pkt0 ack0 (detect duplicate)
ack0 send ack0 send ack0
stop-and-wait operation
sender receiver
first packet bit transmitted, t = 0
last packet bit transmitted, t = L / R
59
03/02/2020
Pipelined protocols:
60
03/02/2020
61
03/02/2020
03/02/2020 123
03/02/2020 124
62
03/02/2020
application
process
application may remove data
from TCP socket buffers …. application
TCP socket OS
receiver buffers
… slower than TCP
receiver is delivering
(sender is sending) TCP
code
TCP provides a flow-control service:
- receiver controls sender, so sender
won’t overflow receiver’s buffer by IP
transmitting too much, too fast. code
- the sender maintain a variable called
the receive window - how much
free buffer space is available at the from sender
receiver
receiver protocol stack
Receiver Sender
Sends rwnd to Sender Limits # of unACKed bytes to
rwnd
03/02/2020 126
63
03/02/2020
03/02/2020 127
Host C
Host B
maximum per-
connection throughput: R/2 Host D
R/2
large delays as
delay
64
03/02/2020
Host A
R/2
idealization: perfect
knowledge
lout
65
03/02/2020
R/2
Idealization: known loss
packets can be lost,
dropped at router due to when sending at R/2, some
full buffers packets are retransmissions
but asymptotic goodput is
sender only resends if
lout
still R/2 (why?)
packet known to be lost
lin R/2
Host B
R/2
Realistic: duplicates
packets can be lost, dropped at router
due to full buffers when sending at R/2, some
sender times out prematurely, sending packets are retransmissions
two copies, both of which are delivered including duplicated that are
lout
delivered!
R/2
lin lin
timeout lout
copy l'in
A
free buffer space!
Host B
66
03/02/2020
03/02/2020 133
TCP/IP Encapsulation
Internet protocol stack
Application layer
Transport layer
Network layer
Link layer
03/02/2020 134
67
03/02/2020
Introduction
Functions
Internet protocol
IP fragmentation and reassembly
IP Address
ICMP
Tools: Traceroute, Ping, pingpath
03/02/2020 135
application
transport
network
data link
transport segment from sending to physical
network network
receiving host data link data link
network
on sending side encapsulates physical physical
data link
segments into datagrams physical network network
data link data link
on receiving side, delivers physical physical
segments to transport layer
network network
network layer protocols in every data link
data link
host, router physicalnetwork physical
68
03/02/2020
Functions
o forwarding: move packets from
router’s input to appropriate router
output
o routing: determine route taken by
packets from source to destination:
routing algorithms
Interplay between routing and
forwarding
o the routing algorithm determines
the values that are inserted into the
routers’ forwarding tables
03/02/2020 137
03/02/2020 138
69
03/02/2020
a VC consists of:
o path from source to destination
o VC numbers, one number for each link along path
o entries in forwarding tables in routers along path
packet belonging to VC carries VC number (rather than dest
address)
VC number can be changed on each link.
o New VC number comes from forwarding table
03/02/2020 139
A simple VC
o Host A -> Host B
o Path: A-R1-R2-B
o VC nums: 12, 22, 32
when a packet in this VC
o leaves Host A, the value in the VC
number field is 12;
o leaves R1, the value is 22;
o leaves R2, the value is 32 In Int Incoming Out int Outgoing
the forwarding table in R1 might look VC VC
something 1 12 2 22
like this 2 63 1 18
3 7 2 17
1 97 3 87
03/02/2020 … … … … 140
70
03/02/2020
03/02/2020 141
layer
forwarding
table ICMP protocol
• error reporting
• router “signaling”
link layer
physical layer
03/02/2020 142
71
03/02/2020
IP protocol version
32 bits total datagram
number
length (bytes)
header length head. type of
ver length
(bytes) len service
for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at
each router) 32 bit source IP address
For example,
o Ethernet frames can carry up to 1,500 bytes of data,
o some wide-area links can carry no more than 576 bytes.
03/02/2020 144
72
03/02/2020
223.1.3.1 223.1.3.2
146
73
03/02/2020
Routing
RIP OSPF BGP PIM
IP payload
4 byte header:
• Type (1 byte): type of ICMP message
• Code (1 byte): subtype of ICMP message
• Checksum (2 bytes): similar to IP header checksum. Checksum is
calculated over entire ICMP message
If there is no additional data, there are 4 bytes set to zero.
each ICMP messages is at least 8 bytes long
bit # 0 7 8 15 16 23 24 31
additional information
or
0x00000000
148
74
03/02/2020
ICMP query:
• Request sent by host to a router or host
• Reply sent back to querying host Type/Code: Description
Ex, ICMP queries: 8/0 Echo Request
0/0 Echo Reply
13/0 Timestamp Request
14/0 Timestamp Reply
The ping command
10/0 Router Solicitation
uses Echo Request/
9/0 Router Advertisement
Echo Reply
149
150
75
03/02/2020
Type Code
Checksum
(= 17 or 18) (=0)
identifier sequence number
152
76
03/02/2020
153
154
77
03/02/2020
RFC 792: If, in the destination host, the IP module cannot deliver the datagram
because the indicated protocol module or process port is not active, the destination
host may send a destination unreachable message to the source host.
Ex1: Port Unreachable No process
Request a service port 80 is waiting
at port 80
Client Server
Port Unreachable
155
Ping: Packet InterNet Groper (by Mike Muuss of the Army Research
Laboratory in 12,1983)
o check if a particular IP address is accessible or not.
o checking if the computers on a local network are activeIt also
measures round trip time and reports errors
o Operate based on ICMP
Ping <host> [-t/-n/-l] -> time, count, size
03/02/2020 156
78
03/02/2020
Tracert/Traceroute: (windows/Linux)
o traces a packet from your computer to the host,
o show the number of steps (hops) required to reach there and time
o works by:
• sending the packets of data with low survival time TTL - specifies how
many steps (hops) can the packet survive before it is returned.
• When a packet can’t reach the final destination and expires at an
intermediate step, that node returns the packet and identifies itself.
• So, by increasing the TTL gradually,
o identify the intermediate hosts.
• If any of the hops come back with “Request timed out”, it denotes network
congestion and a reason for slow loading Web pages and dropped
connections.
03/02/2020 157
158
79
03/02/2020
TCP/IP Encapsulation
Internet protocol stack
Application layer
Transport layer
Network layer
Link layer
03/02/2020 160
80
03/02/2020
Introduction
services
Error detection and correction
Transmission Modes
o Simplex,
o Half-Duplex and
o Full-Duplex
LAN addresses and ARP
PPP
03/02/2020 161
Some terminology:
hosts and routers are nodes (bridges and switches too)
communication channels that connect adjacent nodes along
communication path are links
o wired links
o wireless links
o LANs
PDU is a frame,
encapsulates a
network-layer datagram
81
03/02/2020
Framing:
o encapsulate datagram into frame, adding header, trailer
o ‘physical addresses’ used in frame headers to identify source,
destination
• different from IP address!
Link access
o Media access control (MAC) protocol
o Coordinate the frame transmissions of many nodes if multiple
nodes share a medium
Reliable delivery between adjacent nodes
o we learned how to do this already (chapter 3)!
o seldom used on low bit error link (fiber, some twisted pair)
o Used on wireless links: high error rates
• Correct an error locally at link level
5a-
163
Flow Control:
o pacing between adjacent sending and receiving nodes
Error Detection:
o errors caused by signal attenuation, noise.
o receiver detects presence of errors:
• signals sender for retransmission or drops frame
Error Correction:
o receiver identifies and corrects bit error(s) without resorting to
retransmission
Half-duplex and full-duplex
o with half duplex, nodes at both ends of link can transmit, but not at
same time
5a-
164
82
03/02/2020
sending side:
o encapsulates datagram in a frame
o adds error checking bits, rdt, flow
control, etc.
receiving side
o looks for errors, rdt, flow control,
o extracts datagram, passes to
receiving node
03/02/2020 165
03/02/2020 166
83
03/02/2020
03/02/2020 167
168
84
03/02/2020
0 0
5a-
85
03/02/2020
D.2r
R = remainder[ ]
G
5a-
172
86
03/02/2020
Full-Duplex
Half-Duplex
03/02/2020 173
03/02/2020 174
87
03/02/2020
Introduction
services
Error detection and correction
Transmission Modes
o Simplex,
o Half-Duplex and
o Full-Duplex
LAN addresses
ARP
PPP
03/02/2020 175
32-bit IP address:
network-layer address
used to get datagram to destination IP network (recall IP
network definition)
LAN (or MAC or physical or Ethernet) address:
used to get datagram from one interface to another
physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the
adapter ROM
88
03/02/2020
= adapter
LAN
(wired or
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
5a-
177
89
03/02/2020
A 223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4 223.1.2.9
B
223.1.2.2
223.1.1.3 223.1.3.27 E
223.1.3.1 223.1.3.2
5a-179
datagram
frame
03/02/2020 180
90
03/02/2020
1A-2F-BB-76-09-AD
237.196.7.23
237.196.7.14
LAN
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
237.196.7.88 5a-
181
91
03/02/2020
92
03/02/2020
93
03/02/2020
94
03/02/2020
95
03/02/2020
5a-191
R
B
Two ARP tables in router R, one for each IP network (LAN)
In routing table at source Host, find router 111.111.111.110
In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc
5a-
192
96
03/02/2020
R
B
A creates datagram with source A, destination B
A uses ARP to get R’s MAC address for 111.111.111.110
A creates link-layer frame with R's MAC address as destination, frame
contains A-to-B IP datagram
A’s data link layer sends frame
R’s data link layer receives frame
R removes IP datagram from Ethernet frame, sees its destined to B
R uses ARP to get B’s physical layer address, and creates frame containing A- 193
to-B IP datagram sends to B
Introduction
services
Error detection and correction
Transmission Modes
o Simplex,
o Half-Duplex and
o Full-Duplex
LAN addresses
ARP
PPP
03/02/2020 194
97
03/02/2020
98
03/02/2020
no error correction/recovery
no flow control
out of order delivery OK
no need to support multipoint links (e.g., polling)
99
03/02/2020
Sender:
o adds (“stuffs”) extra < 01111101> byte before each < 01111110> data
byte
o adds (“stuffs”) extra < 01111101> byte before each < 01111101> data
byte
Receiver:
o single 01111101 byte: discard 01111101
o two 01111101 bytes in a row: discard first byte, continue data
reception
o single 01111110: flag byte
100
03/02/2020
flag byte
pattern
in data
to send
101
03/02/2020
03/02/2020 204
102
03/02/2020
03/02/2020 205
103