Title: Computer Science 425 Distributed Systems
1Computer Science 425Distributed Systems
- Lecture 12
- NETWORKING Part II
2IP Packet Layout
- IP address allocation problem
- Network administrators may overestimate (or
underestimate) future growth - of their networks and request Class B (or Class
C) address. - Three existing solutions
- IP v6
- Classless inter-domain routing (CIDR)
- Problem scarcity of Class B addresses, and
plenty of class C addresses - Network Address Translation (NAT)
3(1) IPv6 Header Layout
0-8 time-insensitive traffic 8-15
time-sensitive traffic
Establishment of virtual circults
IPv6 addresses are 128 bits (16 bytes) long
sufficient to provide 7 x 1023 IP addresses per
square meter across the entire surface of the
Earth.
4(2) CIDR
- Classless Interdomain Routing
- Problem
- Shortage of class B addresses requires sites with
multiple networks to obtain class C network IDs,
instead of a single class B network ID - Every class C network requires now a routing
table entry - Solution
- CIDR prevents this explosion of Internet routing
tables - Basic Concept
- Allocate multiple IP addresses that allow
summarization into a smaller number of routing
table entries - Use Network Prefix and Mask in routing tables to
allow for single entry for the range of class C
addresses in the same subnet
5(3) Network Address Translation (NAT)
- Not all devices have assigned globally-unique IP
addresses - NAT-enabled router translates global registered
IP address into unregistered IP addres - Example
- Home network has been allocated single registered
IP address 83.215.152.95 by the Internet Service
Provider - All Internet-enabled devices on the home network
have been assigned unregistered IP addresses on
the 192.168.1.x Class C subnet - Internal devices are allocated individual IP
addresses dynamically via Dynamic Host
Configuration Protocol (DHCP) - It is conventional to use addresses from one of
the three blocks of addresses (10.z.y.x,
172.16.y.x, 192.168.y.x) that IANA considers for
private internets
6NAT Protocol
- Sender on local home network sends UDP or TCP
packet to a host outside - Router receives the packet and saves the source
IP address and port number in its address
translation table - Router replaces the source address in the packet
with routers IP address and the source port with
a virtual port number that indexes the table slot
containing senders address - Packet is forwarded to the destination by the
router - When the router receives UDP or TCP packet, it
uses the destination port number to access slot
in the address translation table. It replaces the
destination address and port with the internal
address/port and forwards to the internal home
network
7PCs,routers, switches nodes
links edges
The Internet (Internet Mapping Project, color
coded by ISPs)
8We have LANs what are these othernodes that
connect them?
- Hubs connects Ethernet hosts
- Simply repeats packet (connects multiple Ethernet
devices together making them act as a single
network segment - Highest layer data link layer
- Bridges connect different types of networks
- Translate a packet from one format into another,
e.g., Ethernet to FDDI - Highest layer data link layer (multiple)
- Switches connect and route between two LANs
(e.g., two Ethernet segments) - Routing algorithms
- Highest layer data link layer
- Routers connect and route between two networks
- Routing algorithms
- Highest layer network layer
- Tunneling encapsulate and send an
unimplemented protocols packets through from
network layer to network layer - IPv6 packets can be tunneled through the IPv4
network
9How do peer layers talk?
MAC/Data Link layer match the MAC addresses (48
bits) Network Layer e.g., IP match the IP
address (32 bits) Transport Layer e.g., TCP
match the port number (8 bits)
Application
Application message
Transport
port
TCP header
Network
TCP
IP header
MAC
Ethernet header
IP
(Physical)
Ethernet frame
10Translation Who discovers these addresses for
the destination?
- Port number from the IP address ( a standard
port number) - IP address from the resource name/URL (through
the DNS) - Ethernet address from the IP address (through
ARP)
11ARP Address Resolution Protocol between IP and
Underlying Networks
- Most hosts are attached to a LAN by an interface
board that only understands LAN addresses. For
example, every Ethernet board is equipped with a
globally unique 48-bit Ethernet address. - The boards send and receive frames based on
48-bit Ethernet addresses. They know nothing
about the 32-bit IP addresses. - Address Resolution Protocol (ARP) maps the IP
addresses onto data link layer addresses (e.g.,
Ethernet).
12ARP Example
Routers have multiple network Interface
cards/devices. Each interface has a different
MAC/IP address.
13ARP
- Suppose host 1s IP layer (192.31.65.7) gets a
packet from its transport layer destined for - 192.31.65.5 (host 2)?
- Host 1s IP layer broadcasts an ARP packet onto
the Ethernet asking - Who owns IP address 192.31.65.5?''
- Host 2 responds with its Ethernet address (E2).
- The IP layer on host 1 builds an Ethernet frame
addressed to E2, puts the IP packet - in the payload field, and transmits it on the
Ethernet. - The Ethernet board of host 2 detects this frame
and causes an interrupt, to deliver the packet to - the IP layer on host 2.
- Thus, the packet is transmitted from host 1s IP
layer to host 2s IP layer
14ARP
- The performance of ARP can be improved by caching
the broadcast results. - Host 1 can include its own IP to Ethernet mapping
in the ARP packet.
15ARP
- Suppose host 1s IP layer (192.31.65.7) gets a
packet from its transport layer with - destination address set to 192.31.63.8 (host 4)?
- Host 1s IP layer broadcasts an ARP packet onto
the Ethernet asking - Who owns IP address 192.31.63.8?''
- Router E3/F1 responds with its Ethernet address
(E3). - The IP layer on host 1 transmits an Ethernet
frame addressed to E3 - The E3 Ethernet board of router F1 receives the
frame and delivers it to the IP layer on F1 - F1s IP layer knows from the destination address
of 192.31.63.8 in the packet that it has to - be next sent to 192.31.60.7.
- F1s IP layer sends an ARP on the FDDI ring for
IP address 192.31.60.7. - Router E4/F3 replies.
- F1s IP layer transmits an FDDI frame
(containing the packet) addressed to F3 - The FDDI board of F3 receives the frame, and
delivers it to the IP layer. - F3 knows from the destination address of
192.31.63.8 in the packet that it has to - be next sent out to 192.31.63.8 through the
interface E4 - F3 does an ARP on the EE Ethernet for IP address
192.31.63.8 - Host 4 responds with E6
- F3 transmits the packet inside an Ethernet frame
addressed to E6, and it reaches host 4s IP layer
16Knows How?
- Routing Algorithms!
- In the Network layer
17Routing Algorithms
- Programmed in the network layer
- determine the next hop, given the destination
IP address, - thus determine the route for each packet as it
travels through the net, - dynamically update routing information to reflect
failures, changes and congestion. - Two approaches
- link-state (e.g., OSPF)
- Every node knows status of each link in the
network - distance-vector (e.g., RIP)
- Every node knows the next-hop for each possible
destination LAN - Information maintained as a table
- Tables updated either
- Proactively periodically, or
- Reactively when a neighbor/some link status
changes
18Distance Vector Routing
- Also termed as distributed Bellman-Ford algorithm
or Ford-Fulkerson algorithm, included in RIP
(routing information protocol), AppleTalk, and
Cisco routers. - Each node/router maintains a table indexed by
each destination node. Entry gives the best known
distance to destination and which link to use for
forwarding. - Once every T seconds each router sends to each
neighbor its own entire table (proactive)
19Distance Vector Routing
To Link Cost A 1
1 C 2 1 D
4 2 E 4
1 B local
Routing Table for A
Routing Table for B
To Link Cost B 1
1 C 1 2 D
3 1 E 1
2 A local
To Link Cost A 2
2 B 2 1 D
5 2 E 5
1 C local
Link number (all links have cost1)
Routing Table for C
20Pseudo-Code for RIP
Send Each t seconds or when Tl changes, send Tl
on each non-faulty outgoing link. Receive
Whenever a routing table Tr is received on link
n for all rows Rr in Tr if (Rr.link not equal
n) Rr.cost Rr.cost 1 Rr.link n if
(Rr.destination is not in Tl) add Rr to Tl
// add new destination to Tl else for all rows Rl
in Tl if (Rr.destination Rl.destination and
(Rr.cost lt Rl.cost or Rl.link n)) Rl Rr //
Rr.cost lt Rl.cost remote node has better
route // Rl.link n remote node is more
authoritative
21Link State Routing
- Each router must
- Discover its neighbors and learn their network
addresses - When a router is booted, it learns who its
neighbors are by sending a special Hello packet
on each point-to-point link. - The router on the other end sends back a reply.
- Measure the delay or cost to each of its
neighbors - A router sends a special Echo packet over the
link that the other end sends back immediately.
By measuring the round-trip time, the sending
router gets a reasonable delay estimate. - Construct a packet telling all it has just
learned. - Broadcast this packet
22Link State Routing
- A router broadcasts a link-state-advertisement
(LSA) packet after booting, as well as
periodically (or upon topology change). Packet
forwarded only once, TTL-restricted - Initial TTL is very high.
23Link State Routing
- Broadcast the LSA packet to all other routers in
the subnet. - Each packet contains a sequence number that is
incremented for each new LSA packet sent. - Each router keeps track of all the (source
router, sequence) pairs it sees. When a new LSA
packet comes in, it is checked against the pairs.
If the received packet is new, it is forwarded
on all the links except the one it arrived on. - The age of each packet is included and is
decremented once per time unit. When the age hits
zero, the information is discarded. Initial age
very high - For routing a packet, since the source knows the
entire network graph, it simply computes the
shortest path (actual sequence of nodes) locally
using the Dijkstras algorithm.
24Transport Layer Transmission Control
Protocol
- Function 0 provide an application with a
connection-oriented view of the network (IP is
connectionless) - Function 1 (Message decomposition and
reassembly) Breaks messages into packets at the
transmitting end and reassembles packets into
messages at the receiving end. - E.g., using identification and fragment offset
fields in IPv4 header - Function 2 (Multiplexing and demultiplexing)
Multiplexes several lower-rate sessions, all from
the same source and all going to the same
destination, into one session at the network
layer. - Function 3 (Reliable communication) Provides
reliability to the application by acks
retransmissions in an end to end manner - Function 4 (End-to-end congestion/flow control)
Reduces rate at which data is sent when
congestion is detected in the network. (TCP
friendliness) - All these functionalities are a part of TCP.
25Session/Presentation/Application Layers
- The session and presentation layers deal with
setting up virtual sessions (e.g., SSL), data
encryption, data compression etc. - The application layer actually does the work
required by the users, e.g., FTP, HTTP, p2p. - The application/presentation/session layers are
not clearly distinguished in the Internet
protocol stack.
26Next
- Tuesday (7 October) Midterm Exam.
- Location Here (Classroom).
- Closed book.
- Duration 75 minutes.
- 2.00 pm - 3.15 pm
27Midterm Review
- Topics Lectures 1-10
- What is a distributed system and examples of
distributed systems - Time and Synchronization
- Cristians Algorithm, Berkeley Algorithm and NTP
- Happens-Before Relation, Lamport Timestamps,
Vector Logical Clocks - Global States and Snapshots
- Consistent state, liveness, safety properties
- Chandy Lamport Snapshot Algorithm
- Causality violation
- Multicast
- B-multicast
- Reliable multicast (integrity, validity,
agreement properties) - Ordered Multicast Total, FIFO, Causal Ordering
28Midterm Review Topics
- Implementing FIFO Ordering, Total Ordering,
Causal Ordering - Mutual Exclusion
- Evaluation criteria (client delay,
synchronization delay) - Centralized control , token ring, Ricart and
Agrawala, Maekawas Algorithms, Raymonds
token-based approach - Election
- Ring election, modified ring election, Bully
algorithm - Consensus problem
- Consensus problem in synchronous systems
- Consensus problem in asynchronous systems,
commutative schedules - Failure Detectors
- Properties of failure detector (completeness,
accuracy) - Ping-ack, heart-beating protocols
- Failure detection in distributed system (ring
heart-beating,) - Failure types
29Midterm Review Topics
- Peer-to-peer systems
- Napster protocol and search
- Gnutella protocol and search
- FastTrack protocol and search
- Chord, distributed hash tables, search under peer
failure, new peers joining