Professional Documents
Culture Documents
Network Layer
Network Layer
Network Layer
Mahalingam Ramkumar Mississippi State University, MS
Ramkumar
NL
Outline
Ramkumar
NL
Network Layer
Services to Transport Layer - hide topology information from the TL Addressing Routing Congestion Control
Ramkumar
NL
Connectionless Services
Ramkumar
NL
Datagram Routing
Packet Router Carrier's equipment D 1 H2 F Process P2
B H1 A
4
E
3
Process P1 C
2
LAN
C's table A B C D E F A A D E E
E's table A B C D E F C D C D F
Dest. Line
Ramkumar
NL
D 1 H2 F Process P2
4 3
2
C LAN
Process P1
A's table H1 1 H3 1
In
C's table 1 2 A A 1 2 E E 1 2 C C
E's table 1 2 F F 1 2
C C
Out
Ramkumar
NL
Datagram vs VC
Ramkumar
NL
Basic Considerations
Ramkumar
NL
A'
B'
C'
Ramkumar
NL
Optimality Principle
If router B is on the optimal path to C from A, the path B A is also optimal Goal of every routing algorithm - to determine the sink tree for every destination
B A D F G H L K M (a) O K M (b) O I C J N L F A D G H I E J N B C
Ramkumar
NL
What is the metric? Number of hops, geographic distance, delay (propagation, queue, processing), reliability? The idea is to reduce the metric (whatever is chosen) to get from one point to another Dijkstras algorithm
Ramkumar
NL
B 2 A 6 G 2 1 E
7 2 4 (a) F 2 3
C 3 D 2 H A
B (2, A) E (, )
C (, ) F (, ) H (, ) D (, )
G (6, A)
(b)
B (2, A) E (4, B)
C (9, B) F (, ) H (, ) D (,)
B (2, A) E (4, B)
C (9, B) D (,1)
F (6, E) H (, )
G (6, A)
(c)
G (5, E) (d)
B (2, A) E (4, B)
C (9, B) D (,)
B (2, A) E (4, B)
C (9, B) D (,)
F (6, E)
F (6,E)
G (5, E)
(e)
H (9, G)
G (5, E)
(f)
H (8, F)
Ramkumar
NL
Basic Approaches
Ramkumar
NL
Flooding
Every incoming packet is sent on every outgoing line (except the one it arrived on) Damping - stop ooding packets after a certain number of hops - hop counter decremented each time Sequence number for each request - if you have already sent out a packet with the same sequence number - do not send out duplicates. Selective ooding - for example using some directional information
Ramkumar
NL
Bellman-Ford / Ford-Fulkerson First routing algorithm used in the Internet (then ARPANET) - also used in RIP in Internet. Each router has an entry for every router in the subnet Each entry has two components
Preferred neighbor Number of hops (or some other metric) to destination
Ramkumar
NL
DVR in a Subnet
A
A B C D A B C D A B C A B C C 0 1 1 0 1 1 2 A B C D A B C D A B C D
B
A B A B A A B A A 1 0 1 0 2 1 0 2 3 A B C D A B C D
C
A C D A A C D 1 0 1 1 2 0 1 A B C D A B C D A B C D
Ramkumar
D
C D C C D C C C D
NL
1 0 2 1 0 2 3 1 0
A C B
DVR in a Subnet
Router A B C D To A B C D E F G H I J K L A I 24 36 18 27 7 20 31 20 0 11 22 33 JI delay is 10 H 0 12 25 40 14 23 18 17 21 9 24 29 JA delay is 8 New estimated delay from J K Line 8 20 28 20 17 30 18 12 10 0 6 15 A A I H I I H H I K K
20 21 31 28 19 36 8 24 30 22 19 40 6 31 0 19 14 22 7 10 22 0 9 9 JH JK delay delay is is 12 6
(b)
Count To Innity
B 1 3 3 5 5 7 7
C 2 2 4 4 6 6 8
D 3 3 3 5 5 7 7
E 4 4 4 4 6 6 8 Initially After 1 exchange After 2 exchanges After 3 exchanges After 4 exchanges After 5 exchanges After 6 exchanges
1 1 1 1
2 2 2
3 3
(a)
. . .
(b)
Ramkumar
NL
Every node obtains a complete view of the topology of the entire network Shortest path algorithm
Ramkumar
NL
Discover neighbors Measure delays or cost to reach each neighbor Construct a link-state packet Inform all routers (send link-state packet to all routers ooding) Compute shortest path to all routers.
Ramkumar
NL
Modeling LANs
Router
B D A C E G F I B
E G C
F N (b)
LAN (a)
Ramkumar
NL
Ramkumar
NL
B 4 A 5 E 1
C 3 6 D 7 F
A Seq. Age B 4 E 5
F Seq. Age B 6 D 7 E 8
8 (a)
Ramkumar
NL
(Source, Sequence Number) for each LS packet Sequence number keeps a check on ooding Wrapping of sequence numbers? Age solves the problem Hold for a while before transmission Each packet is acknowledged
Ramkumar
NL
Packet Buer
Ramkumar
NL
B 4 A 5 E 1
C 3 6 D 7 F
A Seq. Age B 4 E 5
F Seq. Age B 6 D 7 E 8
8 (a)
Ramkumar
NL
Computing Routes
Each link is represented twice Dijkstras algorithm for computing shortest paths Could be tricky for large networks Practical uses - OSPF, ISIS OSPF - Open Shortest Path First (used widely in the Internet) IS-IS - Intermediate System - Intermediate System (used by some Internet backbones)
Ramkumar
NL
Congestion
Perfect Maximum carrying capacity of subnet Desirable Congested
Packets delivered
Packets sent
Ramkumar NL
Congestion Control
Increasing memory (buer) may not be the answer! Congestion control vs Flow Control
Congestion control deals with trac in the subnet Flow control deals with controlling point-to-point trac
Ramkumar
NL
General Principles of CC
Three principles
Monitor to system to detect congestion Pass this information to places where corrective action could be taken Adjust system operation Closed loop control system
Ramkumar
NL
Ramkumar
NL
Ramkumar
NL
Warning Bit
Router sets a warning bit in the packet forwarded Destination sends the warning back to the source (when it sends ACK - transport layer) Source slows down Any router on the way could set the warning bit If a series of ACKs do not have warning bit set, source increases rate
Ramkumar
NL
Choke Packets
Router sends a choke packet to source (IP layer) Original packet is tagged with a special bit before forwarding (to indicate to other routers on the way that a choke has already been sent) Source reduces output to that destination by a fraction Source may receive many choke packets from the same router (too much of a task for the router to maintain a history that it has sent a choke packet to a source) Source ignores other choke packets. If for some time there are no choke packets, source increases output to the destination Several variations of the algorithm - mild warning, stern warning, ultimatum Router can also use queue length instead of u as the trigger for choke packets Ramkumar NL
Drop some packets Which packets to drop? Will be useful if the router knows the type of application For FTP trac makes sense to drop newer packets Wine policy - older is better! For multimedia trac makes better sense to drop older packet Milk policy - newer is better!
Ramkumar
NL
Main idea - react well before congestion starts Discard random packets say when 75% of the capacity is reached Transport layer should slow down when it realizes that packets are being lost
Ramkumar
NL
Fragmentation
Ramkumar
NL
Fragmentation
IP packets may need to be broken into smaller fragments Lot of overhead - both computational and bandwidth (each fragment needs a header) Who does the reassembly?
Transparent fragmentation (used within ATM gateways in the Internet) Non-transparent fragmentation (used in IP)
Ramkumar
NL
The fragments are not reassembled until the final destination (a host) is reached (b)
Ramkumar
NL
Numbering Fragments
Hierarchical numbering
Packet 0 split into 0.0, 0.1, 0.2 and 0.3 0.0 split into 0.0.0, 0.0.1 What happens if 0.1 does not reach destination? 0 is retransmitted. Say 0 was split into 0.0 and 0.1 this time Destination gets 0.1 - but how does it know it is not the old 0.1?
Ramkumar
NL
Flat numbering
Number of the first elementary fragment in this packet Packet number 27 0 End of packet bit 1 A B C D E F G 1 byte H I J
Header
(a) C D E F G H 27 8 1 I J
27
Header (b) 27 0 0 A B C D E 27 5 0 F G H
Header
27
Header
Header (c)
Header
Ramkumar
NL
The Internet
Leased lines to Asia A U.S. backbone Leased transatlantic line A European backbone
Regional network
D A 1 IP Ethernet LAN
Host 2
IP Ethernet LAN
Ramkumar
NL
IP Header
32 Bits
Version
IHL
Type of service D M F F Protocol Source address Destination address Options (0 or more words)
Ramkumar
NL
IP Header Fields
Version IHL - 4 bits - header length in 32-bit words (4 bytes) - up to 15 4 = 60 bytes Type of service - 6 bits - rarely used in practice Total length - 16 bits - maximum length of datagram in bytes (including header) - max length 65,536 bytes Identication (16 bits) - packet number, one unused bit, DF, MF, Oset (13 bits) Oset is a multiple of 8 (bytes) DF - dont fragment, MF - more fragments MF is zero for last fragment (or unfragmented IP packets)
Ramkumar NL
IP Header Fields
TTL - Time-to-live - actually number of hops - decremented by each router en-route - if zero, packet is dropped Protocol (8 bits) - Species upper layer protocol employing IP (or protocol of enclosed data) - eg TCP, UDP Check http://www.iana.org/assignments/protocol-numbers Header checksum - ones complement addition of all header elds Recomputed at each hop - (TTL is changed at every hop) Source and Destination addresses Options - up to 40 bytes - padded to be a multiple of 4 bytes
Ramkumar
NL
IP Options
Ramkumar
NL
Class A B C D E
Ramkumar
NL
Special IP Addresses
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
This host A host on this network Broadcast on the local network Broadcast on a distant network Loopback
...
0 0
Host
...
1111
Ramkumar
NL
Subnets
Router Art
To ISP
PC CS
English
EE
French
Main router
Math
Music Ethernet
Physics
Ramkumar
NL
Subnet vs Subnets
Subnet: Set of all routers and communication lines in a network Subnets: part of a network - like a campus network IP addresses - two parts
Network address Host number
Ramkumar
NL
Subnet Masks
32 Bits
Subnet mask
10
Network
Subnet
Host
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
Class B network (16 bit network address) Network + subnet + Host (16 + 6 + 10) Subnet mask - 22 ones - 255.255.252.0 or just /22
Ramkumar
NL
Starting addresses of dierent subnets S1 : 10000010 00110010 000001 00 00000001 - IP 130.50.4.1 S2 : 10000010 00110010 000010 00 00000001 - IP 130.50.8.1 S3 : 10000010 00110010 000011 00 00000001 - IP 130.50.12.1 Subnet mask - 22 ones - 255.255.252.0 or just /22 Mask provide an easy way to check if the address is inside the subnet or outside Forward or Ignore
Ramkumar
NL
Extending the concept of subnets and masks to the WAN Example address allocation Basic idea - allocate in 2b chunks - indicated eciently using masks
Ramkumar
NL
CIDR - Example
Millions of addresses available for Universities in England Starting with 194.24.0.0
For MSU router - initially has 4 entries for dierent routers For all routers the next hop is some router in New York Aggregation 194.24.0.0 /19 - three entries replaced by one Aggregation keeps the sizes of routing tables from growing without bound
Ramkumar NL
NAT
An organization has thousands of employees and thousands of computers which need Internet connectivity They have just two public IP addresses 198.60.42.12 and 198.60.42.13 Each machine inside the company is assigned a unique IP address in the private IP range All outbound packets are sent thorough a NAT box NAT box modies the IP header - changes the IP to its own public IP All responses from the outside world are received by the NAT box - which forwards the response back to the private IP addresses
Ramkumar NL
NAT
Company LAN 1 2 3 4 Company router 5 6 7 Server PC NAT box/firewall Leased line ISP's router
10.0.0.1
Ramkumar
NL
NAT Tables
How does the NAT know to which machine to forward the response to? Remember, with packet based routing each packet is independent. Change port number ! Each packet coming into the NAT (from inside) has three unique identiers - IP, port number, protocol The IP is xed, each process is assigned a port number (or picks one) NAT replaces the port number Makes an entry in NAT Table
Ramkumar NL
NAT Table
Ramkumar
NL
NAT
Solves the IP explosion problem Your service provider can give you a private IP Service provider has a NAT box Still usually service providers generally do not do that Every home connection is still provided a public IP NAT used for sharing Internet connection with multiple computers at home But NAT is widely used within organizations
Ramkumar
NL
NAT Problems
1 2
Violates architectural model of IP Changes a connectionless network to connection oriented network - NAT has to keep track of connections Violates protocol layering rules - port number is a transport layer address - NAT changes that! NAT needs to know the protocol - what if some one decides to use a new protocol over IP? Breaks some applications - like FTP and H.263 Limited port numbers - only 65536 - with 4096 reserved for special uses
5 6
Ramkumar
NL
NAT - A Firewall
How do you access a private IP address from outside? Can you run a server with a private IP address? Port forwarding. Impractical with ISPs
Ramkumar
NL
Ramkumar
NL
How is an IP packet sent from one machine to another? Using lower layers For Ethernet, each interface has a MAC address If 10.2.3.1 needs to send a packet to 10.2.3.4 (same LAN) it needs to know the MAC address of the destination What if it needs to send the packet to 194.2.3.67? It needs the MAC address of the router / NAT How do machine determine each others MAC addresses?
Ramkumar
NL
ARP
Use broadcast address in MAC layer. Send a query - who owns IP 10.2.3.4? The owner responds with its MAC address Make a not of it in the cache - next time do not broadcast Listen to all requests made by other machines and the responses Add them in the cache too - eliminates duplicate broadcasts The protocol used for the query and response is ARP Each machine can also broadcast its MAC / IP address when it boots What happens if an Ethernet card in a machine is changed?
Ramkumar NL
Used during booting up My MAC address is 14.04.06.15.02.24 - what is my IP? A server is expected to respond. Uses broadcast IP addresses and MAC addresses for the query Useful for storage-less work stations Some machines may even boot up over the Ethernet card! RARP - Reverse Address Resolution Protocol
Ramkumar
NL
BOOTP
RARP requests are not forwarded by servers Each LAN needs a RARP server BOOTP is a higher level protocol - runs over UDP! Can be forwarded over the network BOOTP needs manual conguration of MAC / IP mappings in the BOOTP server.
Ramkumar
NL
DHCP
Dynamic Host Conguration Protocol Allows both manual and automatic address allocation DHCP servers, DHCP relay agents Relay agents just need to know the IP address of the DHCP server DHCP DISCOVER packet broadcast by hosts when they boot up How long are the assigned IP addresses valid? IP addresses-es are leased. Have to be renewed periodically.
Ramkumar
NL
Internet Multicasting
Class D addresses Supports over 250 million groups 224.x.x.x to 239.x.x.x Permanent and temporary multicast groups Temporary groups created before they can be used Hosts subscribe to groups Usually special multicast routers are used Have to inform all upstream routers on the way (to the source of multicast) about existence of subscribers for the group downstream. IGMP - Internet Group Management Protocol Spanning tree, tunneling
Ramkumar NL
IPv6
Driving forces
Practically unrestricted number of hosts Yet reduce size of routing tables Simplify protocol - faster processing by routers Security! Redene type of service Make multicasting simpler Allow for modication of protocols Coexist with IPv4
Ramkumar
NL
IPv6 Header
32 Bits
Version
Ramkumar
NL