IPv4 Addressing - MODULO 11 Flashcards
Network and Host Portions
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, as shown in the figure.
The bits within the network portion of the address must be identical for all devices that
reside in the same network.
The bits within 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 will reside in the same network.
But how do hosts know which portion of the 32-bits identifies the network and which
identifies the host? That is the role of the subnet mask.
The Subnet Mask
As shown in the figure, assigning an IPv4 address to a host requires the following:
* 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.
Note:
A default gateway IPv4 address is required to reach remote networks and DNS
server IPv4 addresses are required to translate domain names to IPv4 addresses.
The IPv4 subnet mask is used to differentiate the network portion from the host portion of
an IPv4 address.
When an IPv4 address is assigned to a device, the subnet mask is used to determine the
network address of the device.
The network address represents all the devices on the same network.
The next figure displays the 32-bit subnet mask in dotted decimal and binary formats.
Subnet Mask
Notice how the subnet mask is a consecutive sequence of 1 bits followed by a consecutive
sequence of 0 bits.
To identify the network and host portions of an IPv4 address, the subnet mask is compared
to the IPv4 address bit for bit, from left to right as shown in the figure.
Associating an IPv4 Address with its
Subnet Mask
Note that the subnet mask does not actually contain the network or host portion of an IPv4
address, it just tells the computer where to look for the part of the IPv4 address that is the
network portion and which part is the host portion.
The actual process used to identify the network portion and host portion is called ANDing.
The Prefix Length
Expressing network addresses and host addresses with the dotted decimal subnet mask
address can become cumbersome.
Fortunately, there is an alternative method of identifying a subnet mask, a method called
the prefix length.
The prefix length is the number of bits set to 1 in the subnet mask.
It is written in “slash notation”, which is noted by a forward slash (/) followed by the number
of bits set to 1.
Therefore, count the number of bits in the subnet mask and prepend it with a slash.
Refer to the table for examples. The first column lists various subnet masks that can be
used with a host address.
The second column displays the converted 32-bit binary address. The last column displays
the resulting prefix length.
Comparing the Subnet Mask and Prefix
Length
Subnet Mask
32-bit Address
255.0.0.0
11111111.00000000.00000000.00000000
Prefix Length
255.255.0.0
/8
11111111.11111111.00000000.00000000
255.255.255.0
/16
11111111.11111111.11111111.00000000
255.255.255.128 11111111.11111111.11111111.10000000
/24
255.255.255.192 11111111.11111111.11111111.11000000
/25
255.255.255.224 11111111.11111111.11111111.11100000
/26
255.255.255.240 11111111.11111111.11111111.11110000
/27
255.255.255.248 11111111.11111111.11111111.11111000
/28
255.255.255.252 11111111.11111111.11111111.11111100
/29
/30
Note:
A network address is also referred to as a prefix or network prefix. Therefore, the
prefix length is the number of 1 bits in the subnet mask.
When representing an IPv4 address using a prefix length, the IPv4 address is written
followed by the prefix length with no spaces. For example, 192.168.10.10 255.255.255.0
would be written as 192.168.10.10/24. Using various types of prefix lengths will be
discussed later. For now, the focus will be on the /24 (i.e. 255.255.255.0) prefix
Determining the Network: Logical
AND
A logical AND is one of three Boolean operations used in Boolean or digital logic.
The other two are OR and NOT.
The AND operation is used in determining the network address.
Logical AND is the comparison of two bits that produce the results shown below.
Note how only a 1 AND 1 produces a 1. Any other combination results in a 0.
* 1 AND 1 = 1
* 0 AND 1 = 0
* 1 AND 0 = 0
* 0 AND 0 = 0
Note: In digital logic, 1 represents True and 0 represents False. When using an AND
operation, both input values must be True (1) for the result to be True (1).
To identify the network address of an IPv4 host, the IPv4 address is logically ANDed, bit by
bit, with the subnet mask.
ANDing between the address and the subnet mask yields the network address.
To illustrate how AND is used to discover a network address, consider a host with IPv4
address 192.168.10.10 and subnet mask of 255.255.255.0, as shown in the figure:
IPv4 host address (192.168.10.10) - The IPv4 address of the host in dotted
decimal and binary formats.
* Subnet mask (255.255.255.0) - The subnet mask of the host in dotted decimal
and binary formats.
* Network address (192.168.10.0) - The logical AND operation between the IPv4
address and subnet mask results in an IPv4 network address shown in dotted
decimal and binary formats.
Using the first sequence of bits as an example, notice the AND operation is performed on
the 1-bit of the host address with the 1-bit of the subnet mask. This results in a 1 bit for the
network address. 1 AND 1 = 1.
The AND operation between an IPv4 host address and subnet mask results in the IPv4
network address for this host.
In this example, the AND operation between the host address of 192.168.10.10 and the
subnet mask 255.255.255.0 (/24), results in the IPv4 network address of 192.168.10.0/24.
This is an important IPv4 operation, as it tells the host what network it belongs to.
Network, Host, and Broadcast
Addresses
Within each network are three types of IP addresses:
* Network address
* Host addresses
* Broadcast address
Network address
A network address is an address that represents a specific network. A device belongs to
this network if it meets three criteria:
* It has the same subnet mask as the network address.
* It has the same network bits as the network address, as indicated by the subnet
mask.
* It is located on the same broadcast domain as other hosts with the same network
address.
A host determines its network address by performing an AND operation between its IPv4
address and its subnet mask.
As shown in the table, 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
Host addresses are addresses that can be assigned to a device such as a host computer,
laptop, smart phone, web camera, printer, router, etc.
The host portion of the address is the bits indicated by 0 bits in the subnet mask.
Host addresses can have any combination of bits in the host portion except for all 0 bits
(this would be a network address) or all 1 bits (this would be a broadcast address).
All devices within the same network, must have the same subnet mask and the same
network bits. Only the host bits will differ and must be unique.
Notice that in the table, there is a first and last host address:
First host address - This first host within a network has all 0 bits with the last
(right-most) bit as a 1 bit. In this example it is 192.168.10.1/24.
* Last host address - This last host within a network has all 1 bits with the last
(right-most) bit as a 0 bit. In this example it is 192.168.10.254/24.
Any addresses between and including, 192.168.10.1/24 through 192.168.10.254/24 can be
assigned to a device on the network.
Broadcast address
A broadcast address is an address that is used when it is required to reach all devices on
the IPv4 network.
As shown in the table, 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.
IPv4 Unicast, Broadcast, and Multicast
Unicast
In the previous topic you learned about the structure of an IPv4 address; each has a
network portion and a host portion.
There are different ways to send a packet from a source device, and these different
transmissions affect the destination IPv4 addresses.
Unicast transmission refers to one device sending a message to one other device 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 source IP address can only be a unicast address, because the packet can only originate
from a single source.
This is regardless of whether the destination IP address is a unicast, broadcast or
multicast.
Note: In this course, all communication between devices is unicast unless otherwise noted.
IPv4 unicast host addresses are in the address range of 1.0.0.1 to 223.255.255.255.
However, within this range are many addresses that are reserved for special purposes.
These special purpose addresses will be discussed later in this module.
Broadcast
Broadcast transmission refers to a device sending a message to all the devices on a
network in one-to-all communications.
A broadcast packet has a destination IP address with all ones (1s) in the host portion, or 32
one (1) bits.
Note: IPv4 uses broadcast packets. However, there are no broadcast packets with IPv6.
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, 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.
Broadcast packets use resources on the network and make every receiving host on the
network process the packet.
Therefore, broadcast traffic should be limited so that it does not adversely affect the
performance of the network or devices.
Because routers separate broadcast domains, subdividing networks can improve network
performance by eliminating excessive broadcast traffic.
IP Directed Broadcasts
In addition to the 255.255.255.255 broadcast address, there is a broadcast IPv4 address
for each network. Called a directed broadcast, this address uses the highest address in the
network, which is the address where all the host bits are 1s.
For example, the directed broadcast address for 192.168.1.0/24 is 192.168.1.255.
This address allows communication to all the hosts in that network.
To send data to all the hosts in a network, a host can send a single packet that is
addressed to the broadcast address of the network.
A device that is not directly connected to the destination network forwards an IP directed
broadcast in the same way it would forward unicast IP packets destined to a host on that
network.
When a directed broadcast packet reaches a router that is directly connected to the
destination network, that packet is broadcast on the destination network.
Note: Because of security concerns and prior abuse from malicious users, directed
broadcasts are turned off by default starting with Cisco IOS Release 12.0 with the global
configuration command no ip directed-broadcasts.
Multicast
Multicast transmission reduces traffic by allowing a host to send a single packet to a
selected set of hosts that subscribe to a multicast group.
A multicast packet is a packet with a destination IP address that is a multicast address.
IPv4 has reserved the 224.0.0.0 to 239.255.255.255 addresses as a multicast range.
Hosts that receive particular multicast packets are called multicast clients.
The multicast clients use services requested by a client program to subscribe to the
multicast group.
Each multicast group is represented by a single IPv4 multicast destination address.
When an IPv4 host subscribes to a multicast group, the host processes packets addressed
to this multicast address, and packets addressed to its uniquely allocated unicast address.
Routing protocols such as OSPF use multicast transmissions.
For example, routers enabled with OSPF communicate with each other using the reserved
OSPF multicast address 224.0.0.5.
Only devices enabled with OSPF will process these packets with 224.0.0.5 as the
destination IPv4 address. All other devices will ignore these packets.
Types of IPv4 Addresses
Public and Private IPv4 Addresses
Just as there are different ways to transmit an IPv4 packet, there are also different types of
IPv4 addresses.
Some IPv4 addresses cannot be used to go out to the internet, and others are specifically
allocated for routing to the internet.
Some are used to verify a connection and others are self-assigned.
As a network administrator, you will eventually become very familiar with the types of IPv4
addresses, but for now, you should at least know what they are and when to use them.
Public IPv4 addresses are addresses which are globally routed between internet service
provider (ISP) routers.
However, not all available IPv4 addresses can be used on the internet.
There are blocks of addresses called private addresses that are used by most
organizations to assign IPv4 addresses to internal hosts.
In the mid-1990s, with the introduction of the World Wide Web (WWW), private IPv4
addresses were introduced because of the depletion of IPv4 address space. Private IPv4
addresses are not unique and can be used internally within any network.
Note: The long-term solution to IPv4 address depletion was IPv6.
The Private Address Blocks
Network Address and PrefixRFC 1918 Private Address
Range10.0.0.0/810.0.0.0 -
10.255.255.255172.16.0.0/12172.16.0.0 -
172.31.255.255192.168.0.0/16192.168.0.0 - 192.168.255.255
Network Address and Prefix
RFC 1918 Private
Address Range
10.0.0.0/8
10.0.0.0 -
10.255.255.255
172.16.0.0/12
172.16.0.0 -
172.31.255.255
192.168.0.0/16
192.168.0.0 -
192.168.255.255
Note: Private addresses are defined in RFC 1918 and sometimes referred to as RFC 1918
address space.
Routing to the Internet
Most internal networks, from large enterprises to home networks, use private IPv4
addresses for addressing all internal devices (intranet) including hosts and routers.
However, private addresses are not globally routable.
In the figure, customer networks 1, 2, and 3 are sending packets outside their internal
networks.
These packets have a source IPv4 address that is a private address and a destination IPv4
address that is public (globally routable).
Packets with a private address must be filtered (discarded) or translated to a public address
before forwarding the packet to an ISP.
The diagram is a network topology with three networks, each connected to a different ISP
router. The ISP routers are performing NAT between each network and the Internet.
Private IPv4 Addresses and Network
Address Translation (NAT)
Before the ISP can forward this packet, it must translate the source IPv4 address, which is
a private address, to a public IPv4 address using Network Address Translation (NAT).
NAT is used to translate between private IPv4 and public IPv4 addresses.
This is usually done on the router that connects the internal network to the ISP network.
Private IPv4 addresses in the organization’s intranet will be translated to public IPv4
addresses before routing to the internet.
Note: Although, a device with a private IPv4 address is not directly accessible from another
device across the internet, the IETF does not consider private IPv4 addresses or NAT as
effective security measures.
Organizations that have resources available to the internet, such as a web server, will also
have devices that have public IPv4 addresses.
As shown in the figure, this part of the network is known as the DMZ (demilitarized zone).
The router in the figure not only performs routing, it also performs NAT and acts as a
firewall for security.
Special Use IPv4 Addresses
There are certain addresses, such as the network address and broadcast address, that
cannot be assigned to hosts.
There are also special addresses that can be assigned to hosts, but with restrictions on
how those hosts can interact within the network.
Loopback addresses
Loopback addresses (127.0.0.0 /8 or 127.0.0.1 to 127.255.255.254) are more commonly
identified as only 127.0.0.1, these are special addresses used by a host to direct traffic to
itself. For example, it can be used on a host to test if the TCP/IP configuration is
operational, as shown in the figure.
Notice how the 127.0.0.1 loopback address replies to the ping command.
Also note how any address within this block will loop back to the local host, which is shown
with the second ping in the figure.
Link-Local addresses
Link-local addresses (169.254.0.0 /16 or 169.254.0.1 to 169.254.255.254) are more
commonly known as the Automatic Private IP Addressing (APIPA) addresses or self
assigned addresses.
They are used by a Windows DHCP client to self-configure in the event that there are no
DHCP servers available.
Link-local addresses can be used in a peer-to-peer connection but are not commonly used
for this purpose.
Customers were allocated a network address based on one of three classes, A, B, or C.
The RFC divided the unicast ranges into specific classes as follows:
Class A (0.0.0.0/8 to 127.0.0.0/8) - Designed to support extremely large networks
with more than 16 million host addresses. Class A used a fixed /8 prefix with the
first octet to indicate the network address and the remaining three octets for host
addresses (more than 16 million host addresses per network).
* Class B (128.0.0.0 /16 - 191.255.0.0 /16) - Designed to support the needs of
moderate to large size networks with up to approximately 65,000 host addresses.
Class B used a fixed /16 prefix with the two high-order octets to indicate the
network address and the remaining two octets for host addresses (more than
65,000 host addresses per network).
* Class C (192.0.0.0 /24 - 223.255.255.0 /24) - Designed to support small networks
with a maximum of 254 hosts. Class C used a fixed /24 prefix with the first three
octets to indicate the network and the remaining octet for the host addresses (only
254 host addresses per network).
Note: There is also a Class D multicast block consisting of 224.0.0.0 to 239.0.0.0 and a
Class E experimental address block consisting of 240.0.0.0 - 255.0.0.0.