How your router assigns private IPs to devices?

When we start surfing the Internet it seems like a very simple task. However, it is a more complex task than it seems. That all the tasks are carried out normally and without problems depends, without a doubt, on our router. The process begins when our router assigns us a private IP or we establish it manually. If an error occurs in the assignment of a private IP, we will have problems. Either because it does not correspond to the network range of our router or they are duplicated, if either of the two occurs, a failure will occur. Normally there are no problems because it is done automatically. In this article we are going to see how your router assigns local IPs.

How your router assigns private IPs to devices

The first thing we are going to do is talk about what a private IP is and how it differs from a public one. Once we are clear about these concepts, we will talk about DHCP and we will also be able to do a practical example by entering its configuration via the web.

What is a private IP and how is it different from a public one?

The IP address can be defined as a logical and unique identifier for each of the computers connected to a network. Those of our home networks are IPv4, and when going out to the Internet with our router we have to distinguish between a private IP and a public IP. The public IP could be defined as the identifier of our network facing the Internet. An important difference with a local one is that we cannot put the one we want and it will be our Internet provider who assigns it. For example, a simple way to find out is through the web what is my IP.

On the other hand , private or local IP addresses are those that identify each of the devices connected to our local network that are behind the NAT. Thus, normally the router automatically assigns local IPs to our devices thanks to the DHCP server. Normally the most used network ranges in home routers are usually 192.168.1.X and 192.168.0.X.

How the router assigns private IPs

It will do this using the DHCP protocol which is also known as Dynamic Host Configuration Protocol. We find a network protocol of client and server type that is responsible for dynamically assigning:

  • An IP address.
  • The subnet mask.
  • A default gateway.
  • Other configuration parameters in which the DNS servers could be included.

The DHCP server will have a range of private IP addresses that it can provide to different users. In the order that the clients connect, the router normally assigns the private IPs sequentially, although it can also assign them based on an internal algorithm that depends on the router’s MAC.

We must also talk about static DHCP with which we could always assign a private IP to the same computer. For example, in a network range where the gateway of our router is 192.168.1.1, always assign the local IP 192.168.1.14 to a PC. This is very useful when you have open ports on the router to use certain programs such as P2P or to set up a server of some kind. The other mapping option would be configuring Windows TCP/IP.

Practical example of the DHCP server of a router

The first thing we have to do if we want to configure the router’s DHCP server is to access it via the web. To do this from an Internet browser we put our default gateway and access it by putting our username and password. The section concerning DHCP may vary depending on the manufacturer. A very common typical one where it is usually located is in LAN or Local Network . This is an example of the router we are using:

Here we could do several things:

  1. Change the IP of the router with which our network range would change. Right now it’s at 192.168.1.1 but we could move it to 192.168.0.1.
  2. Set the limit of the local IPs that we can use. Choosing which will be the first to assign until the last.
  3. Put limits on the IPs of our guest network.

Normally, if you don’t know what you are doing, it is better to leave it as it comes by default. Before touching anything, you have to see if it can affect a local IP to which you have open ports.

Finally, we have already seen how the router assigns local IPs, but you may be interested in knowing the advantages and disadvantages of deactivating the DHCP server.