In 1969, only four nodes of the ARPA network were successfully tested in the United States. Could anyone think that the evolved Internet would become the world's largest data network. With the popularization of computers and the increasing number of Internet users, more and more enterprises are focusing on the Internet. IP technology is the key to supporting the operation of the Internet. The basic concepts and IP address addressing process are described in detail here.
MAC address (on the data link layer)
The Media Access Control Address is generally located in the network card. It is used to identify the network device and control access to the network media. For example, a network device must have a MAC address to access the transmission cable (network cable, located in the physical layer). To send data to the destination, you must know the MAC address of the destination. Because a network card has a unique MAC address, it is also called a physical address.
Network Address (at the network layer)
Because a network address can be allocated to any network device according to the logic, it is also called a logical address. A network address is usually divided into two parts: the network number and the host number, used to identify the network and the devices in the network. Different network layer protocols are used, and the network address description is different. For example, IPX uses pad127134.02d3. es50 as the network number, and 0134.02d3.es50 indicates the host number of the device in the network. The IP protocol uses 32-bit binary to represent the network address, which is generally called an IP address. The MAC address is used for network communication, and the network address is the logical address used to determine the location of the network device.
IP address
To meet network requirements of different sizes, all IP addresses are classified into different categories-class A, B, and C. The first three available IP addresses are differentiated. 2 is required for calculating the number of hosts supported by the network, because the host number of all 0 is used to identify the network, and the host number of all 1 is the broadcast address of the network. A broadcast address is used to identify all hosts on the network. data is sent to a broadcast address, which is equivalent to a whole network host.
Or use netmask as the network mask. The network mask is also a 32-bit binary number like the IP address. The result of the network mask and IP address logic is the host number.
Limitations of class IP addresses
The development of networks is beyond the imagination of designers. Although there are 232 IP addresses in 32-bit IPv4 (the fourth version of IP), the Network is ideally divided into tens of millions, tens of thousands, and hundreds by the IP address classification method, rigid selection leads to a lot of waste. As the number of sites on the Internet increases, the router routing information used to maintain inter-network communication continues to grow, which will eventually lead to the failure of the router load, and can only discard the routing information of some sites, resulting in no access.
Reserved address
Some IP addresses on the Internet are reserved for internal networks. With reserved addresses, each LAN can assign an IP address to multiple hosts in the internal network. Through Nat address translation, the reserved IP address is converted into a real IP address when accessing the external network. This ensures that the internal network adopts the TCP/IP protocol while maintaining the uniqueness of the IP address on the Internet.
If the internal network is not connected to the Internet, you can actually use any type of address. Otherwise, the connected network address must be unique.
Subnetting)
Dividing a network into several small networks is called sub-networks. Assume that a company has a class B address 130.5.0.0, but you need to build networks for different branches. 130.5 is its network number. It divides the host number (16 bits) into two parts: subnet number (8 bits) and subnet host number (8 bits). There are 28-2 subnets in total, in this way, you can assign a subnet to each branch.
Subnet is a solution to address the shortage of IP addresses. In addition, the subnet can also prevent unlimited growth of route information. Because the network numbers of different subnets in the same network are consistent, the routes from the internet router to each subnet are consistent.
Another advantage of subnet is that no matter how the network topology changes, it will not affect the Internet routing, and the Internet Router does not need to spend a lot of resources to calculate and Update route information.
As the IP address is used for addressing, subnet addressing is equivalent to hierarchical addressing. First, the Internet Router locates the destination network according to the network number, and then the internal router further locates the subnetwork in the destination network according to the extended network number.
Router and Routing Protocol
The routing protocol is divided into two types: the Internal Gateway Protocol IGP and the external gateway protocol EGP, which are used between the autonomous system and the autonomous system. The IGP is also divided into the distance vector and the link vector. The Distance Vector periodically communicates the information of the entire route table to the adjacent router, such as r1_1 and IGRP. However, the link vector only communicates the link status information to all routers when the link status changes, such as OSPF. However, similar to the source image, the source image has two protocols.
Variable Length Subnet Mask (vlsm)
When using the classless routing protocol, because the mask cannot be exchanged across the master network, it must be continuously addressable and only one network mask must be used for the same master network. For subnets of different sizes, you can only set the subnet mask as required by the maximum subnet, resulting in a waste. In particular, the network connected to the vro requires only two IP addresses, but the allocated IP address is the same as the maximum subnet.
The proposal of the classless Routing Protocol makes it possible to implement vlsm. Different subnet masks are used for the same primary network, which can save a lot of address space and allow non-continuous addressing to make network planning more flexible.
Route Summarization)
As the enterprise's Internet project deepens, the increase of routers not only increases the route table, but also increases the search time, and increases the process of data processing and forwarding.
Route summary requires that the address is continuous (it is the requirement of the wildcard mask, only the wildcard mask can be used to identify multiple networks with one route to achieve route summary), reducing the number of route table entries; In address continuity, the router can send data to the destination based on the first few digits of the IP address to speed up the route forwarding process.
Router Working Principle and layer-3 Switching
The layer-3 Switch inserts a routing module on the layer-2 switch, and uses the High-Speed Backplane routing module of the switch and Other switching modules to exchange data at high speed. In this case, when host a sends data to host B, A compares the IP address of host B with that of host B. If it is confirmed that B and A are in the same subnet, a will send a broadcast ARP and B will return its MAC address. Therefore, after a encapsulates data with a Mac, it will send the data to the switch, the vswitch sends data to the port of host B by searching the table corresponding to the Mac and port. If A and B are not in the same subnet, A sends an ARP request to the preset default gateway (that is, the routing module. The routing module checks whether the MAC address of host B has been saved in previous exchanges. If yes, it returns to host a. Otherwise, it broadcasts ARP to the subnet of host B, save the obtained Mac and send it back to. In the future, if a needs to send data to B, it does not need to use the routing module to directly encapsulate the Mac, so that the data exchange speed between subnets is almost the same as that of the same subnet.
To address the increasing shortage of IP addresses, IPv6's new-generation IP address specification has been released. By upgrading IPv4's 32-bit binary code to IPv6's 128-bit, the shortage of IP addresses will never go forever.