All devices connected to a network, including computers, tablets, cameras, ... and other devices need a unique identifier for recognition and to determine how other devices can access it. In the TCP/IP network world, that identifier is called an IP address (Internet Protocol).
How does an IP address function?
Why bother with IP addresses? Knowing how IP addresses work can help you troubleshoot network issues like misbehaving networks or devices unable to connect properly. And if you need to set up something more advanced like a game hosting server or a media server for Internet users to connect to, ... you'll need to know IP addresses.
Note: In the following article, Mytour will cover the basics of IP addresses rather than delving into advanced topics such as IP address classes, classless routing, custom subnets, ... so you can understand how IP addresses work in the simplest way possible.
1. What is an IP address?
An IP address uniquely identifies a device on a network. An example of this is 192.168.1.34.
An IP address consists of a set of four numbers as shown above. Each number can range from 0 to 255. So the full range of IP addresses lies within the range from 0.0.0.0 to 255.255.255.255.
The reason each number can only reach the limit of 255 is because they are essentially an eight-digit binary number (also known as an octet). In an octet, the number 0 is 00000000, while the number 255 is 11111111, the maximum number an octet can reach. The IP address that Mytour mentioned above, 192.168.1.34, in binary would be as follows: 11000000.10101000.00000001.00100010.
Computers deal with binary format, but we can work more easily with decimal format. However, knowing that an IP address is actually a binary number will help us understand how IP addresses work.
2 parts of an IP address
The IP address of a device consists of two distinct parts:
- Network ID: The Network ID is a part of the IP address that starts from the left, identifying the specific network the device is on. A typical example is a home network, where a device with an IP address of 192.168.1.34 would have the Network ID of 192.168.1. You can add a zero to the missing last part, hence, and understand the Network ID of this device to be 192.168.1.0.
- Host ID: The Host ID is a part of the IP address not taken by the Network ID. It identifies a specific device on that network (in the TCP/IP world also called hosts). Continuing with the example IP address 192.168.1.34, the host ID is 34, which is the unique identifier of the host on the network 192.168.1.0.
In a home network, you might see some devices with IP addresses like 192.168.1.1, 192.168.1.2, 192.168.1.30, and 192.168.1.34. All of these devices are unique (with Host IDs being 1, 2, 30, and 34 respectively) on the same network (with Network ID being 192.168.1.0).
To better visualize Network ID and Host ID, Mytour will provide an example for easier understanding. An IP address is similar to street addresses in a city. Suppose the number 203, Xuân Thủy Street, then the street name is like the Network ID while the number 203 is like the Host ID.
In a city, two streets are never named the same, similarly, two Network IDs on the same network are never named the same. On a specific street, the house number is unique, similar to the Host ID on a specific Network ID being unique.
3. Subnet Mask
Your device will have to determine which part of the IP address is the Network ID and which part is the Host ID. So, it will have to use the second number you always see associated with the IP address, that number is called the subnet mask.
On most simple networks (like home networks or small business networks), you'll see subnet masks in the form of 255.255.255.0, where all 4 numbers are either 255 or 0. The position changes from 255 to 0 indicate the division between Network and Host ID.
Note: The basic subnet masks described here by Mytour are default subnet masks. However, users often use custom subnet masks (changing the positions between 0s and non-zero numbers in an octet) to create multiple subnetworks on the same network.
4. Default Gateway Address
In addition to the corresponding IP address and subnet mask, you'll find the default gateway address listed alongside the IP information. Depending on the platform you're using, this address may have different names. Sometimes it's also referred to as a router or router address, default route, or gateway. They all mean the same thing. It's the default IP address that a device sends network data to when that data is aimed at a different network (one with a different Network ID) than the device is on.
Take, for example, a simple home network. If your home network has multiple devices, you may use a router to connect to the Internet through a modem. The router can be a standalone device or part of a combined modem/router unit provided by your internet service provider. The router sits between your computer and devices on your network and other public devices on the Internet, routing traffic back and forth.
Suppose you open any browser on your computer and access Mytour. Your computer will send a request to the IP address of the Mytour website. Because the servers are on the Internet rather than on the home network, that traffic goes from your computer to the router (gateway port), and your router sends the request to the website's servers. The servers send the correct information back to your router, which then forwards the information to the requesting device, and you'll see the Mytour website displayed on your browser window.
Typically, routers are configured by default to obtain a private IP address (an IP address on the local network) as the first Host ID. So, on a home network with a Network ID of 192.168.1.0, the router's address is usually 192.168.1.1. Of course, you can configure that address to be a different one if desired.
5. DNS Server
The last piece of information assigned that you'll see alongside the IP address, subnet mask, and default gateway address of a device is the address of one or more default DNS (Domain Name System) servers. Users prefer using domain names over IP addresses. Typing Mytour into the browser's address bar is much easier than remembering and typing in the IP address of the website.
DNS functions like a phone book, looking up things that users can read, such as website names, and converting them into IP addresses. DNS accomplishes this by storing all DNS server information on a system across the Internet. Your device needs to know the address of the DNS server to send queries.
On a small network or home network, the IP address of the DNS server is often the same as the default gateway address. Devices send DNS queries to your router, which then forwards requests to any DNS servers configured for use.
By default, these are usually DNS servers provided by the Internet service provider, but you can change them to other DNS servers to use. Sometimes you might use third-party DNS servers provided by companies like Google or OpenDNS.
6. Understanding the Differences Between IPv4 and IPv6
As you navigate through settings, you'll also notice another type of IP address called IPv6. The IP address type we've been using so far is IPv4 - a protocol developed in the late 1970s. It uses 32-bit binary (in four octets) to provide a total of 4.29 billion unique addresses.
While this number may seem substantial, all publicly available addresses have long been assigned to businesses. Many of them are not in use, but they are designated and not available for other general purposes.
In the mid-1990s, concerns about IP address exhaustion led to the design of IPv6 by the IETF. IPv6 uses 128-bit addresses instead of the 32-bit addresses used by IPv4. Therefore, the total number of unique addresses is measured in undecillions, which is a sufficiently large number that will never be exhausted.
Unlike the decimal notation used in IPv4, IPv6 addresses are represented in groups of eight numbers, separated by colons. Each group consists of four hexadecimal digits representing 16 binary digits (hence, it's called a hextet). A typical IPv6 address would look like the following:
You can refer to the article Comparing IPv4 and IPv6 on PC to gain a better understanding of these two IP versions.
2601:7c1:100:ef69:b5ed:ed57:dbc0:2c1e
The issue of IPv4 address exhaustion has finally been addressed. More and more users are creating their own networks, using private IP addresses that are not publicly disclosed.
7. How do devices receive IP addresses?
Once you've grasped the basic understanding of how IP addresses function, all you need to know now is how devices receive IP addresses. Essentially, there are two types of IP addresses: dynamic IP and static IP.
Dynamic IP addresses are assigned automatically when a device connects to a network. Most networks (including home networks) use the Dynamic Host Configuration Protocol (DHCP) to accomplish this. When a device connects to the network, it sends a message requesting an IP address. DHCP intercepts this message, then assigns an IP address to that device from a pool of available IP addresses.
There are some private IP addresses that routers (gateways) will use for this purpose. These IP addresses are used depending on the router manufacturer, or how you set everything up. This range of private IP addresses includes:
- 10.0.0.0 - 10.255.255.255: If you're a Comcast/Xfinity customer, the router provided by your Internet Service Provider (ISP) will assign addresses within this range. Some other ISPs also use these addresses on their routers, Apple also uses these addresses on their AirPort routers.
- 192.168.0.0 - 192.168.255.255: Most commercial routers are set up to assign IP addresses within this range. For example, most Linksys routers use the address 192.168.1.0, while D-Link and Netgear both use the address range 198.168.0.0.
- 172.16.0.0 - 172.16.255.255: This address range is seldom used by Internet Service Providers by default.
- 169.254.0.0 - 169.254.255.255: This special address range is used by a protocol called Automatic Private IP Addressing. If your computer (or other device) is set to obtain an IP address automatically but can't find a DHCP server, it will self-assign an IP address within this range. Seeing one of these addresses means your device couldn't access the DHCP server and you might have network issues or trouble with your router.
Dynamic addresses are ones that can change. DHCP servers assign IP addresses to devices, and when leases expire, devices must renew their leases. Sometimes, devices may receive a different IP address from the range that the server can allocate.
In most cases, this isn't a big issue, and everything will work. However, in some cases, you may want to provide a device with a static IP address. For example, if you need to access a device manually and find the IP address easier to remember than the name, or if certain applications can only connect to devices using their IP addresses. To check the IP address on your machine, you can use various methods like using the command prompt or third-party software.
In these cases, you can assign a static IP address to those devices. There are several ways to do this. You can manually configure the device with a static IP address. Or another solution is to configure the router to assign static IP addresses to specific devices that the DHCP server assigns dynamic IP addresses to. That way, the IP address never changes, but it doesn't disrupt the DHCP process.
Here, Mytour has provided you with some information about IP addresses and how they work. Hopefully, this article will provide you with useful information.