Presentation on theme: "Addressing and Routing Topics discussed in this section:"— Presentation transcript:
1Addressing and Routing Topics discussed in this section: ChapterAddressing and RoutingAn IPv4 address is a 32-bit address that uniquely and universally defines the connection of a device (for example, a computer or a router) to the Internet.Topics discussed in this section:Address SpaceNotationsClassful AddressingClassless AddressingNetwork Address Translation (NAT)
2The IPv4 addresses are unique and universal Two devices in the Internet can never have the same address at the same time.An address may be assigned to a device for a time period and then taken away and assigned to another device.If a device operating at the network layer (e.g. router) has m connections to the Internet, it needs to have m IP address.The IPv4 addresses are unique and universal
3IPv4 IPV4 has an address space: is the total number of addresses used by the protocol.If a protocol uses N bits to define an address, the address space is 2N .IPv4 uses 32-bit addresses:The address space=232 =4,294,967,296 ( more than 4 billion)This means, if there were no restrictions, more than 4 billion devices could be connected to the Internet.IPv6 uses 128 bit-addresses
4IPv4 Addresses: Notations There are two prevalent notations to show an IPv4 addressBinary notationAddress is displayed as 32 bits.Each octet is often referred to as byte.IPv4 address referred to as 32-bit address or 4- byte addressDotted-decimal notation:More compact and easier to readWritten in decimal form with a decimal point( dot) separating the bytesExample:Each decimal value range from 0 to 255
5Address Allocation How are the block allocated? The address allocation is given to global authority calledInternet Assigned Number Authority (IANA)IANA does not allocate addresses to individual organizationsIt assigns a large block of addresses to an ISP
6ExampleChange the following IPv4 addresses from binary notation to dotted-decimal notation.SolutionWe replace each group of 8 bits with its equivalent decimal number (see Appendix B) and add dots for separation.
7ExampleChange the following IPv4 addresses from dotted-decimal notation to binary notation.SolutionWe replace each decimal number with its binary equivalent (see Appendix B).
8Example Find the error, if any, in the following IPv4 addresses. Solutiona. There must be no leading zero (045).b. There can be no more than four numbers.c. Each number needs to be less than or equal to 255.d. A mixture of binary notation and dotted-decimal notation is not allowed.
9We can find the class of an address in Classfull addressingIn classfull addressing, the address space is divided into five classes: A, B, C, D, and EWe can find the class of an address inBinary notation: the first few bits define the classDecimal-dotted notation: the first byte define the class
10Classfull addressingIn classfull addressing, the address space is divided into 5 classes: A, B, C, D, and E.Addresses in Classes A, B and C are uniast ddressesA host needs to have at least one unicast address to be able to send packet (Source).Addresses in Class D are for multicast addressUsed only for destinationAddresses in class E are reserved
11Example 19.4 Find the class of each address. bcdSolutiona. The first bit is 0. This is a class A address.b. The first 2 bits are 1; the third bit is 0. This is a class C address.c. The first byte is 14; the class is A.d. The first byte is 252; the class is E.
12Classfull Addressing Classes and Blocks Net Id and Host IdThe address is divided into Netid and Hostid.These part are of varying lengths, depending on the class.Dose not apply to classes D and E
14number of blocks with each block having a fixed size Classes and BlocksClass A addressdesigned for large organizations with a large number of attached hosts or routers. (most of the addresses were wasted and not used)Class B addressdesigned for midsize organizations with ten of thousands of attached hosts or routers( too large for many organizations)Class C addressdesigned for small organizations with a small number of attached hosts or routers (too small for many organizations)Class D addressdesigned for multicasting. (waste of addresses)Class E addressreserved for future use (waste of addresses)One problem is that each class is divided into fixednumber of blocks with each block having a fixed size
15Mask (default mask)Help us to find the NetId and HostIdMask: 32-bit made of 1s followed by 0s.Dose not apply to classes D and E.CIDR(Classless Interdomain Routing): used to show the mask in the form /n (n=8,16,24)Classfull addressing, which is almost obsolete, is replaced with classless addressing.
16Classfull Addressing Network address The network address is an address that define the network itself to the reset of the internetThe network address has the following properties:All hostid bytes are 0’sIt is the first address in the blockIt cannot be assigned to a hostGiven the network address, we can find the class of the address
17Find the network address for the following ExampleFind the network address for the followingThe class is BThe first 2 bytes defines the Netid. We can find the network address by replacing the hostid bytes (17.85) with 0sTherefore, the network address isThe class is A. Only the first byte defines the Netid. We can find the network address by replacing the hostid bytes ( ) with 0s.Therefore, the network address is
18Figure 19.3 A block of 16 addresses granted to a small organization
19In IPv4 addressing, a block of addresses can be defined as x.y.z.t /n x.y.z.t defines one of the addresses and the /n defines the maskThe first address in the block can be found by setting the rightmost 32 − n bits to 0sThe last address in the block can be found by setting the rightmost 32 − n bits to 1s.
20ExampleA block of addresses is granted to a small organization. We know that one of the addresses is /28.What is the first and the last address in the blockFind the number of addresses?SolutionThe binary representation of the given address isIf we set 32−28 = 4 rightmost bits to 0, we getIf we set 32−28 = 4 rightmost bits to 1, we getThe number of addresses is −28 = 16
21ExampleAnother way to find the first address, the last address, and the number of addresses is to represent the mask as a 32-bit binary number. In the previous Example the /28 can be represented asFinda. The first addressb. The last addressc. The number of addresses.
22SolutionThe first address can be found by ANDing the given addresses with the maskThe last address can be found by ORing the given addresses with the complement of the maskThe number of addresses can be found by complementing the mask, interpreting it as a decimal number, and adding 1 to it
23A network configuration for the block 126.96.36.199/28 The first address in a block is normally not assigned to any device; it is used as the network address that represents the organization to the rest of the worldThe Last address in a block is normally not assigned to any device; it is used as the Broadcast address
24Configuration and addresses in a subnetted network Each address in the block can be considered as a two-level hierarchical structurethe leftmost n bits define the networkthe rightmost 32 − n bits define the host.
26ExampleAn ISP is granted a block of addresses starting with /16 (65,536 addresses). The ISP needs to distribute these addresses to three groups of customers as followsa. The first group has 64 customers; each needs 256 addresses.b. The 2nd group has 128 customers; each needs 128 addresses.c. The 3rd group has 128 customers; each needs 64 addresses.Design the subblocks and find out how many addresses are still available after these allocations.
27SolutionGroup 1For this group, each customer needs 256 addresses. This means that 8 bits are needed to define each host. The prefix length is 32 − 8 = 24Group 2For this group, each customer needs 128 addresses. This means that 7 bits are needed to define each host. The prefix length is 32 − 7 = 25
28Group 3For this group, each customer needs 64 addresses. This means that 6 bits are needed to each host. The prefix length is 32 − 6 = 26Number of granted addresses to the ISP: 65,536Number of allocated addresses by the ISP: 40,960Number of available addresses: 24,576
29Classfull Addressing Subnetting If an organization was granted a large block in classes A or BIt could divide the addresses into several contiguous groups and assign each group to smaller networks ( subnets)It increases the number of 1s in the maskTo make a subnet mask , we change some of the leftmost 0s in mask to 1sThe number of subnets is determine by the number of extra1s.If the number of extra 1 is n, the number of subnets is 2n
30Example Class B address For 4 subnets : (need 2-extra bits ) mask : or /16For 4 subnets : (need 2-extra bits )Subnet mask: or /18For 8 subnets: (need 3-extra bits )subnet mask : or /19
31ExampleA router receives a packet with destination addressShow how it finds the network and the sub_network address to route the packet.Assume the subnet mask is /19The router follows steps:The router looks at the first byte of the address to find the class. It is class BThe mask for class B is (/16)The router ANDs this mask with the address to get the network address :The router applies the subnet mask (/19) to the address, : ıThe subnet address isThe router looks in its routing table to find how to route the packet to this destination
32Supernetting Huge demand for midsize blocks. Although class A and B addresses are almost depleted, class C addresses are still available( size of block= 256 address did not satisfy the needs).In super netting, an organization can combine several class C blocks to create a larger range of addresses.Several networks are combined to create a super network ( super net).e.g. Organization needs 1000 address can be granted 4 contiguous class C blocks to create one super network.
33Subnetting Collision domain Broadcast domain Are the connected physical network segments where collisions can occurBroadcast domainA group of collision domains that are connected by layer 2 devices
34Collision domains = # of hosts connected to a switch or bridge + # of router links Broadcast domains = # of router links, since only routers will create broadcast domains
35A BRIDGE will create a collision domain while the HUB will not
36Network Address Translation NAT The Internet Authorities have reserved 3 sets of addresses as a private addressesNetwork Address TranslationNAT enables a user to have a large set of addresses internally and one address or small set of address externally.A NAT box located where the LAN meets the Internet makes all necessary IP address translationsAny organization can use an addresses out of this set without permission from internet authorities.Provides a type of firewall by hiding internal IP addresses
37Network Address Translation Private addresses are unique inside the organization , but they are not unique globallyNo router will forward a packet that has one of these addresses as the destination addressesThe site must have one connection to the global internet through the router that runs NAT softwareThe router has uses one private address and one global addressThe internet sees only NAT router with global address
38NAtingNAT router replaces the source address in the outgoing packets with the global NAT address ( )Router replaces the destination address (the NAT router global address) in the incoming packets with appropriate private address
39private network must start (initiate ) the communication NAT address translationNoteprivate network must start (initiate ) the communication
40NAT address translation Using pool of IP addresses RestrictionSince the NAT router has only one global address, only one private network host canTo remove the previous restriction, the NAT router uses a pool of global addresses access the same external hostFor exampleinstead of using one global address , the NAT router can uses 4 addresses ( , , , ).In this case 4 private network hosts can communicate the same external host at the same time because each pair of addresses defines a connection
42Pool of IP addresses There are still some drawbacks: No than four private network hosts can communicate the same destinationNo private network host can access two external server programs (e.g. HTTP (port 80 )and FTP) at the same timeTo allow many to many relationship use 5- coloum translation table
43NAT address translation Using both IP addresses and Port numberFive-column translation table
46IPv6 ADDRESSES IPv6 address in binary and hexadecimal colon notation Despite all short-term solutions, address depletion is still a long-term problem for the Internet. This and other problems in the IP protocol itself have been the motivation for IPv6.An IPv6 address is 128 bits longIPv6 address in binary and hexadecimal colon notation
48Example Expand the address 0:15::1:12:1213 to its original. Solution We first need to align the left side of the double colon to the left of the original pattern and the right side of the double colon to the right of the original pattern to find how many 0s we need to replace the double colon.This means that the original address is.
50Forwarding means to place the packet in its route to its destination. Forwarding requires a host or a router to have a routing table.When host has a packet to send or when a router has received a packet to be forwarded, it looks at this table to find the route to the final desTopics discussed in this sectionForwarding TechniquesForwarding ProcessRouting Table
55Simplified forwarding module in classless address In classless addressing, we need at least 4 columns in a routing table
56Example Make a routing table for router R1, using the following configuration
57Example Show the forwarding process if a packet arrives at R1 with the destination addressRouting table for R1
58Solution The router performs the following steps The first mask (/26) is applied to the destination addressThe result is , which does not match the corresponding network addressThe second mask (/25) is applied to the destination address.The result is ,which matches the corresponding network address. The next-hop address and the interface number m0 are passed to ARP for further processing
59The router performs the following steps Example Show the forwarding process if a packet arrives at R1 in with the destination addressThe router performs the following stepsThe first mask (/26) is applied to the destination addressThe result is , which does not match the corresponding network addressThe second mask (/25) is applied to the destination addressThe result is , which does not match the corresponding network address (row 2)The third mask (/24) is applied to the destination addressThe result is , which matches the corresponding network address. The destination address of the packet and the interface number m3
60CLASSFUL ADDRESSING ROUTING TABLE Example, the router receives a packet for destinationFor each row, the mask is applied to the destination address until a match with the destination address is found. In this example, the router sends the packet through interface m0 (host specific).Example, the router receives a packet for destination For each row, the mask is applied to the destination address until a match with the next-hop address is found. In this example, the router sends the packet through interface m2 (network specific).Example, the router receives a packet for destination For each row, the mask is applied to the destination address, but no match is found. In this example, the router sends the packet through the default interface m0.
61Autonomous systems Autonomous System (AS) Group of networks and routers under the authority of a single administration.Routers inside an autonomous system is referred to as interior routing (Intradomain).Routing between autonomous systems is referred to as exterior routing (Interdomain)Solid lines show the communication between routers that use interior routing protocols.Broken lines show the communication between routers that use an exterior routing protocols.
62Example Show the forwarding process if a packet arrives at R1 with the destination addressThis time all masks are applied, one by one, to the destination address, but no matching network address is found. When it reaches the end of the table, the module gives the next-hop address and interface number m2 to ARP. This is probably an out going package that needs to be sent, via the default router, to some place else in the Internet.
63Packet go from source to destination via routers. RoutingPacket go from source to destination via routers.Router consults the routing table.Routing table can beStatic: does not change automatically (manual entries)Dynamic: updated automatically when there is change in the InternetRouting protocols are needed to create the routing tables dynamically.A routing protocol is a combination of rules and procedures thatLets routers in the internet inform one another of changes.Allows routers to share whatever they know about the internet or their neighborhood.
64Interior and Exterior routing protocols Each AS can choose one or more intradomain (interior) routing protocol to handle routing inside the AS such as RIP and OSPFOne interdomain (exterior) routing protocol is usually chosen to handle routing between ASs ; BGP
65Metric of different protocols Metric is the cost assigned for passing through a network.The total metric of a particular router is equal to the sum of the metrics of networks that comprise the route.A router chooses the route with smallest metric.The metric assigned to each network depends on the type of protocolRIP (Routing Information Protocol) “Shortest distance”Cost of passing each network is same; it is one hop count.If a packet passes through 10 networks to reach the destination, the total cost is 10 hop counts.OSPF(Open Shortest Path First)Administrator can assign cost for passing a network based on type of service required such as :throughput, delay,..etc.OSPF allows each router to have more than one routing table based on required type of serviceBGP(Border Gateway Protocol)Criterion is the policy, which is set by the administrator
66Routing Algorithm classification Routing algorithms can bedistance vector algorithmsrouter knows physically-connected neighbors, link costs to neighbors, iterative process of computation, exchange of partial information with neighbors.The least cost between any two nodes is the route with minimum distanceRIP is an implementation of this approachlink state algorithmsall routers have complete topology, link cost informationOSPF is an implementation of this approach
67Distance Vector Routing Each node( router) maintains a set of triples (table): Destination, Cost, Next Hop)Node knows the cost to each neighbor (the distance between itself and its immediate neighbors)Directly connected neighbors exchange updatesperiodically (on the order of several seconds -30s)whenever table changes (called triggered update)Each update is a list of pairs: Destination, CostUpdate local table if receive a “better” rout (smaller cost)
68Distance vector routing infinite ∞ ( unreachable).Think the node as the cities and the lines as the roads connecting them
69Distance vector routing Sharing: Updating in distance vector routing
70Distance vector routing The least cost route between any two nodes is the route with min distance.Each node maintains a table which containsDestination, Cost, Next hop
71Distance vector routing Each router shares its entire routing table with its neighborsSharingPeriodically update :on the order of several seconds -30s-Triggered update: The change can result from the followingA node receives a table from a neighbor, resulting in changes in its own table after updating.A node detects some failure in the neighboring links which results in a distance change to infinity ∞Each update is a list of pairsDestination, Cost(two column routing table)
72Routing Information Protocol RIP implement Distance vector routing with some considerationsDestination in the routing table is a network (first column defines network address)Metric(distance) is Hop count : is the number of networks that a packet encounters to reach its final destinationInfinity is defined as value of 16Therefore, the Max limited of hops is 15suitable for small networks (local area environments)Router sends update message to neighbors every 30 sec.If router does not receive update message from neighbor X within this limit, it assumes the link to X has failed and sets the corresponding minimum cost to 16 (infinity)In distance vector routing, each node shares its routing table with its immediate neighbors periodically and when there is a change
73RIPRouting tableHas one entry for each destination network of which the router is awareEach entry has destination network address, the shortest distance to reach the destination in hop count, and next router to which the packet should be delivered to reach its final destination
76Initial routing tables in a small AS When a router is added to a network, it initializes a routing table for itself, using its configuration fileThe table consists only the directly attached networks and the hop counts, which are initialized to 1The next-hop field, which identifies the next router, is empty
77Final routing tablesEach routing table is updated upon receipt of RIP messages using the RIP updating algorithm
78RIP Updating Algorithm Receive: a response RIP message(significant portion of its routing table)Add one hop to the hop count for each advertised destinationRepeat the following steps for each advertised destinationIf (destination not in the routing table)Add the advertised information to the tableElseIf (next-hop field is the same)Replace entry in the table with the advertised one.If (advertised hop count smaller than one in the table)Replace entry in the routing table
81Link State Routing Analogous to a city map Each node in the domain has the entire topology of the domainAnalogous to a city map
82Link State RoutingLink-state routing works by having the routers tell every router on the network about state of its neighbors.Sharing knowledge about the neighborhoodEach router sends the state of its neighborhood to every other router in the area.Sharing with every other routerBy flooding, a process whereby a router sends its information to all its neighbors (through all its output ports).Each neighbor sends the packet to all its neighbors, and so on.Every router that receives the packet sends copies to each of its neighbors. Eventually, every router (without exception) has received a copy of the same informationSharing when there is a change; Only to its neighborsThe node can use Dijkstra Algorithm to build a routing tableMetricAdministrator can assign the cost to each route.Based on type of service (minimum delay, maximum throughput, ..)
84OSPF OSPF Based on Link state Routing OSPF divides an AS into areas. Special routers called autonomous system boundary routers are responsible for dissipating information about other ASs into the current system
86Areas in an Autonomous System Area is a collection of networks, hosts, and routers all contained within an autonomous system.Routers inside an area flood the area with routing information.Area border routersSummarize the information about the area and send it to other routersBackbone area [Primary area]All the areas inside an autonomous system must be connected to the backboneRouters in this area are called as backbone routers. This area identification number is 0.If, due to some problem, the connectivity between a backbone and an area is broken, a virtual link between routers must be created by the administration to allow continuity of the functions of the backbone as the primary area
87OSPFEach router should have the exact topology of the internet at every moment (LSP).From this topology, a router can calculate the shortest path between itself and each network using Dijkstra algorithm
88Point-to-point LinkConnects 2 routers without any other router or host in betweenDirectly connected routers using serial line.Only one neighbor.No need to assign a network address to this type of linkThe metrics are the same at the two ends
89Transient link A network with several routers attached to it. Each router has many neighbors.Lot of advertisements about their neighbors.One of the routers in the network has two dutiestrue router and designated router (network)Each router has only one neighbor, the designated router (network). On the other hand, the designated router (network) has five neighbors.Designated router represents a network. There exists a metric between each node to the designated router but there is no metric from the designated router to any other node.
90Stub Link A network that is connected to only one router The data packets enter the network through this single router and leave the network through this sameVirtual LinkWhen the link between two routers is broken, the administration may create a virtual link between them, using a longer path that probably goes through several routers.
91Example of an internet & Graphical representation
92Dijkstra AlgorithmCalculates the shortest path between two points on a network, using a graph made up of nodes and edges.Algorithm divides the nodes into two setstentative and permanentIt chooses nodes, makes them tentative, examines them, and if they pass the criteria, makes them permanent
93Dijkstra AlgorithmStart with the local node (router): the root of the tree.Examine each neighbor node of the node that was the last permanent nodeAssign a cost of 0 to this node and make it the first permanent nodeAssign a cumulative cost to each node and make it tentativeAmong the list of tentative nodesFind the node with the smallest cumulative cost and make it permanentIf a node can be reached from more than one direction. Select the direction with the shortest cumulativeRepeat steps 3 to 5 until every node becomes permanent
94Example 1 Shortest-path calculation using Dijkstra
95Example 1 Shortest-path calculation using Dijkstra
96Example 1 Shortest-path calculation using Dijkstra
97Example 1 Shortest-path calculation using Dijkstra Routing Table for Router A
98Example 2 Shortest-path calculation using Dijkstra
99Example 2 Shortest-path calculation using Dijkstra
100Example 2 Shortest-path calculation using Dijkstra
101OSPF Reaction to Failure If a link fails,Router sets link distance to infinity & floods the network with an update packetAll routers immediately update their link database &recalculate their shortest pathsRecovery very quickNOTEOSPF differs from RIP in that each router knows the exact topology of the networkOSPF reduces routing bandwidth usageOSPF is faster than RIP
102DHCP Dynamic Host Configuration Protocol Designed to provide information dynamicallyIt is a client-server programUsed to assign addresses to hosts dynamically
103Data are transmitted in discrete units (packets) A physical link is dedicated between sourceand destinationData is sent out as stream of bitsNo packetizationData are transmitted in discrete units (packets)
104Each packet is treated independently of all others Datagram approachEach packet is treated independently of all othersPacket here is called datagramDatagrams might arrive at destination out of order
105Virtual CircuitRelationship between all packets belonging to a message is preservedA single route is chosen between sender and receiver at the beginning of the sessionData are sent one after anotherWAN uses this approach which needsCall setup to establish VC between sender and receiverCall teardown to delete the VC