Lec12 IPv4 Addressing
Lec12 IPv4 Addressing
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 1
IPv4 Address Structure: Network and Host Portions
• This chapter covers how to segment a network into subnets.
• An IPv4 address is a 32-bit hierarchical address that is made up of a network portion and
a host portion.
• When determining the network portion versus the host portion, you must look at the
32-bit stream.
• The bits in the network portion of the address must be identical for all devices that reside
in the same network. The bits in the host portion of the address must be unique to identify
a specific host within a network. If two hosts have the same bit pattern in the specified
network portion of the 32-bit stream, those two hosts reside in the same network.
• A subnet mask is used to determine the network and host portions.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
IPv4 Address Structure: The Subnet Mask
• Assigning an IPv4 address to a host
requires:
• IPv4 address: This is the unique
IPv4 address of the host.
• Subnet mask: This is used to
identify the network/host portion of
the IPv4 address
• To identify the network and host portions
of an IPv4 address, the subnet mask is
compared to the IPv4 address bit for bit, • The network address represents all the
from left to right. devices on the same network.
• The actual process used to identify the
network and host portions is called
ANDing.
• The IPv4 subnet mask is used to
differentiate the network portion from the
host portion of an IPv4 address. © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
IPv4 Address Structure: The Prefix Length
• A prefix length is a less cumbersome method used to identify a subnet mask address.
Prefix
• The prefix length is the number of Subnet Mask 32-bit Address
Length
bits set to 1 in the subnet mask. It 255.0.0.0 11111111.00000000.00000000.00000000 /8
is written in “slash notation,” with a
255.255.0.0 11111111.11111111.00000000.00000000 /16
forward slash (/) followed by the
number of bits set to 1. 255.255.255.0 11111111.11111111.11111111.00000000 /24
• Therefore, count the number of bits 255.255.255.128 11111111.11111111.11111111.10000000 /25
in the subnet mask and prepend it
with a slash. 255.255.255.192 11111111.11111111.11111111.11000000 /26
In this example, the AND operation between the host address 192.168.10.10
and the subnet mask 255.255.255.0 (/24), results in the IPv4 network address
192.168.10.0/24. This is an important IPv4 operation, as it tells the host what
network it belongs to. © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
IPv4 Address Structure:Network, Host, and Broadcast Addresses
• Within each network are three types of IP addresses:
• Network address: which is an address that represents a specific network. A host determines its network address by performing an
AND operation between its IPv4 address and its subnet mask. The network address has all 0 bits in the host portion, as determined by
the subnet mask. In this example, the network address is 192.168.10.0/24. A network address cannot be assigned to a device.
• Host addresses: are addresses that can be assigned to devices such as host computers, laptops, smartphones, routers, and so on. The
host portion of the address is the bits indicated by 0 bits in the subnet mask. A host address can have any combination of bits
in the host portion except for all 0 bits (which would be a network address) or all 1 bits (which would be a broadcast
address). All devices in the same network must have the same subnet mask and the same network bits. Only the host bits
differ and must be unique.
• Broadcast address: is an address that is used to reach all devices on the IPv4 network. The network broadcast address has all 1 bits
in the host portion, as determined by the subnet mask. In this example, the network address is 192.168.10.255/24. A broadcast
address cannot be assigned to a device.
Host
Network Portion Host Bits
Portion
Subnet mask 255 255 255 0
255.255.255.0 or /24 11111111 11111111 11111111 00000000
Network address 192 168 10 0
All 0s
192.168.10.0 or /24 11000000 10100000 00001010 00000000
First address 192 168 10 1
All 0s and a 1
192.168.10.1 or /24 11000000 10100000 00001010 00000001
Last address 192 168 10 254
All 1s and a 0
192.168.10.254 or /24 11000000 10100000 00001010 11111110
Broadcast address 192 168 10 255
All 1s
192.168.10.255 or /24 11000000 10100000 00001010 11111111
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 6
IPv4 Unicast, Broadcast, and Multicast: Unicast
• Unicast transmission is sending a packet to one destination IP address in one-to-one
communications.
• A unicast packet has a destination IP address that is a unicast address, which goes to a single
recipient.
• A unicast packet has a destination IP address that is a unicast address, which goes to a single
recipient. A source IP address can only be a unicast address because the packet can only originate
from a single source— regardless of whether the destination IP address is a unicast, broadcast, or
multicast address.
• For example, the PC at 172.16.4.1 sends a unicast packet to the printer at 172.16.4.253.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
IPv4 Unicast, Broadcast, and Multicast: Broadcast
• Broadcast transmission is sending a packet to all other destination IP addresses in one-to-all
communications.
• A broadcast packet has a destination IP address with all 1s in the host portion, or 32 1 bits.
• Note: IPv4 uses broadcast packets. However, there are no broadcast packets with IPv6.
• For example, the PC at 172.16.4.1 sends a broadcast packet to all IPv4 hosts.
• A broadcast packet must be processed by all devices in the same broadcast domain. A broadcast domain
identifies all hosts on the same network segment.
• A broadcast may be directed or limited. A directed broadcast is sent to all hosts on a specific network.
For example, say that a host on the 172.16.4.0/24 network sends a packet to 172.16.4.255. A limited
broadcast is sent to 255.255.255.255. By default, routers do not forward broadcasts
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9
Types of IPv4 Addresses: Public and Private IPv4 Addresses
• As defined in in RFC 1918, public IPv4 addresses are globally routed between internet
service provider (ISP) routers.
• Private addresses are common blocks of
addresses used by most organizations to assign
IPv4 addresses to internal hosts.
Network Address
• The private IPv4 addresses in this Table were and Prefix
RFC 1918 Private Address Range
introduced to deal with the depletion of IPv4
10.0.0.0/8 10.0.0.0 - 10.255.255.255
address space.
• Private IPv4 addresses are not unique and can 172.16.0.0/12 172.16.0.0 - 172.31.255.255
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
Types of IPv4 Addresses: Routing to the Internet
• Most internal networks, use private IPv4 addresses for addressing all internal devices (in intranets),
including hosts and routers. However, private addresses are not globally routable.
• Network Address Translation (NAT) translates private IPv4 addresses to public IPv4 addresses.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16
Subnet an IPv4 Network: Subnet on an Octet Boundary
• IPv4 subnets are created by using one or more of the host bits as network bits. This process
involves extending the subnet mask to borrow some of the bits from the host portion of the
address to create additional network bits. The more host bits that are borrowed, the more subnets
that can be defined. The more bits that are borrowed to increase the number of subnets, the lower
the number of hosts per subnet.
• Networks are most easily subnetted at the octet boundary of /8, /16, and /24.
• Notice that using longer prefix lengths decreases the number of hosts per subnet.
Prefix Length Subnet Mask Subnet Mask in Binary (n = network, h = host) # of hosts
nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh
/8 255.0.0.0 11111111.00000000.00000000.00000000
16,777,214
nnnnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhh
/16 255.255.0.0 11111111.11111111.00000000.00000000
65,534
nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh
/24 255.255.255.0 11111111.11111111.11111111.00000000
254
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17
Subnet an IPv4 Network: Subnet on an Octet Boundary
• Consider the following example: Say that an enterprise has chosen the private
address 10.0.0.0/8 as its internal network address. That network address can connect
16,777,214 hosts in one broadcast domain. Obviously, having more than 16 million
hosts on a single subnet is not ideal.
• The enterprise could further subnet the 10.0.0.0/8 address at the octet boundary /16.
This would enable the enterprise to define up to 256 subnets (that is, 10.0.0.0/16 to
10.255.0.0/16), and each subnet would be capable of connecting 65,534 hosts.
Notice that the first two octets identify the network portion of the address,
whereas the last two octets are for host IP addresses.
• Alternatively, the enterprise could choose to subnet the 10.0.0.0/8 network at the /24
octet boundary. This would enable the enterprise to define 65,536 subnets, each
capable of connecting 254 hosts.
• The /24 boundary is very popular in subnetting because it accommodates a
reasonable number of hosts and conveniently subnets at the octet boundary.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
Subnet an IPv4 Network: Subnet on an Octet Boundary (Cont.)
• In the first table 10.0.0.0/8 is subnetted using /16 and in the second table, a /24 mask.
Subnet Address Host Range Subnet Address
(256 Possible (65,534 possible hosts per Broadcast Host Range
(65,536 Possible Broadcast
Subnets) subnet) (254 possible hosts per subnet)
Subnets)
10.0.0.0/16 10.0.0.1 - 10.0.255.254 10.0.255.255 10.0.0.0/24 10.0.0.1 - 10.0.0.254 10.0.0.255
nnnnnnnn.nnnnnnnn.nnnnnnnh.hhhhhhhh
• This address has 16 bits in the /23 255.255.254.0 11111111.11111111.11111110.00000000 128 510
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23
Subnet a Slash 16 and a Slash 8 Prefix: Create 1000 Subnets with a Slash 8 prefix
Consider a small ISP that requires 1000 subnets for its clients using network
address 10.0.0.0/8 which means there are 8 bits in the network portion and 24
host bits available to borrow toward subnetting. Therefore, the small ISP will
subnet the 10.0.0.0/8 network
• The figure displays the number of subnets that can be created when
borrowing bits from the second and third.
• Notice there are now up to 22 host bits that can be borrowed (i.e., last
two bits cannot be borrowed).
• To satisfy the requirement of 1000 subnets for the enterprise, 10 bits (i.e.,
210=1024 subnets) would need to be borrowed (for a total of 1024 subnets)
showing the network address
and the resulting subnet mask,
which converts to 255.255.192.0,
or 10.0.0.0/18.
hosts.
Subnet to Meet Requirements: Subnet Private versus Public IPv4 Address Space
Enterprise networks will have an:
• Intranet: the internal part of a company’s network, accessible
only within the organization. Devices in the intranet use
private IPv4 addresses.
• This means the organization can use any of the private IPv4
network addresses for intranet, including the 10.0.0.0/8 prefix,
with 24 host bits and more than 16 million hosts. This also
includes subnetting on an octet boundary using a subnet mask
of /16 or /24 or any other number of prefix lengths, such as
/12, /18, /20(here, subnetting is easier and more flexible).
• DMZ: This is part of the company’s network containing
In computer networks, a DMZ, or
resources available to the internet, such as a web server.
demilitarized zone, is a physical or
Devices in the DMZ use public IPv4 addresses.
logical subnet that separates a
• This means an organization must maximize its own limited local area network (LAN) from
number of public IPv4 addresses; the network administrator other untrusted networks, usually,
must therefore subnet the network’s public address space into the public internet. DMZs are also
subnets with different subnet masks in order to minimize the known as perimeter networks or
number of unused host addresses per subnet. This is screened subnetworks.
known as variable-length subnet masking (VLSM).
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
Subnet to Meet Requirements: Minimize Unused Host IPv4 Addresses and Maximize Subnets
To minimize the number of unused host IPv4 addresses and maximize the number of available
subnetsThere are two considerations when planning subnets:
• The number of host addresses required for each network
• The number of individual subnets needed
Network administrators must devise a network addressing scheme that accommodates the maximum number of
hosts for each network and the number of subnets. The addressing scheme should allow for growth in both the
number of host addresses per subnet and the total number of subnets
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26
Subnet to Meet Requirements: Example: Efficient IPv4 Subnetting
• In this example, corporate headquarters has been
allocated a public network address of 172.16.0.0/22 (10
host bits) by its ISP providing 1,022 host addresses.
Examine the needs of an organization’s network usage and how the subnets will be
structured.
• Perform a network requirement study by looking at the entire network to determining how each
area will be segmented.
• Determine how many subnets are needed and how many hosts per subnet.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28
Structured Design: Device Address Assignment
Within a network, there are different types of devices that require addresses:
• End user clients – Most use DHCP to reduce errors and burden on network support staff. IPv6
clients can obtain address information using DHCPv6 or SLAAC.
• Servers and peripherals – These should have a predictable static IP address.
• Servers that are accessible from the internet – Servers must have a public IPv4 address, most
often accessed using NAT.
• Intermediary devices – Devices are assigned addresses for network management, monitoring, and
security.
• Gateway – Routers and firewall devices are gateway for the hosts in that network.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 29