How Does a Device Get Its IP Address
How Does a Device Get Its IP Address
Introduction
Now that you know devices need IP addresses to communicate over a network, you
might wonder how it works when your phone connects to the gym or a coffee shop
Wi-Fi. Not so long ago, it would've required network administrators to configure
each client's phone physically. That isn't very practical, right?
Earlier, you learned how to identify your own IP address, but how did your device
acquire this address? In this reading, you will learn about two different methods of
IP address assignment: static and dynamic IP address assignment. By the end of
this reading, you will be able to describe the difference between dynamic and static
IP address assignment and identify when it's suitable for a network. You will also
explore the difference between public and private IP addresses and why and when
devices get assigned to either of them.
Static IP address assignment
You know that IP addresses are used to identify devices on a network and that
subnet masks help determine whether a device is on the same or a different subnet
compared to the sender's device. You also learned that a network needs an IP
default gateway for devices to find the nearest router to route IP packets between
networks. All of this addressing needs to be configured on the network devices.
One way of doing it is to manually configure static IPv4 configurations for each
network's devices. When you perform IPv4 configuration, you must configure the
following:
IPv4 address
Subnet mask
Default gateway
Static configuration requires that you physically visit each device and input the IPv4
configuration. For the current size of Sam's network, a static configuration is a
reasonable solution. But if a network has ten or more devices, this address
configuration method is time-consuming and increases the risk of mistakes. This
method is better for devices that are physically connected by a cable on your
network and are unlikely to move. Once configured, devices like a printer or a
server won't need reconfiguration. Fortunately, there is an alternative method,
dynamic IP address assignment.
Dynamic IP address assignment
The great thing about dynamic IP address assignment is that it automatically
configures IP address information for network devices. This is a much better solution
for devices that move around the network, especially those connected to Wi-Fi, as
these are typically devices that disconnect and reconnect to a network at different
times. User devices like laptops and mobile phones are much better suited to
dynamic assignment, and you save time by not having to configure them. As Sam's
business grows, this will be a better solution when they have many devices on their
network that are used by employees moving around.
Just think of the thousands of smartphones and laptops on large-scale company
networks. Static IP address assignment simply isn't practical for organizations of
this size with moving devices. Dynamic IP address assignment is accomplished by
using a protocol called Dynamic Host Configuration Protocol (DHCP), and you will
learn more about this protocol later.
Public and private IP addresses
Let's now discuss public and private IP address assignment. You might have noticed
that the same IP addresses are often used on local networks. For instance, when
you purchase a router, all the routers in the shop might have the same IP address
printed on the back. Well, remember how quickly the number of available IPv4
addresses was exhausted? A clever solution to reduce the number of IPv4 addresses
in use was the introduction of public and private IP addresses.
The idea is to keep internet (public) addresses separate from a group of addresses
that can be used repeatedly on a company's private network. This made millions of
IPv4 addresses available again. These private addresses can be assigned
dynamically or statically, but they do not appear on the internet. And that's also
where the network types you've learned about earlier come in.
Three IP address ranges have been determined for the three classes of IPv4
addresses, demonstrated in the table below.
A Large 10.0.0.0-10.255.255.255
So, when network administrators set up Sam's network, they will use the
192.168.0.0 range since it's still a very small network.
Public IP addresses are only needed when you connect to the internet and are
globally unique. These are typically assigned dynamically by an internet service
provider (ISP) to give you an internet connection. It cannot use any of the private
addresses in the ranges described above, as these are not unique.
Translating these private addresses to public only occurs when an internet
connection is introduced to a network. A router takes care of address translation
using network address translation (NAT). For more information on network address
translation, check out the additional resources at the end of the lesson.
Conclusion
Giving IP addresses to devices is important in allowing communication across a
network. Static IP address assignment can be time-consuming, but on a small
network with just a few devices like Sam's network, it can still work well. Static IP
assignment is predominantly used for IP configuration of non-moving network
devices like printers. Dynamic assignment, however, has long been the easiest way
of automatically addressing a network. It's used increasingly today, even in small
home networks where routers perform the dynamic address assignment function.
Whether assigned statically or dynamically, private IP addresses are for local
networks, and the same IPv4 addresses are reused on many local networks. Public
IP addresses are only needed when connecting a network to the internet.