DEV Community

Cover image for Computer networking in 5 minutes: Static IP vs dynamic IP
Erin Schaffer for Educative

Posted on • Updated on • Originally published at educative.io

Computer networking in 5 minutes: Static IP vs dynamic IP

IP addresses are an essential part of computer networking. They play an important role in sending and receiving information on the internet. Every device that connects to an internet network has an IP address, which means there are billions of IP addresses that exist. Today, we’re going to discuss IP addresses, how they work, static IP vs dynamic IP, and more.

We'll cover:

What is an IP address?

An Internet Protocol address, or IP address, is a unique identifier assigned to every device on a TCP/IP network. The Internet Protocol is the set of rules that outlines how data should be transported across the internet or local networks. IP addresses help identify devices and allow them to communicate with each other.

Internally, IP addresses are stored as numbers. The Domain Name System (DNS) allows us to use words to identify different servers on the internet, such as an application, server, or website. When we type a URL into our search bar, DNS looks up that domain’s IP address and returns it to our network device. There are two main versions of IP addresses: IPv4 and IPv6.

IP addresses are strings of four numbers separated by characters. For example, an IP address could look like this: 152.132.4.23. They’re produced by a division of the Internet Corporation for Assigned Names and Numbers to help make the internet more secure and accessible.

We can think of IP addresses as physical home addresses. We can exchange addresses with friends and family. Those addresses give us a destination that allows us to communicate with friends and family through different communication methods like birthday cards, letters, and more.

How does an IP address work?

All devices communicate with one another using the Internet Protocol (IP). Here’s how it works:

Before our devices connect to the internet, they connect to a network that’s connected to the internet. This network gives us access to the internet. For example, the network that we use at home will most likely be our Internet Service Provider (ISP). After this, our ISP will assign an IP address to our device. Our internet activity will go through the ISP and then be routed back to us using our assigned IP address.

If we leave our home and take our personal device with us, our IP address from our home network doesn’t come with us. Let’s say we go to a hotel. When we want to use the internet at the hotel, we’d probably connect to their Wi-Fi network. Since we’re using a new network, we’re temporarily assigned a new IP address. This temporary IP address is assigned to us by the hotel’s ISP.

Can our IP addresses change?

Yes, they can! If we turn our modem or router off, our IP address may change. We can also contact our ISP to change our IP address. This is one of the reasons why DNS is so important. Instead of directly informing others when our IP address changes, we can directly inform our DNS server. This means that any other device that contacts the DNS server will get the updated information for the new IP address.

Static IP addresses

A static IP address is an IP address that doesn’t change. Our static IP addresses usually stay the same unless our network architecture changes or our devices are out of commission. Static IP addresses are typically used for servers or other important networking equipment. They’re popular within business settings because they ensure that the devices connected to them keep a consistent address. They also work well for remote access solutions.

A static IP address is assigned to a device by an ISP. Typically, static IP addresses add to the cost of your internet service.

Dynamic IP addresses

A dynamic IP address is an IP address that can regularly change. An ISP will buy a large number of dynamic IP addresses and assign them to their customer’s devices. Dynamic IP addresses are often reassigned. Reassigning IP addresses helps internet providers save money and ensure a higher level of security. It also means that they don’t need to take the time to reestablish any network connections if we go on a vacation or move to a new location.

Dynamic IP addresses are more common for consumer equipment and personal use. A dynamic IP address is assigned to a device by our ISP’s Dynamic Host Configuration Protocol (DHCP) servers. The DHCP server typically uses network routers to assign addresses to devices.

Static IP vs dynamic IP

There’s not always a clear answer when it comes to deciding between a static or a dynamic IP address. When choosing between the two, it’s important to consider your connection environment. In other words, static IP addresses tend to be better for businesses, while dynamic IP addresses tend to be better for personal or home networks.

Let’s take a look at some of the pros and cons of static and dynamic IP addresses:

Static IP addresses

Pros

  • Remote access: Static IP addresses make it easy for us to work remotely using a Virtual Private Network (VPN).

  • Server hosting: Static IP addresses make it easy for people to find us using DNS.

  • DNS support: With static IP, it’s easier to manage DNS servers.

  • Geolocation services: With static IP addresses, our geolocation services are more accurate. This is because our services will match the IP address to its physical location.

  • Reliable connection: A static IP address is fixed, which typically results in a more reliable connection.

  • Easy to find: A static IP address can make it easier to find specific devices on a network.

Cons

  • Security concerns: With a static IP address, anyone with the proper tools can find where our devices are located. VPNs can help with this.

  • Cost: Static IP addresses are not as cost-effective as dynamic IP addresses. Typically, ISPs charge more for them.

Dynamic IP addresses

Pros

  • Easy configuration: DHCP servers automatically assign IP addresses to our devices, so we don’t need to worry about setting it up ourselves.

  • Cost: Dynamic IP addresses are usually cheaper than static IP addresses.

  • Unlimited IP addresses: Dynamic IP addresses can be reused. Whenever our devices need a new dynamic IP address, our network or router can automatically configure them for us.

  • Security: Dynamic IP addresses make it more difficult for potential attackers to locate our networked devices. This is because dynamic IP addresses can change frequently, so it’s harder to track a device. This helps with physical and online security. We can also increase our security measures by using a VPN.

Cons

  • DNS compatibility: If we wanted to host an email server, for example, it may be difficult to use a dynamic IP address because DNS doesn’t work well with dynamic IP addresses. We could use a dynamic DNS service, but those tend to be expensive.

  • Remote connectivity: If we don’t have the proper remote access software, it’ll be difficult to connect using a dynamic IP address. A VPN can help with this.

  • Increased downtime: Sometimes, our ISP can’t assign us a dynamic IP address. This can slow down our internet connection.

  • Inaccurate geolocation: Dynamic IP addresses may affect our geolocation services because our IP address may not reflect our physical location.

Wrapping up and next steps

Today, we took a closer look at IP addresses and discussed what they are and how they work. IP addresses are an important part of computing networking because they allow our devices to properly communicate with other devices. Static and dynamic IP addresses are the two types of IP addresses with different purposes. It’s often said that static IP addresses are better for businesses, and dynamic IP addresses are better for personal use.

We covered a lot today, but there’s still so much more to learn! Some recommended topics to cover next include:

  • DNS servers
  • Network addresses
  • Firewalls
  • Routing in IP

To get started learning these concepts and a lot more, check out Educative’s course Grokking Computer Networking for Software Engineers. This hands-on course will teach you the fundamentals of networks, socket programming in Python, command-line tools, and much more. By the end, you’ll have a deeper understanding of computer networking essentials.

Happy learning!

Continue reading about networking

Oldest comments (0)