Quick Links
Summary
Dynamic IP addresses are allocated by your router and subject to change while static IP addresses are manually configured and never change. For most cases, dynamic IP addressing is perfectly adequate. A static IP address is useful, though, if you want to access your home network remotely.
Dynamic IP addresses are set automatically, but liable to change each time your computer boots up. Static IP addresses need manual configuration, but always survive reboots. Is one better than the other?

What Is an IP Address?
AnIP addressis a numerical label that identifies each device on a network. Networking protocols use the address of each device to deliver network traffic to them. The most commonly used networking protocol is TCP/IP (transmission control protocol/internet protocol). This is where the “IP” in “IP address” comes from.
Each IP address must be unique. When two devices communicate across a network, data is transmitted by one device and received by the other. In an on-going two-way “conversation”, this is repeated back and forth between the two devices for as long as they need to communicate.
The data is broken down into manageable chunks, calledpackets, which are sent as a sequence of short transmissions. Each packet is labeled withmetadata. The metadata contains information like the size of the packet, the total number of packets in the transmission, and the number of the packet in the sequence.
This allows the data to be reconstructed when it has been received, and it allowsmissing packetsto be identified.
Of course, each packet needs to be labeled with the IP address of the destination device so that the network switches androutersknow where to send them. The IP address of the sending device is included too, so that the receiving device knows who to reply to, or to request that missing packets be resent.
IP Version 4 and IP Version 6
There are two IP standards in use. One is the older and much more commonIP version 4or IPv4, and the other is the newerIP version 6, or IPv6.
IPv6 was designed to overcome the problem of the world running out of IPv4 addresses. As the number of connected devices rises, the pool of available IPv4 addresses dwindles. The IPv6 standard raises the number of possible addresses by a massive order of magnitude.
An IPv4 address uses 32 bits to describe the entire address, giving 8 bits to each of four numbers that can range from 0 to 255. IPv4 IP addresses look like this:
An IPv6 address uses 128 bits to describe the address, allocating 16 bits to each of 8 hexadecimal numbers that can range from 0x0 to 0xFFFF (65535). A full IPv6 address looks like this:
IPv6 addresses can be written with leading zeroes removed.
Once per address, a sequence of consecutive zeroes can be omitted.
IPv4 isstill the most commonly used format.
Internal IP Addresses
Every networked device, whether using a wired connection orWi-Fi, has an IP address. Because they’re used to direct network traffic to the correct recipient devices, they must be unique within their own networks. Two (or more) devices with the same IP address will cause problems with failed transmissions and lost packets.
Internal IP addresses are used to identify devices and to route network traffic in local networks. They’re not visible to computers in other, external networks such as the internet.
When a computer on a private, local network wants to connect to a remote computer such as a web server, it sends its connection request to its local router. The router communicates across the internet on the local computer’s behalf. It brokers the bi-directional communication between the local computer with its private, internal IP address, and the remote server.
What Is a Dynamic IP Address?
A dynamic IP address is one that’s automatically assigned to a device by a router. Computers and laptops aren’t manufactured with IP addresses baked into them. They need to be given an IP address when they’re connected to a network. On large networks this is a tedious task. Some network hardware such as routers have a default IP address of 192.168.1.1 so that they match typical private network settings, but these can be changed if they don’t match your network.
What is burned into every network device, however, is a MAC (media access control) address. MAC addresses are unique, globally.
Network routers maintaina list of MAC addresses and IP addresses. They look up the destination IP address of each packet, find the MAC address, and send the packet to that hardware.
Instead of requiring each device to be manually configured with an IP address, dynamic IP addressing automates manages the process of allocating IP addresses to network devices. The DHCP (dynamic host configuration protocol) makes this automation possible.
In a DHCP-enabled network, a device joining the network sends aDHCPDISCOVERsignal out on the network. The DHCP server — on home networks this is usually inside your router — responds with aDHCPOFFERmessage. This offers an IP address the device could use, and other information about the network.
If the device wants to use that IP address, it sends aDHCPREQUESTsignal to the DHCP server. The DHCP server responds with aDHCPACKsignal, verifying the IP address and other settings that the device should use.
Dynamic IP Addresses Can Change
In that way, the device automatically gets an IP address and all the information it needs to connect to — and communicate across — the network. However, it only gets the IP address on a lease. It isn’t assigned to it permanently. If the device wants to keep the IP address, it must periodically make a request torenew the lease. The lease period is part of the information included in theDHCPOFFERmessage.
Usually, there’s no problem in the device being reallocated the same IP address. But if a device is turned off and cannot make a lease renewal request before the lease expires — for home networks the lease period is often set to 12 hours — the IP address is free to be allocated to a different device. The device that was using that IP address previously is given a different IP address when it is restarted.
We can use thedhclientcommand with the-v(verbose) option to see some of the communication between your Linux computer and your DHCP server.
We’re told the MAC address that the computer is listening and sending on, and we can see theDHCPREQUESTandDHCPACKmessages.
External IP Addresses
Networks that connect to the internet have an IP address allocated to them by their ISP (internet service provider), known as an external IP address. This is the IP address that the network displays to the internet, so they’re also called public IP addresses.
Because your router acts a bridge between your private network and the internet, it needs an internal IP address so it is accessible to the devices on your network, and an external IP address so that it can communicate with your ISP’s equipment. All of your internet traffic goes through this external IP address.
Your internal IP addresses are likely to start with 10, 172, or 192. External IP addresses can use (practically) all the other values.
Loosely similar to the function of a DHCP list in your private network, the internet’s DNS (Domain Name Service) translates domain names and URLs to IP addresses, directing internet traffic to the correct (external) IP addresses.
What Is a Static IP Address?
A static IP address is an IP address that never changes and is unaffected by tools like DHCP. A device with static IP addressing retains its IP address no matter how often it’s rebooted or how long it’s offline.
Static vs. Dynamic IP Addressing
There’s an obvious convenience to using DHCP to automatically allocate IP addresses. The drawback with DHCP is the leasing of IP addresses. You cannot guarantee that a computer — or any other network device — will get the same IP address if it is restarted after being offline.
Most of the time, that won’t matter. As long as your devices are connected and operational on the network, and can get to the internet, that’s usually all that we need. But sometimes you’ll have applications that need to talk between computers, or devices such as a NAS (network attached storage) or media center that work best with fixed, static IP addresses.
It’s perfectly acceptable, and quite common, for a network to use a mixture of DHCP and static IP addressing. DHCP is used to simplify the allocation of IP addresses to the majority of devices, and static IP addressing is used for the special cases.
How to Set an Internal Static IP Address
Setting a static IP address in Ubuntuis fairly straightforward. The first step is to make sure you’re selecting and configuring an IP address that isn’t already in use by another device. you may usethepingcommandto check that.
Once you’ve selected your IP address, you can use thencmli con addcommand to add a connection, and thenmcli con modcommand to set it to static IP addressing. We’ve got a detailed step-by-step tutorial that walks you through the process. It covers a GUI method too, if you prefer to avoid the command line.
You canuse static IP addresses on Windows 10 and 11 computerstoo, and of course we’ve got guidance for you on that.
If you use containers such as Docker, you can assign static IP addresses to yourcontainerized computers.
How to Get an External Static IP Address
Without a static external IP address, your router’s external IP address is liable to change if it reboots. In almost all cases, this really doesn’t matter. But if you have self-hosted services that you need toreach when you’re out and about, an external static IP address is a must.
Your external IP address is provided by your ISP, and they’re the only ones who can change the settings on it. For a small additional charge, your ISP should be able to allocate an external static IP address to you.
you may use an external static IP address to remotely access your router and the private network behind it, because you’ll always know what your external IP address is. Domain names are easier to remember and share with others. You couldbuy a domain nameand have it point to your external static IP address.
Another way to obtain the same effect is to useDDNS (Dynamic Domain Name System) routing. With this setup, you configure your router to contact your DDNS provider each time it boots or gets a new external IP address.
The DDNS provider updates the domain name entry for your domain so that it points to the new external IP address. All connection requests that come into your domain name are routed to your current external IP address.
Usually, Dynamic Is All You Need
Unless you have specialist cases, dynamic internal and external IP addresses are all that is required. As long as your devices have unique addresses — and DHCP will look after that for you — you’ll have nothing to worry about.
If you need to guarantee that a computer or other device on your local network always has the same IP address, configure it with a internal static IP address.
If you need to be able to remotely access your network, either pay your ISP for an external static IP address, or use a DDNS service.