1 internet protocol: forwarding ip datagrams chapter 7
TRANSCRIPT
11
Internet Protocol:Internet Protocol:Forwarding IP DatagramsForwarding IP Datagrams
Chapter 7Chapter 7
22
Basic unit of transfer in TCP/IP internet is Basic unit of transfer in TCP/IP internet is the datagramthe datagram Datagram format characterizes the Datagram format characterizes the staticstatic
aspects of IPaspects of IP Forwarding characterizes the Forwarding characterizes the operationaloperational
aspectsaspects
33
Forwarding In An InternetForwarding In An InternetForwarding refers to choosing a path for Forwarding refers to choosing a path for packetspackets Term Term routingrouting was previously used was previously used Popular term now is Popular term now is forwardingforwarding
Router is the computer making the choiceRouter is the computer making the choiceWANWAN Has multiple physical connections between Has multiple physical connections between
packet switchespacket switches Network itself routes packets while in netNetwork itself routes packets while in net Internal routing; self-contained in the WANInternal routing; self-contained in the WAN
44
Goal of IP: Virtual networkGoal of IP: Virtual network
Focus on IP forwardingFocus on IP forwarding Also called Also called internet routinginternet routing or or IP routingIP routing Information used to make decisions called IP Information used to make decisions called IP
forwarding informationforwarding information
Similar to forwarding in single physical Similar to forwarding in single physical network:network: IP forwarding chooses path for datagramIP forwarding chooses path for datagram
DifferenceDifference Chooses routes across multiple physical Chooses routes across multiple physical
networksnetworks
55
Forwarding can be difficultForwarding can be difficult Ideally, should be based on:Ideally, should be based on:
Network loadNetwork loadDatagram lengthDatagram lengthType of service specifiedType of service specified
Most software is less sophisticatedMost software is less sophisticatedSelects on fixed assumptions about shortest pathsSelects on fixed assumptions about shortest paths
Both hosts and routers participateBoth hosts and routers participate Host may make initial forwarding decision if Host may make initial forwarding decision if
has access to multiple routers (even if singly-has access to multiple routers (even if singly-homed)homed)
Also, multi-homed hosts & general machinesAlso, multi-homed hosts & general machines For now, treat hosts and routers separateFor now, treat hosts and routers separate
66
Direct and Indirect DeliveryDirect and Indirect Delivery
Can divide forwarding into two forms:Can divide forwarding into two forms: Direct DeliveryDirect Delivery
Datagram from one machine to anotherDatagram from one machine to another
Across single physical networkAcross single physical network
Both must be attached to same physical Both must be attached to same physical networknetwork
Indirect DeliveryIndirect DeliveryDestination not on a directly attached networkDestination not on a directly attached network
Router must become involvedRouter must become involved
77
Delivery over a single networkDelivery over a single network IP datagram encapsulated into frameIP datagram encapsulated into frame IP address mapped to physical addressIP address mapped to physical address Network hardware delivers the datagramNetwork hardware delivers the datagram To tell if destination directly connected:To tell if destination directly connected:
Easy based on prefix and suffix of IP addressEasy based on prefix and suffix of IP address
Sender extracts network prefix of destinationSender extracts network prefix of destination
If same as its network portion: directly connectedIf same as its network portion: directly connected Special case of general purpose forwardingSpecial case of general purpose forwarding
Final router always directly connected to Final router always directly connected to destinationdestination
88
Indirect deliveryIndirect delivery Sender must specify a routerSender must specify a router Router must then forward toward destinationRouter must then forward toward destination Datagram passes from router to router until it Datagram passes from router to router until it
reaches a router directly connected to reaches a router directly connected to destinationdestination
Questions:Questions:How does a router know where to send a How does a router know where to send a datagram?datagram?
How can a host know which router to use?How can a host know which router to use? Consider basic table-driven forwarding nowConsider basic table-driven forwarding now
Later talk about routers learning new routesLater talk about routers learning new routes
99
Table-Driven IP RoutingTable-Driven IP RoutingUses IP routing tableUses IP routing table Info about destinations & how to reach themInfo about destinations & how to reach them Both hosts and routers haveBoth hosts and routers have
What info to keep?What info to keep? Can’t do all possible destinationsCan’t do all possible destinations
Couldn’t keep current; too much storage spaceCouldn’t keep current; too much storage space IP address scheme helpsIP address scheme helps
Direct delivery test is efficientDirect delivery test is efficient
Routing tables only need network prefixesRouting tables only need network prefixes
1010
Next-Hop ForwardingNext-Hop Forwarding
Routing table has pairs (Routing table has pairs (NN,,RR)) NN is the IP address of a destination is the IP address of a destination networknetwork RR is the IP address of the is the IP address of the “next” router“next” router along along
the path to the path to NNR R is the next hopis the next hop
Using this table is next-hop forwardingUsing this table is next-hop forwarding
Don’t know whole path, only one stepDon’t know whole path, only one step All routers in machine All routers in machine MM’s table must be ’s table must be
directly connected to directly connected to MM
1111
S10.0.0.010.0.0.0
20.0.0.0
20.0.0.0
30.0.0.0
30.0.0.0
40.0.0.0
40.0.0.0R
Q
20.0.0.5
10.0.0.5
20.0.0.6
30.0.0.6
30.0.0.7
40.0.0.7
To reach hosts on network Route to this address
20.0.0.0 Deliver Directly
30.0.0.0 Deliver Directly
10.0.0.0 20.0.0.5
40.0.0.0 30.0.0.7
1212
Routing table size depends on number of Routing table size depends on number of networksnetworks Size & contents independent of number of hostsSize & contents independent of number of hosts
Consequences of choosing routes based on Consequences of choosing routes based on destination network ID alone:destination network ID alone: Traffic for same network usually take same pathTraffic for same network usually take same path
Multiple paths may not be used concurrentlyMultiple paths may not be used concurrently
All traffic types follow same path regardless of delay or All traffic types follow same path regardless of delay or throughputthroughput
Only final router knows if hosts exists or is operationalOnly final router knows if hosts exists or is operationalMust report delivery problemsMust report delivery problems
Traffic from A-B may have different path than B-ATraffic from A-B may have different path than B-A
1313
Default RoutesDefault Routes
If no route in table, use default routeIf no route in table, use default route Keeps tables smallKeeps tables small Consolidates multiple entries into default Consolidates multiple entries into default
casecase Useful when only one connection to internetUseful when only one connection to internet
Test if local net destinationTest if local net destination
If not, only can go through one router anywayIf not, only can go through one router anyway
1414
Host-Specific RoutesHost-Specific Routes
Forwarding based on networks, not individual Forwarding based on networks, not individual hostshosts
IP forwarding software allows per-host routesIP forwarding software allows per-host routes Gives local network admin more control over Gives local network admin more control over
network usenetwork use Permits testingPermits testing Controls access for security purposesControls access for security purposes
1515
IP Forwarding AlgorithmIP Forwarding AlgorithmForwardDatagram(Datagram,RoutingTable)ForwardDatagram(Datagram,RoutingTable)
Extract destination IP addressExtract destination IP address, D from datagram;, D from datagram;If the table contains a host-specific routeIf the table contains a host-specific route for Dfor D send datagram to next-hop specified in the table and send datagram to next-hop specified in the table and quitquit;;Compute NCompute N, the network prefix of address D;, the network prefix of address D;If N matches any directly connected networkIf N matches any directly connected network address address deliver datagram to destination D over that network;deliver datagram to destination D over that network;
(Involves resolving D to a physical address, encapsulating the (Involves resolving D to a physical address, encapsulating the datagram, and sending the frame.)datagram, and sending the frame.)
Else if the table contains a route for network NElse if the table contains a route for network N send datagram to next-hop specified in table;send datagram to next-hop specified in table;Else if the table contains a default routeElse if the table contains a default route send datagram to the default router specified in table;send datagram to the default router specified in table;Else declare a forwarding errorElse declare a forwarding error
1616
Forwarding With IP AddressesForwarding With IP Addresses
IP forwarding does not alter original datagramIP forwarding does not alter original datagram Except for decrementing TTL and recomputing Except for decrementing TTL and recomputing
the checksumthe checksum Source and destination addresses unchangedSource and destination addresses unchanged Router must pick next-hop IP addressRouter must pick next-hop IP address
Where does this address get stored?Where does this address get stored?
There is no place in the datagram for itThere is no place in the datagram for it
1717
Does not store the next-hop address at allDoes not store the next-hop address at all IP passes datagram & next-hop address to the IP passes datagram & next-hop address to the
network interfacenetwork interface Network interface software:Network interface software:
Binds next-hop address to physical addressBinds next-hop address to physical address
Forms a frame using the physical addressForms a frame using the physical address
Places datagram in data portion of framePlaces datagram in data portion of frame
Sends the resultSends the result
Discards next-hop addressDiscards next-hop address
1818
Why not use physical addresses when Why not use physical addresses when storing and computing routes?storing and computing routes? Routing table provides clean interface Routing table provides clean interface
between IP forwarding SW and high-level SWbetween IP forwarding SW and high-level SWLook at routing table to debug forwarding Look at routing table to debug forwarding problems problems
IP addresses makes it easy to doIP addresses makes it easy to do Point of IP is to build abstractionPoint of IP is to build abstraction
Communication software can be written to use Communication software can be written to use internet addressesinternet addresses
Only a few low-level routines need to know and Only a few low-level routines need to know and interface with the physical addressesinterface with the physical addresses
1919
Handling Incoming DatagramsHandling Incoming Datagrams
When datagram arrives at a When datagram arrives at a hosthost:: Network interface SW delivers incoming Network interface SW delivers incoming
datagrams to IP moduledatagrams to IP moduleIf destination address matches host’s:If destination address matches host’s:
IP software accepts the datagramIP software accepts the datagram Passes it on to higher-level protocol softwarePasses it on to higher-level protocol software
If destination address does not match host’s:If destination address does not match host’s: Datagram must be discardedDatagram must be discarded Hosts forbidden from trying to fix routing problemHosts forbidden from trying to fix routing problem
2020
When datagram arrives at a When datagram arrives at a routerrouter:: Delivered to IP moduleDelivered to IP module
If destination IP address matches the routers:If destination IP address matches the routers: Datagram passed to higher-level protocol softwareDatagram passed to higher-level protocol software Usually destined for router if testing or sending Usually destined for router if testing or sending
commandscommands
If datagram is not at final destination:If datagram is not at final destination: TTL field is decrementedTTL field is decremented
If TTL = 0, datagram is discardedIf TTL = 0, datagram is discarded
If TTL > 0, computes new checksumIf TTL > 0, computes new checksum IP forwards the datagram using the forwarding algorithmIP forwards the datagram using the forwarding algorithm
2121
Determining if at final destination is not trivialDetermining if at final destination is not trivial Host may have multiple physical connectionsHost may have multiple physical connections
Destination IP address must be compared with that Destination IP address must be compared with that of each connectionof each connection
Also, may be a broadcast datagramAlso, may be a broadcast datagramHave to see if IP address matches the limited or Have to see if IP address matches the limited or directed broadcast IP addressdirected broadcast IP address
Classless, subnet, and multicast addresses Classless, subnet, and multicast addresses make it even more complexmake it even more complex
Will see in later chapters….Will see in later chapters….
2222
Why forbid hosts from forwarding functions?Why forbid hosts from forwarding functions? Host receiving datagram not for it indicates a Host receiving datagram not for it indicates a
problemproblemWon’t be revealed if host takes corrective actionWon’t be revealed if host takes corrective action
Forwarding steals time from legitimate uses of Forwarding steals time from legitimate uses of the hostthe host
Simple errors can cause chaosSimple errors can cause chaosSome host accidentally broadcasts datagram for a hostSome host accidentally broadcasts datagram for a host
Every local host receive a copy; all send to recipientEvery local host receive a copy; all send to recipient Routers do more than merely route trafficRouters do more than merely route traffic
Report errorsReport errors
Propagate forwarding informationPropagate forwarding information
2323
Establishing Routing TablesEstablishing Routing Tables
How do systems initialize routing tables?How do systems initialize routing tables?
How are routing tables updated?How are routing tables updated? Later chapters discuss the protocols that Later chapters discuss the protocols that
do thisdo this For now:For now:
Understand IP software uses routing tables to Understand IP software uses routing tables to decide how to forward a datagramdecide how to forward a datagram
Changing routing tables will change the pathsChanging routing tables will change the paths
2424
SummarySummary
IP software forwards datagramsIP software forwards datagrams Decides where to send based on destination IP addressDecides where to send based on destination IP address
Direct delivery used if the destination machine is Direct delivery used if the destination machine is on the same network as the senderon the same network as the sender Otherwise, sender must go through a routerOtherwise, sender must go through a router Datagrams travel from router to router until they can Datagrams travel from router to router until they can
be delivered directlybe delivered directly
IP software produces IP address of the next hopIP software produces IP address of the next hop Network interface SW encapsulates datagram, maps Network interface SW encapsulates datagram, maps
next-hop address to physical address, and sendsnext-hop address to physical address, and sends
2525
Internet forwarding algorithm:Internet forwarding algorithm: Is table-drivenIs table-driven Uses only IP addressesUses only IP addresses
Possible to have host-specific destination Possible to have host-specific destination addressesaddresses Most routing tables only have network addressesMost routing tables only have network addresses
Using default routes helps keep tables smallUsing default routes helps keep tables small Especially for hosts that can access only one routerEspecially for hosts that can access only one router