- Latest articles
- Review: EKF Equipment
- Scada client-server (comparison)
- MODBUS TCP- ANYBUS – MODBUS RTU
- Communication between Falcon radar and Siemens controller
- iRidium Mobile iPad (authorization)
- Software implementation of a ramp function
- Fastwel + SNMP
- Formation LLC (OSNO)
- The main essence of the technical task
IP addressesSome clarifications on the types of IP addresses, masks and principles of exchange
In networks where Ethernet is used, there are 2 types of addresses: Local and Global addresses.
Local addresses are in link layer technology, they are tied to a specific technology, this can be MAC addresses in Ethernet, or IMEI in cellular networks. Such addresses cannot be used to build a large composite network that combines networks using different technologies. To do this, the open systems interaction model introduces a network layer, and it uses global addresses.
Global addresses are network layer addresses, and in the TCP/IP protocol stack, they are just IP addresses. Global addresses are not tied to link layer technology, and with their help you can build a network that combines subnets built on different link layer technologies. And transfer data from these networks to each other.
The kind of global addresses that we are looking at in this article are the IP addresses that are used in the TCP/IP protocol stack. and Internet networks. IP addresses are needed to uniquely identify computers in a large composite network, which may include the whole world, such as the Internet, and various parts of the Internet built on different link-layer technologies.
Now there are 2 versions of the IP protocol: IPv4 version and IPv6 version. The main difference between protocol versions is the length of the IP address. In IPv4, the address length is 4 bytes, and in IPv6, the address length is 16 bytes..
The length of an IPv4 address is 32 bits, 4 bytes. And to make it convenient for people to work with such IP addresses, they are divided into 4 parts.
IP addresses and IP networks
One of the tasks of the network layer is to provide scalability, to build a network that can work on a global scale. To do this, the network layer does not work with individual computers, but with subnets that unite many computers.
In IP, the association is as follows, a subnet is a certain number of computers that have the same high-order part of the IP address. In the example below, this address range has the same first 3 octets, and only the last octet is different.
And routers, devices that transmit information at the network level, no longer work with individual IP addresses, but with subnets.
IP address structure
Our IP address consists of 2 parts:
1. subnet number - high bits of the IP address.
2. computer number on the network (host) - low bits of the IP address.
Consider an example:
• IP address: The first three octets (220.127.116.11) are the network address. The last octet is the host address (3).
• We write the subnet address: 18.104.22.168• Host number: 3 (0.0.0.3).
How to find out by IP address which is the network address and which is the host address. This is done using the subnet mask. The mask, like the IP address, consists of 32 bits, and it is arranged as follows: where the network number is in the IP address, the mask contains 1, and where the host number is 0.
A detailed example is disassembled in the video at 4:50 minutes.
There are two ways to specify a subnet mask. Decimal representation as a prefix.
In decimal notation, the mask is written in a format similar to that of an IP address.
32 divided into 4 octets of 8 bits and each of these 8 bits converted to decimal notation, they are written with a dot.
The mask in decimal representation looks like this 255.255.255.0
Another format for writing a mask as a prefix. In this case, it indicates how many of the first bits of the IP address refer to the network address, and everything else is considered to refer to the host address.
The prefix is written with a slash (/).
22.214.171.124/24 means that the first 24 bits i.e. 3 octets refers to the network address and the last octet to the host address.
Both of these representations are equivalent. If we write the subnet mask in decimal form, or as a prefix, we get the same subnet address.
It is important to understand that the subnet mask does not have to end on an octet boundary. Although this is often done to make it convenient for people to work with such network and host addresses, it is not always convenient to do this. For example, if your network is large enough, then you can break it into several smaller parts. And for this you have to use masks of variable length, that's what subnet masks are called that do not end on an octet boundary.
Legacy IP address classes
Subnet masks are a modern way that allows you to determine where in the IP address is the subnet address and where is the host address. Previously used a different address based on IP address classes.Now this method is no longer used, it is outdated. However, on the Internet and books, you will surely come across a reminder of address classes, so we will look at how they were arranged.
The entire range of addresses was divided into several classes, in which the location of the network addresses and the host address were clearly specified. The class was determined by the first bits. There were 5 classes in total (A,B,C,D,E)
1. Class A which includes IP addresses that start with zero. In this class, it was hardcoded that the first octet refers to the subnet address. 3 remaining octets to host address.
2. Class B includes IP addresses that start with 10 in binary form, here the first 16 bits refer to the network address, and the last 16 bits refer to the host address.
3. Class C is the most common class of networks, this is the class in which IP addresses start with 110, 24 bits are allocated for the network number, 8 bits for the host number. This class is well suited for small networks with up to 254 computers.
4. There were 2 classes for special purpose addresses: Class D for group addresses.
5. And class E reserved range for future use.
Currently, multicast addresses are still allocated precisely from the range 126.96.36.199 - 188.8.131.52.And the reserved range is still unused 240.0.0.0. — 255.255.255.255.
If we consider IP addresses, IPv4 protocol, then we have 3 types of addresses:
• Individual - computer address
• Group - address of several computers
• Broadcast - address for all computers on the network, not the entire Internet.
IP addresses must be unique throughout the world, so you cannot use any IP address, you must obtain permission to use it.
This is handled by the ICANN Internet Corporation for the allocation of names and numbers, so you need to contact them.
If you are building a network that is not connected to the Internet, you can use any IP address from the range of private IP addresses.
It is important to understand that IPv4 addresses are almost over, and you need to switch to the IPv6 version of the protocol, or use NAT technology to connect to the Internet.
Types of IP addresses
IPv4 uses 3 types of addresses:
1. Individual (unicast);
2. Group (multicast);
• An individual address is the address of a specific computer, these are the addresses we considered above..
• A multicast address is an address that is shared by multiple PCs. If you send data to this address, it will be received by several computers on the network that are part of this group.
• The broadcast address is the address that is used by all computers on the network to receive data.
The broadcast address in IP has the following format:
• IP address: 184.108.40.206/24
• Broadcast address: 220.127.116.11
The part that refers to the network address remains unchanged, and the part that refers to the host address is written in bit units.
We have already seen broadcast addresses in Ethernet link layer technology. An important difference with broadcast addresses in the network layer is that broadcast addresses are used only within limits within the same subnet.
Routers do not forward broadcast packets to another network, otherwise you can very quickly flood the entire global network, including the entire Internet, with garbage broadcast packets.
IP uses two types of broadcast addresses suitable for two different scenarios
Suppose we have 2 subnets connected by a router. If we want to send a broadcast packet within the same network, this is called a limited broadcast. In this case, we can use a special broadcast address that consists of all bit ones (255.255.255.255). In this case, all computers on the network will receive the data, and the data will not pass through the router.
Another scenario where a computer that is outside of our network wants to broadcast a packet to all computers that are on our network is called directed broadcast. In this case, the broadcast IP address would be 192.168.0.255, the address of the subnet we want to send the broadcast packet to, and the bit ones in the host address part. How will such a package be processed?
The packet is sent to the router and the router will already broadcast this packet, but only in transmissions of one subnet for which this broadcast packet is intended.
Special types of IP addresses
What are the special types of IP addresses:
You cannot use only bit 0s in a host number, and only bit 1s.
If we specify only bit 0s, then this will not be a host address, but a subnet address of 18.104.22.168.
And if we specify only bit 1, then this will be the broadcast address.
Often, the default router on a network, or the gateway through which all computers on a network access the Internet, is assigned address number 1.Однако четких правил нет, так делать не обязательно 22.214.171.124.
The address which consists of all 0.0.0.0 is the address of the current host. It is used when the computer has not yet received its IP address.
An all-bit-one address, 255.255.255.255 is all hosts on the current subnet (limited broadcast address).
127.0.0.0/8 is a loopback, a special address range that is allocated to debug network applications, if you do not have network equipment or it is not configured as you need, in this case the data is not sent to the network, but comes back to a computer. Often the address 127.0.0.1 is used from this network, this is the current computer (localhost). However, it is not necessary to use an address with host 1 for this purpose, you can use 2, 3 or any other IP address from this range.
IP addresses from subnet 169.254.0.0/16 are called Link-local addresses.
If you have not configured the IP address on your PC manually or in some other way, for example, using the DHCP protocol, then the operating system itself can assign an address from this range to the computer. Such addresses can only be used within a subnet and do not go through a router.
Distribution of IP addresses
Since IP addresses are global addresses and are used to build networks that can potentially connect all computers in the world such as the Internet, each computer must have a unique IP address throughout the world.
If we have several computers with the same IP address, then we will not be able to understand to which computer our data should be sent. To ensure the uniqueness of addresses on the Internet, there is a special approach, you cannot take any IP addresses you want, but you must obtain permission to use the IP address from the Internet Assigned Number Authority (IANA), now IANA functions are implemented by ICANN (Internet Corporation for Assigned Names and Numbers - The Internet Corporation for the distribution of names and numbers. It is this organization that is responsible for allocating IP addresses worldwide.
However, the organization does not do this directly, but with the help of regional registrars. Each region has its own registrar that interacts with ICANN and allocates IP addresses. Russia and Europe belongs to the regional registrar RIPE.
However, there are cases where you create a network that uses IP addresses but is not connected to the Internet.
For example, the internal network of an organization or the internal network of a class, in which you simply test some network technologies.
It would be very inconvenient to contact the regional registrar to ask for IP addresses for such a network.
There are several ranges of private IP addresses specifically for this case, these are IP addresses that can be used on subnets that are not connected to the Internet.
There is no need to contact ICANN to obtain an IP address. The range of private IP addresses is defined in RFC 1918 and includes the following:
These addresses are unique in that they are not routable to the Internet. However, it is possible to connect a network built on the basis of private addresses to the Internet, for this the NAT (Network Address Translation) technology is used. In this case, the address from the private subnet is replaced by the real IP address.
Exhaustion of IP addresses
For a long time there has been a problem of running out of IP addresses.
The length of the IP address is 32 bits, which means that the maximum number of IP addresses is slightly more than 4 billion, and this was enough when TCP / IP networks were designed, but now, due to the fact that the Internet has become so widespread, 4 billion IP addresses for the whole world was not enough. Now almost now, IPv4 addresses have already been allocated, if you want to connect to the Internet and get an IPv4 address, then you are unlikely to be able to do this.
How can I solve the problem of running out of ip addresses?
There are 2 ways:
1. The fundamental solution is to use the IPv6 protocol, where the length of the IP address is 16 bytes, with such a length there are enough addresses to provide the whole world.
2. Temporary technology Network Address Translation (NAT), while you are building a network in which you use private addresses, this network can have a large number of computers, and in order to connect to the Internet you need only one external IP address.
Article based on Youtube video