Document Details

PromptIntegral3045

Uploaded by PromptIntegral3045

Imam Abdulrahman Bin Faisal University

Tags

computer networks networking ip addressing internet protocols

Summary

This document contains lecture notes on computer networks, specifically focusing on the network layer. It details various concepts like addressing, subnetting, and routing, using examples to illustrate the topics.

Full Transcript

Computer Networks LEC #7 Computer Networks LEC #2 Network Layer Communicating Over the (CONT.) Network Lecture Outlines  Network Layer. Addressing Subnetting Next Lecture Mask (default and subnet) Routing...

Computer Networks LEC #7 Computer Networks LEC #2 Network Layer Communicating Over the (CONT.) Network Lecture Outlines  Network Layer. Addressing Subnetting Next Lecture Mask (default and subnet) Routing 2 Remember 32 bit Binary Divided into OCTETS Expressed in DOTTED DECIMAL NOTATION Subnet Mask First Byte Second Byte Third Byte Fourth Byte Class A Netid Hostid Hostid Hostid Class B Netid Netid Hostid Hostid Class C Netid Netid Netid Hostid  Each class has a default or "natural" subnet mask based on the default number of bits used for the network and host portion. First Number Number Default Number Number Class Octet of Network of Host Subnet of of Hosts Range Bits Bits Mask Networks per Network A 0-127 8 24 255.0.0.0 128 16,777,216 B 128-191 16 16 255.255.0.0 16,384 65,536 C 192-223 24 8 255.255.255.0 2,097,152 256 Network Prefixes How do you know the number of bits assigned to the network and the number of bits assigned to the host?  Prefix Mask:  The address is followed by a number that represents the number of bits (prefix length), beginning from the left, that apply to the network.  A slash (/) is used to separate the address and the prefix length. 192.168.10.2/24 Means that the first 24 bits are the network portion. The last 8 bits are the host portion. Number of Number of Default Default Class Network Bits Host Bits Prefix Subnet Mask A 8 24 /8 255.0.0.0 B 16 16 /16 255.255.0.0 C 24 8 /24 255.255.255.0 Classful IP Addressing – Class C We know from the Class C default subnet mask (255.255.255.0):  The first 24 bits are the network number and the last 8 bits are the host numbers. The first host address (all 0's) is reserved for the network address. 11010010 00010100 01001101 00000000 210. 20. 77. 0 The last host address (all 1's) is reserved for the broadcast address. 11010010 00010100 01001101 11111111 210. 20. 77. 255  The number of usable host addresses for the entire network is 28 – 2 = 254 11010010 00010100 01001101 00000001 The range of available 210. 20. 77. 1 addresses is: 11010010 00010100 01001101 11111110 210. 20. 77. 254 Example For example: In Class C :  Address range: 192 - 223  Number of network bits: 24  Number of networks: 2^24 = 2,097,152  Number of host bits: 8  Number of hosts per network: 28 = 256  Number of Useable Hosts per network: 28 - 2 = 254  Default Subnet Mask: 255.255.255.0 or /24 Subnetting  It divides the main network into several subnets Each one with its own subnet address.  Let a class C network with 256 host addresses. One of these addresses is used to identify the network address and another one is used to identify the broadcast address on the network. Therefore, we are left with 254 addresses available for addressing hosts.  For example, if you want to take 5 bits from the Host field for subnetting and leaves 3 bits for defining hosts as shown in figure below. Having 5 bits available for defining subnets means that we can have up to 32 (2^5) different subnets. 8 Subnetting Suppose the IP address = 192.168.10.44 Default Mask = 255.255.255.0 How to calculate subnet using binary method? 1. Convert to binary 2. Calculate the Subnet Address  To calculate the IP Address Subnet you need to perform a bit-wise AND operation (1 and 1 = 1, 1 and 0 or 0 and 1 = 0, 0 and 0 = 0) on the host IP address and subnet mask. The result is the subnet address. 9 Subnetting 3. Find Host Range Subnetting 3. Find Host Range Subnetting 4. Calculate the Total Number of Subnets and Hosts Per Subnet So number of subnets is = 2 ^# subnet bits Number of hosts in each subnet is = 2^ # host bits Example  Suppose the following IP 211.215.9.115/29 find first subnet address, first host in the subnet, Last host in the first subnet, broadcast address of the first subnet and the address of the second subnet. Answer 211.215.9.115/29 : 29 (24+5) means we will take 5 bits from the host part for the subnetting and leave 3 bits for the hosts in the subnet. So to find the first subnet 211.215.9. 115 = 01110011 subnetMask for the 5 bits is 11111000 Bit wise And operation 01110000 = 112 So, the first subnet is 211.215.9.112 First host in the subnet is 211.215.9.113 last host in the subnet is 211.215.9.118 Broadcast address is 211.215.9.119 Second subnet will start 211.215.9.120 Example  Note that if you need for example 3 subnets only from your network, How to compute the number of bits that you need? 11000110 10101000 11010100 00000000 Netid (For network) Hostid  So, convert number 3 to binary? 2 3 1  So, we need Two bits 1 1 11000110 10101000 11010100 00 000000 Netid (For network) Subnet Hostid Routing  To route the router, need to know: 1) Destination address 2) Different routes 3) Best route 4) Maintain and verify routing information Routing  Each router has a routing table to specify the different networks and best route to this networks  To know the best route, router should perform routing process because it only know the direct connected devices.  there are two different types of routing : Static and Dynamic  Static uses the route that is entered manually by the admin  Dynamic uses a network routing protocol adjusts automatically for topology or traffic changes Static Route  Configure unidirectional static routes to and from a sub network to allow communications to occur.  For example, if we have packets on router A and need to travel to network 172.16.1.0 we should configure router A to decide the path to the destination address How? Destination address Subnet Mask Next Hop which means next router Static Route  How to decide more than route in the static way?  The same command is used but with adding distance for each command to specify the priority of each route.  The distance value ranged from 0 to 255 and default value is 1.  The low value is the best route Distance value Dynamic Routing  Routing protocols are used to determine paths and maintain routing table such as RIP (Routing Information Protocol).  Once the path is determined a router can route a routed protocol. Routing Protocols Interior Exterior Protocols Protocols Hybrid Distance Link State BGP (Border Routing Vector Gateway Protocol) EIGRP (Enhanced RIP (Routing OSPF (Open Interior Gateway Information Shortest Path Routing Protocol) Protocol) First) Dynamic Routing – Distance Vector - RIP  It uses hop count as a routing metric to find the best path between the source and the destination network.  RIP uses port number 520.  Hop count is the number of routers occurring in between the source and destination network. The path with the lowest hop count is considered as the best route to reach a network and therefore placed in the routing table.  Routers periodically exchange the router information (default exchange time 30 second).  if no update comes until 180 seconds, then the destination router considers the other router is out of service.  Default distance is 120 (priority of the route).  In case there are more than one route between two networks the RIP will prefers the route that has least hop. Dynamic Routing – RIP Example  Each Router will send its Routing table to the routers in its neighbors.  For example, Router C will send its table to Router B  The 0 value in last column means number of hops to reach to the network because its direct connection so it’s equal 0.  So, what is the content of the table at the end of round? 21 Dynamic Routing – RIP Example  So Router B will investigate the incoming table to register the missing information in its table for example routing table of router C have two networks 10.3.0.0 and 10.4.0.0 and in the table of router B there are two networks 10.2.0.0 and 10.3.0.0, So Router B will add network 10.4.0.1 in its table with port S1. 22 23

Use Quizgecko on...
Browser
Browser