Documente Academic
Documente Profesional
Documente Cultură
Network Layer
Recall:
The network layer is responsible for the routing of packets The network layer is responsible for congestion control
Contents
Connection-Oriented and Connectionless Service The IP Protocol IP-Support Protocols Routing Algorithms Congestion Control
Connectionless service
No guarantee No prior connection setup required; packets are stored and forwarded one at a time by IMPs
Two users are provided with the illusion of a dedicated point-to-point channel Information is delivered to the receiver in the same order in which it is transmitted by the sender
Connectionless service
No setup or tear-down required For long continuous communication, the overhead of packet headers may be expensive
Comparison (contd)
Header Overhead
Connection-oriented service
Only the virtual circuit number
Connectionless service
The full destination address is required
Comparison (contd)
Message Sequence:
Connection-oriented service
Sequence automatically maintained
Connectionless service
Destination may have to re-sequence out-ofsequence messages
Comparison (contd)
Robustness
Connection-oriented service
Vulnerable: If IMP crashes, all virtual circuits passing through it have to be aborted and reestablished
Connectionless service
Robust: If IMP goes down, only hosts whose packets were queued at the time of the crash are lost. Other packets will be rerouted dynamically.
Comparison (contd)
Guaranteed service:
Connection-oriented service
Can provide guarantees on the delays and throughput of packets being sent
Connectionless service
It is very difficult to provide guarantees for timely packet delivery
Summary
Connection-oriented service
Is useful for applications which prefer insequence delivery of packets. It is also preferable for applications that require guaranteed service
Connectionless service
Provides flexibility in the routing and handling of individual packets and is robust in the face of IMP crashes
IP Packet Fields
Version
The IP version number (currently 4)
IHL
IP Header Length in 32-bit words
Type of Service
Contains priority information, rarely used
Total Length
The total length of the datagram in bytes Includes header
DF
Dont Fragment
MF
More Fragments When a packet is fragmented, all fragments except the last one have this bit set
Time to Live
Hop count, decremented each time the packet reaches a new router When hop count = 0, packet is discarded
Protocol
Identifies which transport layer protocol is being used for this packet
Header Checksum
Verifies the contents of the IP header Not polynomial-based
Options
Up to 40 bytes in length Used to extend functionality of IP Examples: source routing, security, record route
2.2 IP Addresses
32 bits long (4 bytes) Notation:
Each byte is written in decimal in MSB order, separated by decimals Example: 128.195.1.80 0.0.0.0 (lowest) to 255.255.255.255 (highest)
Address Classes
Class A, B, C, D, E Loopback Broadcast
IP Address Classes
Class A 0 Net 32 bits Type of Serv. Host
B C D E
Host Host
IP Address Classes
Class A:
For very large organizations 16 million hosts allowed
Class B:
For large organizations 65 thousand hosts allowed
Class C
For small organizations 255 hosts allowed
Class D
Multicast addresses No network/host hierarchy
Class E
reserved
Loopback
127.xx.yy.zz (127.anything) is reserved for loopback testing packets sent to this address are not put out onto the wire; they are processed locally and treated as incoming packets.
Broadcast
all 1s
IP Address Hierarchy
Note that Class A, Class B, and Class C addresses only support two levels of hierarchy Each address contains a network and a host portion, meaning two levels of hierarchy However, the host portion can be further split into subnets by the address class owner This allows for more than 2 levels of hierarchy
Subnetting
Example: Class B address with 8-bit subnetting 16 bits Network id Example Address:
Class B 10 Net
8 bits Host id .8
165.230
32 bits Host
Subnet Masks
Subnet masks allow hosts to determine if another IP address is on the same subnet or the same network 16 bits Network id 1111111111111111 Mask: 255.255 8 bits Subnet id 11111111 .255 8 bits Host id 00000000 .0
Note
0 AND 0 = 0 0 AND 1 = 1 AND 0 = 0 1 AND 1 = 1
Routing table
network ID this network this network this network this network subnet ID this subnet this subnet different subnet different subnet host ID A B 0 0 0
different network 0
Subnet mask helps quickly identifying which routing table entry to look up
IP Addressing
How does an ISP get block of addresses?
ICANN: Internet Corporation for Assigned
2.3 IP Routing
How do you get a packet from one network to another?
?
A B C D W X Y Z
IP Routing
(contd)
R
W X Y Z
Case 2: Multi-hop
A B C D
Network Cloud
R
W X Y Z
Example
R1
N1 N2
R2
N3
R3
N4
Routing table @ R2
N1 N2 N3 N4
Actual routing table contains IP addresses, Flags indicating type of entries, net mask etc. (see Stevens pg. 113, sect 9.2)
Default entry allows for a single entry for a list of entries that have the same next-hop value
3. IP Support Protocols
ARP RARP ICMP
3.1 ARP
Address Resolution Protocol Returns a MAC sublayer address when given an Internet (IP) address Commonly used in broadcast LANs so that two hosts can communicate using IP addresses instead of MAC sublayer addresses
Source
(6 bytes)
IP Address Classes
Class A 0 Net 32 bits Type of Serv. Host
B C D E
Host Host
ARP (contd)
ARP packet containing 128.195.1.38? ARP
ARP (contd)
ARP response packet containing 98:22:ee:f1:90:1a Repl
3.2 RARP
Reverse Address Resolution Protocol RARP performs the inverse action of ARP RARP returns an IP address for a given MAC sublayer address Operationally, RARP is the same as ARP
3.3 ICMP
Internet Control Message Protocol Handles special Internet control functions Responsibilities:
Reporting unreachable destinations Reporting IP packet header problems Reporting routing problems Reporting echoes (pings)
ICMP
Protocol for error detection and reporting
tightly coupled with IP, unreliable
ICMP MSG
IP header Source, Destination Address, TTL, ... ICMP MSG Message type, Code, Checksum, Data Message type examples (Figure 6.3 in Stevens book): 0 (8) echo request (reply) 3 destination unreachable 4 source quench 11 time exceeded
Destination unreachable
Invalid address and/or port
Source quench
choke packet
TTL expired
Routing loops, or too far away
Ping
Uses ICMP echo request/reply Source sends ICMP echo request message to the destination address
Echo request packet contains sequence number and timestamp
Destination replies with an ICMP echo reply message containing the data in the original echo request message Source can calculate round trip time (RTT) of packets If no echo reply comes back then the destination is unreachable
Ping (contd)
A
R1 R2 R3
Echo request
Time
Echo reply
Traceroute
Traceroute records the route that packets take A clever use of the TTL field When a router receives a packet, it decrements TTL If TTL=0, it sends an ICMP time exceeded message back to the sender To determine the route, progressively increase TTL
Every time an ICMP time exceeded message is received, record the senders (routers) address Repeat until the destination host is reached or an error message occurs
Traceroute (contd)
Te = Time exceeded Pu = Port unreachable
R1
TTL=1, Dest = B, port = invalid
R2
R3
Te (R1)
TTL=2, Dest = B
Time
Te (R2)
TTL=3, Dest = B
Te (R3)
TTL=4, Dest = B
Pu (B)
4. Routing Algorithms
An IMP executes a routing algorithm to decide which output line an incoming packet should be transmitted on In connection-oriented service, the routing algorithm is performed only during connection setup In connectionless service, the routing algorithm is performed as each packet arrives
Shortest Path
What is the shortest path between A and F?
3
A B
2 4
D
1 2
E
2
C
B
2 2
7 3
C
3
A
1 6
F
2 2
Distributed Databases
Simultaneous updates of multiple databases can be done with a single packet transmission
Wireless Networks
Inherently broadcasting/flooding
Scalability
The control center must handle a great deal of routing information, especially for larger networks
Backward Learning
Algorithm:
Routing is originally random A packet with a hop count of one is from a directly connected node; thus, neighboring nodes are identified with their connecting links A packet with a hop count of two is from a source two hops away, etc. As packets arrive, the IMP compares the hop count for a given source address with the minimum hop count already registered; if the new one is less, it is substituted for the previous one
3
A
2
X
Problem: Count-to-Infinity
With distance vector routing, good news travels fast, but bad news travels slowly When a router goes down, it can take a really long time before all the other routers become aware of it
Count-to-Infinity
A 1 B 1 C 1 D 1 E Infinity Infinity infinity infinity Initially (A is down) A comes up 1 1 1 1 infinity infinity infinity 2 2 2 After 1 exchange
Count-to-Infinity
A 1 B 1 1 C 2 1 D 3 1 E 4 Initially A goes down 3 3 5 5 7 2 4 4 6 6 3 3 5 5 7 4 4 4 6 6 After 1 exchange After 2 exchanges After 3 exchanges After 4 exchanges After 5 exchanges
OSPF
Open Shortest Path First Routing algorithm now used in the Internet OSPF uses the Link State Routing algorithm with modifications to support: Multiple distance metrics (geographical distance, delay, throughput) Support for real-time traffic Hierarchical routing Security
OSPF (contd)
OSPF divides the network into several hierarchies:
Autonomous Systems (ASs)
groups of subnets
Areas
Groups of routers within an AS
Backbone Areas
Groups of routers that connect other areas together
OSPF (contd)
Autonomous System
Backbone Area Area Area Backbone Area
Area
Autonomous System
Area
Area
OSPF (contd)
Routers are distinguished by the functions they perform
Internal routers
Only route packets within one area
Backbone routers
Reside only in the backbone area
AS boundary routers
Routers that connect to a router outside the AS
OSPF: Adjacency
Designated Router
To backbone area
F B D
Area
unique addresses