You are on page 1of 37

04 IP Addressing & Routing

By Muhammad Asghar Khan


Reference: CCENT/CCNA ICND1 Official Exam Certification Guide By Wendell Odom

1/1

Agenda

Introduction Network Layer (L3)

Logical Addressing

IP Addressing
Network Classes IP Subnetting

Routing / Forwarding

Host Routing Router Routing

Routing Protocols Network Layer Utilities

DNS, ARP, DHCP, Ping


www.asghars.blogspot.com

1/1

Introduction

The OSI physical layer (L1) defines how to transmit bits over a particular type of physical network The OSI data link layer (L2) defines the framing, addressing, error detection, and rules for when to use the physical medium The OSI network layer (L3) defines how to forward, or route, data between the two computers i.e end-to-end delivery of data between two computers OSI network layer protocol defines the following features:

3

Logical Addressing (IP Addressing) Routing (IP Routing) Routing Protocols Network Layer Utilities (DNS, ARP, DHCP and Ping)
www.asghars.blogspot.com

Logical Addressing

1/1

Network layer protocols define the format and meaning of logical addresses/network layer addresses Each computer (NIC) that needs to communicate will have at least one logical address IP is an example of network layer address Logical address allows for the logical grouping of addresses, with IP this is called subnet or network

www.asghars.blogspot.com

IP Addressing

1/17

If a device wants to communicate using TCP/IP, it needs a unique IP address Any device that can send and receive IP packets is called an IP Host IP address consists of a 32-bit number written in dotted-decimal notation e.g. 172.16.254.1 Each decimal number in IP address is called an octet The range in each decimal number is b/w 0 and 255
5 www.asghars.blogspot.com

IP Addressing

2/17

The set of consecutive addresses grouped together is called IP Networks Grouping make routing easy Figure shows the concept of IP address grouping

www.asghars.blogspot.com

IP Addressing

3/17

The figure on last slide summarize the two main facts about same grouping:
All IP addresses in the same group must not be separated by a router IP addresses separated by a router must be in different groups
Unicast Addresses: Class A, Class B, Class C Multicast Addresses: Class D Experimental Addresses: Class E
www.asghars.blogspot.com

IP defines five different network classes

IP Addressing

4/17

In class A, B and C the IP address can be divided in two parts


Network Portion; identifies the number of networks Host Portion; identifies the number of hosts on the LAN
IP Address (130.4.0.1) Network Portion (130.4) e.g. Zip code of address Host Portion (0.1) e.g. Street address with in zip code

www.asghars.blogspot.com

IP Addressing

5/15

Class A, B and C networks each have different length for the part that identifies the network

Class A Networks

First octet range is from 1 to 126 1 byte long network part while remaining 3 bytes of address is called host part, e.g N.H.H.H
0 XXXXXXX . XXXXXXXX . XXXXXXXX . XXXXXXXX 24-Bits reserved for host part

0 identifies Class A

7-Bits represent network part

www.asghars.blogspot.com

IP Addressing

6/17

Class B Networks

First octet range is from 128 to 191 2 bytes long network part while remaining 2 bytes of address is called host part, e.g N.N.H.H
10 XXXXXX . XXXXXXXX . XXXXXXXX . XXXXXXXX

10 identifies Class B

14-Bits represent network part

16-Bits reserved for host part

10

www.asghars.blogspot.com

IP Addressing

7/17

Class C Networks

First octet range is from 192 to 223 3 bytes long network part while remaining 1 byte of address is called host part, e.g N.N.N.H
110 XXXXX . XXXXXXXX . XXXXXXXX . XXXXXXXX

110 identifies Class C

21-Bits represent network part

8-Bits reserved for host part

11

www.asghars.blogspot.com

IP Addressing

8/17

Class A is for large networks, Class B is for medium networks and Class C for small networks We must distinguish b/w network number and IP address Network numbers are not actually IP addresses because they cannot be assigned to an interface as an IP address For network numbers the convention is to write down the network part of the number, while all decimal 0s in the host part of the number
12 www.asghars.blogspot.com

IP Addressing

9/17

For example; Class B network 130.4 will consists of all IP addresses that begin with 130.4, written as 130.4.0.0 and so on

*There are two reserved host addresses per network. These are network numbe Network/directed broadcast address (one with all binary 1s in the host part). Network number is the lowest numerical value inside that network and the broad address is the largest.

13

www.asghars.blogspot.com

IP Addressing

10/17

Internet Corporation for Assigned Network Numbers (ICANN) is in charge of assigning the IP addresses Table below summarizes the possible network numbers that ICANN have assigned over a time

*The Valid Network Numbers column shows actual network numbers. Networks 0.0.0.0 (originally defined for use as a broadcast address not now) 14 www.asghars.blogspot.com and 127.0.0.0 (still available for use as the loopback address) are reserved.

IP Addressing

11/17

IP Subnetting

IP Subnetting takes a single Class A, B or C network and subdivides it into a number of smaller groups of IP addresses Subnetting treats a subdivision of a single Class A, B or C network as if it were a network itself Subnet is shorthand for subdivided network Figure on next slide shows the network without subnetting

15

www.asghars.blogspot.com

IP Addressing
1 2

12/17

6 4 3

16

www.asghars.blogspot.com

IP Addressing

13/17

17

The design on previous slide requires six groups of IP addresses, each of which is a Class B network Each Class B network has 216-2 host addresses-far more than you will ever need for each LAN and WAN link For example; the upper-left Ethernet should contain all addresses that begin with 150.1. Therefore, addresses that begin with 150.1 cannot be assigned anywhere else in the network, except on the upper-left Ethernet So, if you ran out of IP addresses somewhere else, you could not use the large number of unused addresses that begin with 150.1. As a result, the addressing design shown in previous slide wastes a lot of addresses This design would not be allowed if it were connected to the Internet, ICANN would not assign six Class B network www.asghars.blogspot.com numbers

IP Addressing

14/17

subnet1

subnet5

subnet2

subnet 6

subnet3 subnet4
18

IP Addressing

15/17

This design subdivides the Class B network 150.150.0.0 into six subnets The third octet is used to identify unique subnets of network 150.150.0.0 The subnet part of the address is created by borrowing bits from the host part of the address The host part of the address shrinks to make room for the subnet part of the address

19

www.asghars.blogspot.com

IP Addressing

16/17

Figure on previous slide shows the format of addresses when subnetting, representing the number of bits in each of the three parts of an IP address Now, instead of routing based on the network part of an address, routers can route based on the combined network and subnet parts Note that the information in the routing table includes both the network and subnet part of the address, because both parts together identify the group In figure on previous slide, there are three parts of an IP address (network, subnet, and host), are called classful addressing
www.asghars.blogspot.com

20

IP Addressing

17/17

Classfull Addressing: Net Part+Subnet+Host Part Classless Addressing: Routing Part (Network+Subnet)+Host Part

21

www.asghars.blogspot.com

Routing / Forwarding

1/5

Routing focuses on the end-to-end logic of forwarding data The routing process forwards only the packet discarding data link headers and trailers along the way Host Routing/Host Forwarding

The host routing logic is a two-step process:


If destination IP address is in the same subnet as I am, send packet directly If destination IP address is not in the same subnet as I am, send the packet to my default gateway (routers Ethernet interface on the subnet)
www.asghars.blogspot.com

22

Routing / Forwarding

2/5

Router Routing/Router Forwarding

A router uses the following logic when receiving data link frame (frame with IP packet encapsulated)
1)

2)
3)

Uses the data link FCS field to ensure that frame had no errors; if errors occurred discard the frame If no errors occurred, discard the data link header and trailer, leaving the IP packet Compare the IP packets destination IP address to the routing table, and find the route that matches the destination address. This route can be outgoing interface of the router and possibly the next-hop router
www.asghars.blogspot.com

23

Routing / Forwarding

3/5

4) Encapsulate IP packet inside a new data link header and trailer, and forward the frame

Figure on next slide shows simple routing example with IP subnets

Step A: PC1 builds IP packet, with destination address of PC2s. PC1 sends the packet to R1 (default gateway) bcz destination address is on a different subnet . PC1 places IP packet into Ethernet frame, with a destination Ethernet address of R1s Ethernet address

24

www.asghars.blogspot.com

Routing / Forwarding

4/5

25

www.asghars.blogspot.com

Routing / Forwarding

5/5

Step B: R1 copies the frame off the Ethernet , checks frames FCS, discards the Ethernet header & trailer. R1 compares the packets destination address to the routing table and forward the packet to next-hop router R2 Step C: R2 receives the HDLC frame, check frames FCS field, discard HDLC header & trailer. R2 finds route for subnet 150.154.4.0 and sends the packet out interface serial1 to next-hop router R3 Step D: R3 also check FCS field, discard data link header & trailer. Checks its own route for subnet 150.150.4.0, as R3 is directly connected to subnet 150.150.4.0, so it has to encapsulate the packet inside Ethernet header & trailer with destination Ethernet address of PC2s MAC address and forward the frame
www.asghars.blogspot.com

26

Routing Protocols

1/4

IP routing protocols fill the routers routing table with loop-free routes Routing / Forwarding process depends on accurate and up-to-date IP routing table on each router Each route includes a subnet number, interface out to forward packets and IP address of the next router if needed Goals of IP routing protocol:

To dynamically learn and fill routing table with a route to all subnets If more than one route to a subnet is available, place the best route in the routing table
www.asghars.blogspot.com

27

Routing Protocols

2/4

To remove the non valid route from routing table To add new routes or to replace lost routes, as quickly as possible. The time b/w losing the route and finding a working replacement route is called convergence time To prevent routing loops Step 1: Each router adds a route to its routing table for each subnet directly connected to the router Step 2: Each router tells its neighbors about all the routes in its routing table Step 3: After learning a new route from a neighbor, the router adds a route to its routing table. Neighbor is typically the next-hop router
www.asghars.blogspot.com

Routing protocols use the following logic:


28

Routing Protocols

3/4

Figure shows how the router R1 learns about subnet

150.150.4.0

29

www.asghars.blogspot.com

Routing Protocols

4/4

Step A: R3 learns a route that refers to its own E0 interface Step B: R3 sends a routing protocol message called routing update to R2, causing R2 to learn about subnet 150.150.4.0 Step C: R2 sends a similar routing update to R1, causing R1 to learn about subnet 150.150.4.0 Step D: R1s route to 150.150.4.0 lists 150.150.2.7 (R2s IP address) as the next-hop address because R1 learned about the route from R2. The route also lists R1s outgoing interface as Serial0
30 www.asghars.blogspot.com

Network Layer Utilities

1/7

The four network layer utilities i.e DNS, ARP, DHCP and Ping are used to help the network layer in routing packets from end-to-end through an internetwork Domain Name System (DNS)

31

DNS translate the friendly "www.google.com" to the not-so-friendly 64.17.143.84 It handles this translation for web sites, email, FTP servers, database servers, or any machine within a domain name Figure on next slide shows the DNS request and reply
www.asghars.blogspot.com

Network Layer Utilities

2/7

Hannah knows the IP address of a DNS server, bcz the address was either preconfigured or was learned from DHCP

32

www.asghars.blogspot.com

Network Layer Utilities

3/7

Address Resolution Protocol (ARP)

ARP resolve an IP address to the MAC address Figure below shows simple ARP process

An ARP broadcast is sent to a broadcast Ethernet address, so everyone on the LAN receives it Because Jessies IP address is 10.1.1.2 and the ARP broadcast is looking for the MAC address associated with 10.1.1.2, Jessie replies with her own MAC address
www.asghars.blogspot.com

33

Network Layer Utilities

4/7

34

Now Hannah knows the destination IP and Ethernet addresses that she should use when sending frames to Jessie, and the packet shown in Figure can be sent successfully If Hannah and Jessie had been in different subnets, Hannahs routing logic would have caused Hannah to want to send the packet to Hannahs default gateway (router). In that case, Hannah would have used ARP to find the routers MAC address instead of Jessies MAC address Hosts need to use ARP to find MAC addresses only once in a while. Any device that uses IP should retain, or cache, the information learned with ARP, placing the information in its ARP cache You can see the contents of the ARP cache by using arp -a
www.asghars.blogspot.com

Network Layer Utilities

5/7

Dynamic Host Configuration Protocol (DHCP)


DHCP allow computers to request a lease of an IP address DHCP uses a server, that keeps a list of pools of IP addresses available in each subnet DHCP client send the DHCP server a message, asking to borrow or lease an IP address DHCP also supplies subnet mask , default gateway as well as IP address of any DNS servers Figure on next slide shows typical set of messages used b/w a DHCP server to assign IP, as well as the IP address(es)
www.asghars.blogspot.com

35

Network Layer Utilities

6/7

Ping Command

After a network is implemented, ping (Packet Internet Groper) is the primary tool for testing basic network connectivity
www.asghars.blogspot.com

36

Network Layer Utilities

7/7

Ping uses the Internet Control Message Protocol (ICMP), sending message called an ICMP echo reply ICMP does not rely on any application, so just tests basic IP connectivity Layers 1, 2 and 3 Figure below outlines the basic process

37

www.asghars.blogspot.com

You might also like