Chapter No 5
Chapter No 5
An IP address is assigned to the Network interface connection for a host. This connection
is usually a network interface card (NIC) installed in the device. Examples of end-user
devices with network interfaces include workstations, servers, network printers and IP
phones. Some servers can have more than one NIC and each of these has its own IP
address. Router interfaces that provide connections to an IP network will also have an IP
address.
Every packet sent across the Internet has a source and destination IP address. This
information is required by networking devices to insure the information gets to the
destination and any replies are returned to the source.
An IP address is simply a series of 32 binary bits (ones and zeros). It is very difficult for
humans to read a binary IP address. For this reason, the 32 bits are grouped into four 8-bit
bytes called octets. An IP address in this format is hard for humans to read, write and
remember. To make the IP address easier to understand, each octet is presented as its
decimal value, separated by a decimal point or period. This is referred to as dotted-
decimal notation.
When a host is configured with an IP address, it is entered as a dotted decimal number
such as 192.168.1.5. Imagine if you had to enter the 32-bit binary equivalent of this-
11000000101010000000000100000101. If just one bit was mistyped, the address would
be different and the host may not be able to communicate on the network.
The 32-bit IP address is defined with IP version 4 (IPv4) and is currently the most
common form of IP address on the Internet. There are over 4 billion possible IP addresses
using a 32-bit addressing scheme.
When a host receives an IP address, it looks at all 32 bits as they are received by the NIC.
Humans, on the other hand, need to convert those 32 bits into their four octet decimal
equivalent. Each octet is made up of 8 bits and each bit has a value. The four groups of 8
bits have the same set of values. The rightmost bit in an octet has a value of 1 and the
values of the remaining bits, from right to left, are 2, 4, 8, 16, 32, 64 and 128.
Determine the value of the octet by adding the values of positions wherever there is a
binary 1 present.
If there is a 0 in a position, do not add the value.
If all 8 bits are 0s. 00000000 the value of the octet is 0.
If all 8 bits are 1s, 11111111 the value of the octet is 255 (128+64+32+16+8+4+2+1)
If the 8 bits are mixed, such as the example 00100111, the value of the octet is 39
(32+4+2+1)
So the value of each of the four octets can range from 0 to a maximum of 255.
As an example, if a host has IP address 192.168.18.57 the first three octets, (192.168.18),
identify the network portion of the address, and the last octet, (57) identifies the host.
This is known as hierarchical addressing because the network portion indicates the
network on which each unique host address is located. Routers only need to know how to
reach each network, rather than needing to know the location of each individual host.
There are two parts to every IP address. How do hosts know which portion is the network
and which is the host? This is the job of the subnet mask.
When an IP host is configured, a subnet mask is assigned along with an IP address. Like
the IP address, the subnet mask is 32 bits long. The subnet mask signifies which part of
the IP address is network and which part is host.
The subnet mask is compared to the IP address from left to right, bit for bit. The 1s in the
subnet mask represent the network portion; the 0s represent the host portion. In the
example shown, the first three octets are network, and the last octet represents the host.
When a host sends a packet, it compares its subnet mask to its own IP address and the
destination IP address. If the network bits match, both the source and destination host are
on the same network and the packet can be delivered locally. If they do not match, the
sending host forwards the packet to the local router interface to be sent on to the other
network.
The subnet masks we see most often with home and small business networking are:
255.0.0.0 (8-bits), 255.255.0.0 (16 bits) and 255.255.255.0 (24 bits). A subnet mask of
255.255.255.0 (decimal) or 11111111.11111111.1111111.00000000 (binary) uses 24 bits
to identify the network number which leaves 8 bits to number the hosts on that network.
To calculate the number of hosts that can be on that network, take the number 2 to the
power of the number of host bits (2 ^ 8 = 256). From this number, we must subtract 2
(256-2). The reason we subtract 2 is because all 1s within the host portion of an IP
address is a broadcast address for that network and cannot be assigned to a specific host.
All 0s within the host portion indicates the network ID and again, cannot be assigned to a
specific host. Powers of 2 can be calculated easily with the calculator that comes with any
Windows operating system.
Another way to determine the number of hosts available is to add up the values of the
available host bits (128+64+32+16+8+4+2+1 = 255). From this number, subtract 1 (255-
1 = 254), because the host bits cannot be all 1s. It is not necessary to subtract 2 because
the value of all 0s is 0 and is not included in the addition.
With a 16-bit mask, there are 16 bits (two octets) for host addresses and a host address
could have all 1s (255) in one of the octets. This might appear to be a broadcast but as
long as the other octet is not all 1s, it is a valid host address. Remember that the host
looks at all host bits together, not at octet values.
5.2 Types of IP addresses
The IP address and subnet mask work together to determine which portion of the IP
address represents the network address and which portion represents the host address.
IP addresses are grouped into 5 classes. Classes A, B and C are commercial addresses
and are assigned to hosts. Class D is reserved for multicast use and Class E is for
experimental use.
Class C addresses have three octets for the network portion and one for the hosts. The
default subnet mask is 24 bits (255.255.255.0). Class C addresses are usually assigned to
small networks.
Class B addresses have two octets to represent the network portion and two for the hosts.
The default subnet mask is 16 bits (255.255.0.0). These addresses are typically used for
medium-sized networks.
Class A addresses have only one octet to represent the network portion and three to
represent the hosts. The default subnet mask is 8 bits (255.0.0.0). These addresses are
typically assigned to large organizations.
The class of an address can be determined by the value of the first octet. For instance, if
the first octet of an IP address has a value in the range 192-223, it is classified as a Class
C address. As an example, 200.14.193.67 is a Class C address.
5.2.2 Public and Private IP Addresses
All hosts that connect directly to the Internet require a unique public IP address. Because
of the finite number of 32-bit addresses available, there is a risk of running out of IP
addresses. One solution to this problem was to reserve some private addresses for use
exclusively inside an organization. This allows hosts within an organization to
communicate with one another without the need of a unique public IP address.
RFC 1918 is a standard that reserves several ranges of addresses within each of the
classes A, B and C. As shown in the table, these private address ranges consist of a single
Class A network, 16 Class B networks and 256 Class C networks. This gives a network
administrator considerable flexibility in assigning internal addresses.
A very large network can use the Class A private network, which allows for over 16
million private addresses.
On medium size networks, a Class B private network could be used, which provides over
65,000 addresses.
Home and small business networks typically use a single class C private address, which
allows up to 254 hosts.
The Class A network, the 16 Class B networks, or the 256 Class C networks can be used
within any size organization. Typically many organizations use the Class A private
network.
Private addresses can be used internally by hosts in an organization as long as the hosts
do not connect directly to the Internet. Therefore, the same set of private addresses can be
used by multiple organizations. Private addresses are not routed on the Internet and will
be quickly blocked by an ISP router.
The use of private addresses can provide a measure of security since they are only visible
on the local network, and outsiders cannot gain direct access to the private IP addresses.
There are also private addresses that can be used for the diagnostic testing of devices.
This type of private address is known as a loopback address. The class A, 127.0.0.0
network, is reserved for loopback addresses.
5.2.3 Unicast, Multicast and Broadcast addresses
Unicast
A unicast address is the most common type on an IP network. A packet with a unicast
destination address is intended for a specific host. An example is a host with IP address
192.168.1.5 (source) requesting a web page from a server at IP address 192.168.1.200
(destination).
For a unicast packet to be sent and received, a destination IP address must be in the IP
packet header. A corresponding destination MAC address must also be present in the
Ethernet frame header. The IP address and MAC address combine to deliver data to one
specific destination host.
Broadcast
With a broadcast, the packet contains a destination IP address with all ones (1s) in the
host portion. This means that all hosts on that local network (broadcast domain) will
receive and look at the packet. Many network protocols, such as ARP and DHCP use
broadcasts.
Multicast
Devices that belong to a multicast group are assigned a multicast group IP address. The
range of multicast addresses is from 224.0.0.0 to 239.255.255.255. Since multicast
addresses represent a group of addresses (sometimes called a host group), they can only
be used as the destination of a packet. The source will always have a unicast address.
Examples of where multicast addresses would be used are in remote gaming, where many
players are connected remotely but playing the same game. Another example would be
distance learning through video conferencing, where many students are connected to the
same class.
Static
With a static assignment, the network administrator must manually configure the network
information for a host. At a minimum, this includes the host IP address, subnet mask and
default gateway.
Static addresses have some advantages. For instance, they are useful for printers, servers
and other networking devices that need to be accessible to clients on the network. If hosts
normally access a server at a particular IP address, it would not be good if that address
changed.
Dynamic
On local networks it is often the case that the user population changes frequently. New
users arrive with laptops and need a connection. Others have new workstations that need
to be connected. Rather than have the network administrator assign IP addresses for each
workstation, it is easier to have IP addresses assigned automatically. This is done using a
protocol known as Dynamic Host Configuration Protocol (DHCP).
Another benefit of DHCP is that an address is not permanently assigned to a host but is
only leased for a period of time. If the host is powered down or taken off the network, the
address is returned to the pool for reuse. This is especially helpful with mobile users that
come and go on a network.
If you enter a wireless hotspot at an airport or coffee shop, DHCP makes it possible for
you to access the Internet. As you enter the area, your laptop DHCP client contacts the
local DHCP server via a wireless connection. The DHCP server assigns an IP address to
your laptop.
Various types of devices can be DHCP servers as long as they are running DHCP service
software. With most medium to large networks, the DHCP server is usually a local
dedicated PC-based server.
With home networks the DHCP server is usually located at the ISP and a host on the
home network receives its IP configuration directly from the ISP.
Many home networks and small businesses use an integrated router to connect to the ISP
modem. In this case, the integrated router is both a DHCP client and a server. The
integrated router acts as a client to receive its IP configuration from the ISP and then acts
a DHCP server for internal hosts on the local network.
In addition to PC-based servers and integrated routers, other types of networking devices
such as dedicated routers can provide DHCP services to clients, although this is not as
common.
5.3.3 Configuring DHCP
When a host is first configured as a DHCP client, it does not have an IP address, subnet
mask or default gateway. It obtains this information from a DHCP server, either on the
local network or one located at the ISP. The DHCP server is configured with a range, or
pool, of IP addresses that can be assigned to DHCP clients.
A client that needs an IP address will send a DHCP Discover message which is a
broadcast with a destination IP address of 255.255.255.255 (32 ones) and a destination
MAC address of FF-FF-FF-FF-FF-FF (48 ones). All hosts on the network will receive
this broadcast DHCP frame, but only a DHCP server will reply. The server will respond
with a DHCP Offer, suggesting an IP address for the client. The host then sends a DHCP
Request to that server asking to use the suggested IP address. The server responds with a
DHCP Acknowledgment.
For most home and small business networks, a multi-function device provides DHCP
services to the local network clients. To configure a Linksys wireless router, access its
graphical web interface by opening the browser and entering the in the Address area the
router default IP address: 192.168.1.1. Navigate to the screen that shows the DHCP
configuration.
The IP address of 192.168.1.1 and subnet mask of 255.255.255.0 are the defaults for the
internal router interface. This is the default gateway for all hosts on the local network and
also the internal DHCP server IP address. Most Linksys wireless routers and other home
integrated routers have DHCP Server enabled by default.
On the DHCP configuration screen a default DHCP range is available or you can specify
a starting address for the DHCP range (do not use 192.168.1.1) and the number of
addresses to be assigned. The lease time can also be modified (default is 24 hours). The
DHCP configuration feature on most ISRs gives information about connected hosts and
IP addresses, their associated MAC address, and lease times.
The DHCP Client Table also shows the client name and whether it is connected via the
Ethernet LAN or wireless (Interface).
The router provides a gateway through which hosts on one network can communicate
with hosts on different networks. Each interface on a router is connected to a separate
network.
The IP address assigned to the interface identifies which local network is connected
directly to it.
Every host on a network must use the router as a gateway to other networks. Therefore,
each host must know the IP address of the router interface connected to the network
where the host is attached. This address is known as the default gateway address. It can
be either statically configured on the host, or received dynamically by DHCP.
When an integrated router is configured to be a DHCP server for the local network, it
automatically sends the correct interface IP address to the hosts as the default gateway
address. In this manner, all hosts on the network can use that IP address to forward
messages to hosts located at the ISP and get access to hosts on the Internet. Integrated
routers are usually set to be DHCP servers by default.
The IP address of that local router interface becomes the default gateway address for the
host configuration. The default gateway is provided, either statically or by DHCP.
When an integrated router is configured as a DHCP server, it provides its own internal IP
address as the default gateway to DHCP clients. It also provides them with their
respective IP address and subnet mask.
The integrated router acts as a DHCP server for all local hosts attached to it, either by
Ethernet cable or wirelessly. These local hosts are referred to as being located on an
internal, or inside, network. Most DHCP servers are configured to assign private
addresses to the hosts on the internal network, rather than Internet routable public
addresses. This ensures that, by default, the internal network is not directly accessible
from the Internet.
The default IP address configured on the local integrated router interface is usually a
private Class C address. Internal hosts must be assigned addresses within the same
network as the integrated router, either statically configured, or through DHCP. When
configured as a DHCP server, the integrated router provides addresses in this range. It
also provides the subnet mask information and its own interface IP address as the default
gateway.
Many ISPs also use DHCP servers to provide IP addresses to the Internet side of the
integrated router installed at their customer sites. The network assigned to the Internet
side of the integrated router is referred to as the external, or outside, network.
When an integrated router is connected to the ISP, it acts like a DHCP client to receive
the correct external network IP address for the Internet interface. ISPs usually provide an
Internet-routable address, which enables hosts connected to the integrated router to have
access to the Internet.
The integrated router serves as the boundary between the local internal network and the
external Internet.
There are several ways hosts can be connected to an ISP and the Internet. Whether or not
an individual host is assigned a public or private address depends on how it is connected.
Direct Connection
Some customers have just a single computer with a direct connection from the ISP
through a modem. In this case, the public address from the ISP DHCP server is assigned
to the single host.
When there is more than one host that needs access to the Internet, the ISP modem can be
attached directly to an integrated router instead of directly to a single computer. This
enables the creation of a home or small business network. The integrated router receives
the public address from the ISP. Internal hosts receive private addresses from the
integrated router.
Gateway devices combine an integrated router and a modem in one unit, and connect
directly to the ISP service. As with integrated routers, the gateway device receives a
public address from the ISP and internal PCs will receive private addresses from the
gateway device.
The integrated router receives a public address from the ISP, which allows it to send and
receive packets on the Internet. It, in turn, provides private addresses to local network
clients. Since private addresses are not allowed on the Internet, a process is needed for
translating private addresses into unique public addresses to allow local clients to
communicate on the Internet.
The process used to convert private addresses to Internet-routable addresses is called
Network Address Translation (NAT). With NAT, a private (local) source IP address is
translated to a public (global) address. The process is reversed for incoming packets. The
integrated router is able to translate many internal IP addresses to the same public
address, by using NAT.
Only packets destined for other networks need to be translated. These packets must pass
through the gateway, where the integrated router replaces the source host's private IP
address with its own public IP address.
Although each host on the internal network has a unique private IP address assigned to it,
the hosts must share the single Internet routable addressed assigned to the integrated
router.
5.5 Chapter Summary