04 - ip addressing and routing
TRANSCRIPT
-
7/29/2019 04 - IP Addressing and Routing
1/37
04 IP Addressing & Routing
By Muhammad Asghar Khan
Reference: CCENT/CCNA ICND1 Official Exam Certification Guide By Wendell Odom
-
7/29/2019 04 - IP Addressing and Routing
2/37
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, Ping2 www.asghars.blogspot.com
1/1
-
7/29/2019 04 - IP Addressing and Routing
3/37
Introduction
www.asghars.blogspot.com3
The OSI physical layer (L1) defines how to transmit bits overa particular type of physical network
The OSI data link layer (L2) defines the framing, addressing,error detection, and rules for when to use the physicalmedium
The OSI network layer (L3) defines how to forward, or route,data between the two computers i.e end-to-end delivery ofdata between two computers
OSI network layer protocol defines the following features:
Logical Addressing (IP Addressing)
Routing (IP Routing)
Routing Protocols
Network Layer Utilities (DNS, ARP, DHCP and Ping)
1/1
-
7/29/2019 04 - IP Addressing and Routing
4/37
Logical Addressing
www.asghars.blogspot.com4
Network layer protocols define the format andmeaning 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
1/1
-
7/29/2019 04 - IP Addressing and Routing
5/37
IP Addressing
www.asghars.blogspot.com5
If a device wants to communicate using TCP/IP, itneeds a unique IP address
Any device that can send and receive IP packets iscalled an IP Host
IP address consists of a 32-bit number written indotted-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
1/17
-
7/29/2019 04 - IP Addressing and Routing
6/37
IP Addressing
www.asghars.blogspot.com6
The set of consecutive addresses grouped togetheris called IP Networks
Grouping make routing easy
Figure shows the concept of IP address grouping
2/17
-
7/29/2019 04 - IP Addressing and Routing
7/37
IP Addressing
www.asghars.blogspot.com7
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 indifferent groups
IP defines five different network classes
Unicast Addresses: Class A, Class B, Class C Multicast Addresses: Class D
Experimental Addresses: Class E
3/17
-
7/29/2019 04 - IP Addressing and Routing
8/37
IP Addressing
www.asghars.blogspot.com8
In class A, B and C the IP address can be divided intwo 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)
Host Portion(0.1)
e.g. Zip code
of address
e.g. Street address
with in zip code
4/17
-
7/29/2019 04 - IP Addressing and Routing
9/37
IP Addressing
www.asghars.blogspot.com9
Class A, B and C networks each have differentlength 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
5/15
0 XXXXXXX . XXXXXXXX . XXXXXXXX .
XXXXXXXX
0 identifies Class A
7-Bits represent network part 24-Bits reserved for host part
-
7/29/2019 04 - IP Addressing and Routing
10/37
IP Addressing
www.asghars.blogspot.com10
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
6/17
-
7/29/2019 04 - IP Addressing and Routing
11/37
IP Addressing
www.asghars.blogspot.com11
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
7/17
-
7/29/2019 04 - IP Addressing and Routing
12/37
IP Addressing
www.asghars.blogspot.com12
Class A is for large networks, Class B is for mediumnetworks 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
8/17
-
7/29/2019 04 - IP Addressing and Routing
13/37
IP Addressing
www.asghars.blogspot.com13
For example; Class B network 130.4 will consistsof 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 numbeNetwork/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.
9/17
-
7/29/2019 04 - IP Addressing and Routing
14/37
IP Addressing
www.asghars.blogspot.com14
Internet Corporation for Assigned NetworkNumbers (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)
and 127.0.0.0 (still available for use as the loopback address) are reserved.
10/17
-
7/29/2019 04 - IP Addressing and Routing
15/37
IP Addressing
www.asghars.blogspot.com15
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, Bor C network as if it were a network itself
Subnet is shorthand for subdivided network
Figure on next slide shows the network withoutsubnetting
11/17
-
7/29/2019 04 - IP Addressing and Routing
16/37
IP Addressing
www.asghars.blogspot.com16
1
2
34
5
6
12/17
-
7/29/2019 04 - IP Addressing and Routing
17/37
IP Addressing
www.asghars.blogspot.com17
The design on previous slide requires six groups of IPaddresses, each of which is a Class B network
Each Class B network has 216-2 host addresses-far morethan 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, addressesthat begin with 150.1 cannot be assigned anywhere elsein 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 thatbegin with 150.1. As a result, the addressing designshown in previous slide wastes a lot of addresses
This design would not be allowed if it were connected tothe Internet, ICANN would not assign six Class B network
numbers
13/17
-
7/29/2019 04 - IP Addressing and Routing
18/37
IP Addressing
18
subnet1 subnet2
subnet3
subnet4
subnet5
subnet
6
14/17
-
7/29/2019 04 - IP Addressing and Routing
19/37
IP Addressing
www.asghars.blogspot.com19
This design subdivides the Class B network150.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 byborrowing 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
15/17
-
7/29/2019 04 - IP Addressing and Routing
20/37
IP Addressing
www.asghars.blogspot.com20
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
16/17
-
7/29/2019 04 - IP Addressing and Routing
21/37
IP Addressing
www.asghars.blogspot.com21
Classfull Addressing: Net Part+Subnet+Host Part Classless Addressing: Routing Part
(Network+Subnet)+Host Part
17/17
-
7/29/2019 04 - IP Addressing and Routing
22/37
Routing / Forwarding
www.asghars.blogspot.com22
Routing focuses on the end-to-end logic offorwarding data
The routing process forwards only the packetdiscarding 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 Iam, send the packet to my default gateway (routersEthernet interface on the subnet)
1/5
-
7/29/2019 04 - IP Addressing and Routing
23/37
Routing / Forwarding
www.asghars.blogspot.com23
Router Routing/Router Forwarding A router uses the following logic when receiving data
link frame (frame with IP packet encapsulated)
1) Uses the data link FCS field to ensure that frame had
no errors; if errors occurred discard the frame2) If no errors occurred, discard the data link header and
trailer, leaving the IP packet
3) Compare the IP packets destination IP address to the
routing table, and find the route that matches thedestination address. This route can be outgoing
interface of the router and possibly the next-hop
router
2/5
-
7/29/2019 04 - IP Addressing and Routing
24/37
Routing / Forwarding
www.asghars.blogspot.com24
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 addressof 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
3/5
-
7/29/2019 04 - IP Addressing and Routing
25/37
Routing / Forwarding
www.asghars.blogspot.com25
4/5
-
7/29/2019 04 - IP Addressing and Routing
26/37
Routing / Forwarding
www.asghars.blogspot.com26
Step B: R1 copies the frame off the Ethernet , checksframes FCS, discards the Ethernet header & trailer. R1compares the packets destination address to the routingtable 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 forsubnet 150.154.4.0 and sends the packet out interfaceserial1 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 R3is directly connected to subnet 150.150.4.0, so it has toencapsulate the packet inside Ethernet header & trailerwith destination Ethernet address of PC2s MAC addressand forward the frame
5/5
-
7/29/2019 04 - IP Addressing and Routing
27/37
Routing Protocols
www.asghars.blogspot.com27
IP routing protocols fill the routers routing table withloop-free routes
Routing / Forwarding process depends on accurate andup-to-date IP routing table on each router
Each route includes a subnet number, interface out toforward packets and IP address of the next router ifneeded
Goals of IP routing protocol:
To dynamically learn and fill routing table with a route toall subnets
If more than one route to a subnet is available, place thebest route in the routing table
1/4
-
7/29/2019 04 - IP Addressing and Routing
28/37
Routing Protocols
www.asghars.blogspot.com28
To remove the non valid route from routing table
To add new routes or to replace lost routes, as quickly aspossible. The time b/w losing the route and finding aworking replacement route is called convergence time
To prevent routing loops
Routing protocols use the following logic:
Step 1: Each router adds a route to its routing table foreach 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 istypically the next-hop router
2/4
-
7/29/2019 04 - IP Addressing and Routing
29/37
Routing Protocols
www.asghars.blogspot.com29
Figure showshow the router R1
learns about
subnet150.150.4.0
3/4
-
7/29/2019 04 - IP Addressing and Routing
30/37
Routing Protocols
www.asghars.blogspot.com30
Step A: R3 learns a route that refers to its own E0interface
Step B: R3 sends a routing protocol message calledrouting 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 becauseR1 learned about the route from R2. The route alsolists R1s outgoing interface as Serial0
4/4
-
7/29/2019 04 - IP Addressing and Routing
31/37
Network Layer Utilities
www.asghars.blogspot.com31
The four network layer utilities i.e DNS, ARP, DHCPand Ping are used to help the network layer inrouting packets from end-to-end through aninternetwork
Domain Name System (DNS) 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 adomain name
Figure on next slide shows the DNS request and reply
1/7
-
7/29/2019 04 - IP Addressing and Routing
32/37
Network Layer Utilities
www.asghars.blogspot.com32
Hannah knows the IP address of a DNS server, bcz the
address was either preconfigured or was learned
from DHCP
2/7
-
7/29/2019 04 - IP Addressing and Routing
33/37
Network Layer Utilities
www.asghars.blogspot.com33
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 ARPbroadcast is looking for the MAC address associated with10.1.1.2, Jessie replies with her own MAC address
3/7
-
7/29/2019 04 - IP Addressing and Routing
34/37
Network Layer Utilities
www.asghars.blogspot.com34
Now Hannah knows the destination IP and Ethernet
addresses that she should use when sending frames toJessie, and the packet shown in Figure can be sentsuccessfully
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 tofind the routers MAC address instead of Jessies MACaddress
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 informationin its ARP cache
You can see the contents of the ARP cache by using arp -a
4/7
-
7/29/2019 04 - IP Addressing and Routing
35/37
Network Layer Utilities
www.asghars.blogspot.com35
Dynamic Host Configuration Protocol (DHCP)
DHCP allow computers to request a lease of an IPaddress
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 IPaddress(es)
5/7
-
7/29/2019 04 - IP Addressing and Routing
36/37
Network Layer Utilities
www.asghars.blogspot.com36
Ping Command
After a network is implemented, ping (Packet InternetGroper) is the primary tool for testing basic network
connectivity
6/7
-
7/29/2019 04 - IP Addressing and Routing
37/37
Network Layer Utilities
www asghars blogspot com37
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
7/7