Sie sind auf Seite 1von 66

REDES DE COMPUTADORES

Tema 6.
Direccionamiento IPv4
Alberto Arellano A. Ing. Msc.
aarellano@espoch.edu.ec
CCNA – CCNP - CCSP
1
IPv4 Address
“The identifier used in the IP layer of the TCP/IP protocol
suite to identify each device connected to the Internet is
called the Internet address or IP address. An IPv4 address
is a 32-bit address that uniquely and universally defines the
connection of a host or a router to the Internet; an IP
address is the address of the interface”.(Berhouz Forouzan)
HOST
TCP/IP uses the term host to refer to an end system that
attaches to the Internet.
HOST
IPv4 Address

The IPv4 addresses are unique and


universal.
An IPv4 address is 32 bits long.
The address space of IPv4 is 232
(4,294,967,296)
Notation.
Binary notation
Dotted-decimal notation
Beginning with IPv4

• IPv4 (Internet Protocol


version 4)
• Developed in the early
1980s
• RFC 760 Jan 1980
obsoleted by RFC 791
Sep 1981
Subnet Masks

11111111111111110000000000000000
An IP address is a hierarchical address that is made up of two parts:
A network portion
A host portion.
Subnet Mask
Used to define the:
Network portion
Host portion
32 bits
Contiguous set of 1’s followed by a contiguous set of 0’s
1’s: Network portion
0’s: Host portion
7
Dividing the Network and Host
Portions

11111111.11111111.00000000.00000000

Dotted decimal: 255 . 255 . 0 . 0


Slash notation: /16

Expressed as:
Dotted decimal
Ex: 255.255.0.0
Slash notation or prefix length
/16 (the number of one bits)
Example

192 168 11 10

255 255 255 0


11111111 11111111 11111111 00000000

The subnet mask identifies which part of the IP address


refers to the network.
Network Portion Host Portion

192 168 11 0

The prefix length is the number of bits set to 1 in the subnet mask.
It is written in “slash notation”, a “/” followed by the number of
bits set to 1.
For example:
IP address: 192.168.11.10 255.255.255.0
Is the same as: 192.168.11.10 /24
Valid Subnet Mask Values

128 64 32 16 8 4 2 1 Decimal Value

1 0 0 0 0 0 0 0 128

1 1 0 0 0 0 0 0 192

1 1 1 0 0 0 0 0 224

1 1 1 1 0 0 0 0 240

1 1 1 1 1 0 0 0 248

1 1 1 1 1 1 0 0 252

1 1 1 1 1 1 1 0 254

1 1 1 1 1 1 1 1 255
Subnet Masks

So how do hosts figure out which part of the address is the network portion?
Hosts AND the IPv4 address and the subnet mask.
“1” bits refer to the network portion.
“0” bits refer to the host portion.
Hosts actually use a the Boolean “AND” operation to accomplish this task.
This tells them what network they belong to.
Destination IP Address

A B

192.168.1.100 192.168.2.101
255.255.255.0 255.255.255.0

Source IPv4 Destination IPv4


192.168.1.100 192.168.2.101

How does the host know if the destination


IPv4 address is on it’s network or another
network?
Destination IP Address

192.168.1.10 192.168.1.11

Same network?

AND AND

My Network = 192.168.1.0 Destination Network = 192.168.1.0


Same network? YES!
Destination IP Address

192.168.1.100 192.168.2.101

Same network?

AND AND

My Network = 192.168.1.0 Destination Network = 192.168.2.0


Same network? NO!
Network Address
Network Address, is particularly important because it is
used in routing a packet to its destination network.
The network address has all 0 bits in the host portion.
Broadcast Address
A broadcast address is used to send data to all hosts in the
network.
The broadcast address has all 1 bits in the host
portion.
Host Range
Host Addresses in binary

192.168.1.0 (net) 11000000.10101000.00000001.00000000


255.255.255.0(SM) 11111111.11111111.11111111.00000000
192.168.1.1 11000000.10101000.00000001.00000001
192.168.1.254 11000000.10101000.00000001.11111110
192.168.1.255 11000000.10101000.00000001.11111111
(broadcast)

192.168.0.0 (net) 11000000.10101000.00000000.00000000


255.255.0.0 (SM) 11111111.11111111.00000000.00000000
192.168.0.1 11000000.10101000.00000000.00000001
192.168.255.254 11000000.10101000.11111111.11111110
192.168.255.255 11000000.10101000.11111111.11111111
(broadcast)
Addresses for User Devices

Hosts are assigned IP addresses from the range of available


addresses in the network.

These IP addresses can be assigned either:


Statically
Dynamically
Static Assignment

Useful for printers, servers, and other networking devices that do


not change location often and need to be accessible to clients on
the network based on a fixed IP address.
Increased control of network resources.
However, static addressing can be time-consuming to enter on
each host.
Dynamic Assignment

Instead of manually assigning IP


addresses (subnet mask, default
gateway, DNS addresses), it is
easier to have IP addresses
assigned automatically.
This is done using Dynamic Host
Configuration Protocol (DHCP).
The DHCP server requires that a
block of addresses, called an
address pool, is used for
assigning to the DHCP clients on
a network.
How Does DHCP Work?
Client Boots

DHCP Discover
Mac Address

DHCP Request
IP, MAC Address

Client DHCP
Server

DHCP Offer
IP, Lease time

DHCP Ack
IP, Lease time
Dynamic vs. Static IP
Addressing Quiz
Desktop computer Server Router Switch

Laptop IP phone Printer RADIUS server

AP PDA iTouch Fridge

Static IP Address Dynamic (DHCP) IP Address


Destination Address Type

Source IP addresses
are always unicast

Unicasts:
Packet travels from one host to another specific host.
Multicasts:
Packet travels from one host to a select number of other hosts.
Supports voice and audio broadcasts, news feeds, distribution of
software, re-imaging clients off peak times.
Broadcasts:
Packet travels from one host to all hosts on the local network.
Destination Address Type
Classful Addressing

In classful addressing, the IP address space is divided into


five classes: A, B, C, D, and E. Each class occupies some
part of the whole address space

Historically, RFC1700 grouped the unicast ranges into specific sizes


referred to as Classful addressing for IPv4:
Class A, B, and C addresses: 0.0.0.0 - 223.255.255.255
Multicast addresses: 224.0.0.0 - 239.255.255.255
Experimental addresses: 240.0.0.0 - 255.255.255.254
IPv4 Address Classes

Class A /8

Class B /16

Class C /24
IPv4 Address Classes
Address # of Possible # of Possible Total Possible
Class Networks Hosts Addresses

Class A 126 16,777,214


2,113,928,964

Class B 16,384 65,534 1,073,709,056

Class C 2,097,152 254 532,676,608

Class A. 255.0.0.0 or /8
Was reserved for governments and extremely large organizations.

Class B. 255.255.0.0 or /8
Was reserved for medium/large organizations.

Class C. 255.255.255.0 or /24


Was for every other organization (small organizations).
How the ranges were
determined
First First Network Host
Class Bits Octet Bits Bits

A 0 0 – 127 8 24

B 10 128 - 191 16 16

C 110 192 - 223 24 8

D 1110 224 – 239

E 1111 240 - 255


Private Addresses
Most IPv4 addresses are public IP
addresses.
These are reachable IPv4
addresses on the Internet.
However, there are blocks of
addresses that are private
addresses and are never
propagated on the Internet.
Packets with a source or destination
private IP address are not
propagated by Internet routers.
Internet routers / firewalls block or
translate these addresses.
Private addresses are usually
converted to public IP addresses using
NAT (Network Address Translation)
Private Addresses

Private addresses are defined in RFC 1918.


RFC 6598, IANA reserved 100.64.0.0/10 known as shared
address space. Similar to RFC 1918, but intended only for use
in service provider networks.
Public Addresses
Public addresses are
required on the Internet and
they must be unique.
The use of public addresses
is regulated and allocated to
each organization
separately.
RIRs (Regional Internet
Registries) typically provide
public addresses to ISPs.
Companies obtain their
IPv4 address blocks from
an ISP.
Other Special Addresses
Refer to RFC 3330

Loopback address: 127.0.0.1


127.0.0.0 – 127.255.255.255
Hosts use to direct traffic to themselves.

Link-Local addresses: 169.254.0.0/16


169.254.0.0 – 169.254.255.255
Host can automatically assign itself an address if it has
none.

TEST-NET addresses:
192.0.2.0 to 192.0.2.255 (192.0.2.0 /24)
Subnetting
Problem: Organizations
have multiple networks
which are independently University Network
managed Engineering Medical
Solution 1: Allocate a School School
separate network
address for each network Library
Difficult to manage
From the outside of
the organization, each
network must be
addressable.
Solution 2: Add another
level of hierarchy to the Subnetting
IP addressing structure
Subnetting Example
Network address 172.16.0.0 with /16 network mask

Using Subnets: subnet mask 255.255.255.0 or /24

172.16.0.0/24 172.16.10.0/24

172.16.5.0/24 172.16.25.0/24

34
Basic Idea of Subnetting
Split the host number portion of an IP address into a
subnet number and a (smaller) host number.
Result is a 3-layer hierarchy

network prefix host number

network prefix subnet number host number

extended network prefix

Then:
Subnets can be freely assigned within the organization
Internally, subnets are treated as separate networks
Subnet structure is not visible outside the organization
How your provider (ISP) sees
you….
150.50.1.0 /24
150.50.2.0 /24

150.50.0.0 /16

150.50.0.0
150.50.3/16
.0 /24

150.50.4.0 /24
150.50.5.0 /24

Subnetting does not change how the outside world sees


the network but provides additional structure within the
organization.
Calculating the number
subnets/hosts

192.168.1.0
255.255.255.0
Network Host

Network 192.168.1.0/24
Need:
As many subnets as possible, 60 hosts per
subnet
Calculating the number
subnets/hosts

Number of hosts per subnet

192.168.1. 0 0 0 0 0 0 0 0

255.255.255. 0 0 0 0 0 0 0 0
6 host bits
Network Host

Network 192.168.1.0/24
Need:
As many subnets as possible, 60 hosts per
subnet
Calculating the number
subnets/hosts

Number of subnets
192.168.1. 0 0 0 0 0 0 0 0

255.255.255. 1 1 0 0 0 0 0 0 255.255.255.192

6 host bits
Network Host
Network 192.168.1.0/24
Need:
As many subnets as possible, 60 hosts per subnet
New Subnet Mask: 255.255.255.192 (/26)
Number of Hosts per subnet: 6 bits, 64-2 hosts, 62 hosts
Number of Subnets: 2 bits or 4 subnets
Calculating the number
subnets/hosts

Number of subnets
192.168.1. 0 0 0 0 0 0 0 0

255.255.255. 1 1 0 0 0 0 0 0 255.255.255.192

192.168.1. 0 0 0 0 0 0 0 0 192.168.1.0/26
192.168.1. 0 1 0 0 0 0 0 0 192.168.1.64/26
192.168.1. 1 0 0 0 0 0 0 0 192.168.1.128/26
192.168.1. 1 1 0 0 0 0 0 0 192.168.1.192/26
Number of Hosts per subnet: 6 bits, 64-2 hosts, 64 TOTAL
hosts, 62 usable hosts
Number of Subnets: 2 bits or 4 subnets
Calculating the number
subnets/hosts

192.168.1.0
255.255.255.0
Network Host

Network 192.168.1.0/24
Need:
As many subnets as possible, 12 hosts per
subnet
Calculating the number
subnets/hosts

Number of hosts per subnet

192.168.1. 0 0 0 0 0 0 0 0

255.255.255. 0 0 0 0 0 0 0 0
4 host bits
Network Host

Network 192.168.1.0/24
Need:
As many subnets as possible, 12 hosts per
subnet
Calculating the number
subnets/hosts

Number of hosts per subnet

Number of subnets
192.168.1. 0 0 0 0 0 0 0 0

255.255.255. 1 1 1 1 0 0 0 0 255.255.255.240

4 host bits
Network Host
Network 192.168.1.0/24
Need:
As many subnets as possible, 12 hosts per subnet
New Subnet Mask: 255.255.255.240 (/28)
Number of Hosts per subnet: 4 bits, 16-2 hosts, 14 hosts
Number of Subnets: 4 bits or 16 subnets
Calculating the number
subnets/hosts

192.168.1. 0 0 0 0 0 0 0 0 192.168.1.0/28
192.168.1. 0 0 0 1 0 0 0 0 192.168.1.16/28
192.168.1. 0 0 1 0 0 0 0 0 192.168.1.32/28
192.168.1. 0 0 1 1 0 0 0 0 192.168.1.48/28
New Subnet Mask:
192.168.1. 0 1 0 0 0 0 0 0 192.168.1.64/28
255.255.255.240 (/28)
192.168.1. 0 1 0 1 0 0 0 0 192.168.1.80/28 Number of Hosts per
192.168.1. 0 1 1 0 0 0 0 0 192.168.1.96/28
subnet: 4 bits, 16-2
192.168.1. 0 1 1 1 0 0 0 0 192.168.1.112/28
hosts, 16 TOTAL hosts,
14 usable hosts
192.168.1. 1 0 0 0 0 0 0 0 192.168.1.128/28
192.168.1. 1 0 0 1 0 0 0 0 192.168.1.144/28
Number of Subnets: 4
192.168.1. 1 0 1 0 0 0 0 0 192.168.1.160/28
bits or 16 subnets
192.168.1. 1 0 1 1 0 0 0 0 192.168.1.176/28
192.168.1. 1 1 0 0 0 0 0 0 192.168.1.192/28
192.168.1. 1 1 0 1 0 0 0 0 192.168.1.208/28
192.168.1. 1 1 1 0 0 0 0 0 192.168.1.224/28
192.168.1. 1 1 1 1 0 0 0 0 192.168.1.240/28
VLSM

Variable Length Subnet


Mask

This is the process of


subnetting a subnet

More than one subnet


mask can be used
VLSM
VLSM – the process of
sub-netting a subnet to fit
your needs.
Example:
Subnet 10.1.0.0/16, 8
more bits are borrowed
again, to create 256
subnets with a /24 mask.
Mask allows for 254 host
addresses per subnet
Subnets range from:
10.1.0.0 / 24 to
10.1.255.0 / 24
* Same process for Subnet
10.2.0.0/16
VLSM
Subnet 10.3.0.0/16, 12 more bits
are borrowed again, to create
4,096 subnets with a /28 mask.
– Mask allows for 14 host

addresses per subnet


– Subnets range from: 10.3.0.0 /

28 to 10.3.255.240 / 28
Subnet 10.4.0.0/16, 4 more bits
are borrowed again, to create 16
subnets with a /20 mask.
– Mask allows for 2,046 host

addresses per subnet


– Subnets range from: 10.4.0.0 /

20 to 10.4.240.0 / 20
Classless Inter-Domain Routing
(CIDR)-Supernetting
Route summarization done by CIDR
Routes are summarized with masks that are less than
that of the default classful mask (supernetting)
-Example:
172.16.0.0 / 13 is the summarized
route for the 172.16.0.0 / 16 to
172.23.0.0 / 16 classful networks

Although 172.22.0.0/16 and


172.23.0.0/16 are not shown in
the graphic, these are also
included in the summary route.
Classless Inter-Domain Routing
(CIDR)-Supernetting

Steps to calculate a route


summary:

1. List networks in binary


format
2. Count number of left
most matching bits to
determine summary
route’s mask
3. Copy the matching bits
and add zero bits to
determine the
summarized network
address
Example: Calculating a
summary route
Which address can be used to
summarize networks
A:
• 192.168.0.0/30
11000000 10101000 00000000 00000000
• 192.168.0.4/30
11000000 10101000 00000000 00000100
• 192.168.0.8/30
11000000 10101000 00000000 00001000
• 192.168.0.16/29
11000000 10101000 00000000 00010000
• B
• 192.168.4.0/30
• 192.168.5.0/30 11000000 10101000 00000100 00000000
• 192.168.6.0/30 11000000 10101000 00000101 00000000
• 192.168.7.0/29 11000000 10101000 00000110 00000000
11000000 10101000 00000111 00000000

Answer:????
ICMP
Internet Control Message Protocol

IP is a best effort delivery system.


No mechanism to ensure that the data is delivered
So how do we know if a packet encountered a problem
along the way?
Internet Control Message Protocol (ICMP)
ICMP
Internet Control Message Protocol

RFC 792
ICMP is available for both IPv4 and IPv6.
ICMPv4 is the messaging protocol for IPv4.
ICMPv6 provides these same services for IPv6 but
includes additional functionality.
ICMP messages common to ICMPv4 and ICMPv6 include:
Host confirmation
Destination or Service Unreachable
Route redirection
Time exceeded
ICMPv6 includes additional functionality.
ICMP
Internet Control Message Protocol

ICMP is used for:


Informational messages (ping, traceroute)
Error messages (network unreachable)
ICMP is a layer 3 protocol directly encapsulated in
another layer 3 protocol IP.
No transport header
Knowledge of ICMP control messages is an essential
part of network troubleshooting.
ICMP Message Format

Type
the type of service being provided. There’s a specific type number for each
error or informational message sent.

Code
the error code provides further information on the message type. It tells what
was the possible cause to the problem.

Checksum
the 16-bit one's complement of the one's complement sum of the ICMP
message starting with the ICMP type. Used to find problems on the ICMP
message ONLY.
ICMP Messages

Type Message Type Message


3 Destination Unreachable 8 or 0 Echo request or reply
4 Source Quench 13 or 14 Timestamp
11 Time Exceeded 17 or 18 Address Mask
12 Parameter problem 10 or 9 Router Sollicitation/Adv
5 Redirection
ICMP Types&Codes

Type Code Meaning


0 0 echo reply
3 0 network unreachable
3 1 host is unreachable
3 3 port is unreachable
4 0 source quench
5 0 redirect
8 0 echo request
9/10 0 router discovery/advertisement
11 0 time exceed
12 0 parameter problem
13/14 0 time stamp request
17/18 0 network request/reply
Host Confirmation (PING)
Ping is a utility used to verify connectivity to an IP host.
It measures the round-trip time for messages sent from the
originating host to a destination computer.
Ping uses an ICMP Echo Message to determine if a host is
reachable.
A host initiates a ping (ICMP Echo Request) and the destination
replies (ICMP Echo Reply).
ICMP only reports on the status of the delivered packet to the
source device.
ICMP: Echo Request/Reply

PING sends icmp type 8 echo request to a node


and expects an icmp type 0 echo reply

8 0
Send

0 0
Reply
ICMP: Echo Request/Reply
ICMP: Echo Request/Reply
Destination or Service
Unreachable
When a router cannot deliver a packet, it sends an ICMP
Destination Unreachable message to the source.
Message includes a code indicating why it could not be
delivered.
Some of the Destination Unreachable codes for ICMPv4 are:
0 - net unreachable.
1 - host unreachable.
2 - protocol unreachable.
3 - port unreachable.
4.- fragmentation needed and DF set
5.- source route failed
Note: Codes 0,1,4 and 5 may be received from a gateway
codes 2 and 3 may be received from a host
Destination or Service
Unreachable
ICMP only reports on the status of the delivered packet to the
source device.

For example:
PC1 pings PC2.
The ping crosses R1, then R2, but R3 encounters a link error.
Since the packet only contains the source and destination IP
addresses, R3 may notify PC1 of the failure (optional).
It’s unaware of the exact path the packet took
No ICMP messages are sent to R1 or R2.

R1 R2 R3 PC2
PC1
Destination or Service
Unreachable
C:\Users\eietr> ping 192.168.2.115 Codes 0 (net
Pinging 192.168.1.115 with 32 bytes of data:
unreachable) is sent
Reply from 192.168.1.116: Destination net unreachable. when a router does not
Reply from 192.168.1.116: Destination net unreachable. have the requested
Reply from 192.168.1.116: Destination net unreachable. network.
Reply from 192.168.1.116: Destination net unreachable.

Ping statistics for 192.168.1.115:


Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

C:\Users\eietr>

C:\Users\eietr> ping 192.168.1.115 Code 1 (host


unreachable) is sent
Pinging 192.168.1.115 with 32 bytes of data: when a router receives
Reply from 192.168.1.116: Destination host unreachable. a packet for which it
Reply from 192.168.1.116: Destination host unreachable. has an attached route
Reply from 192.168.1.116: Destination host unreachable.
but is unable to deliver
Reply from 192.168.1.116: Destination host unreachable.
the packet to the host
Ping statistics for 192.168.1.115: on the attached
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), network.

C:\Users\eietr>
Ping Tools

www.pingtest.net
Ping Tools
Ping Tools - IPERF

Das könnte Ihnen auch gefallen