IP is a 32-bit unsigned integer, its range is 0.0.0.0-255.255.255.255 specifically, an IP is composed of network number + host number two parts, the network number is the same, then in a network segment, you can use MAC data frame direct communication
Given a network number
IP representing the network address of the host number is all 0
The host number is 1 IP on behalf of the broadcast address
The representation of the IP address:
Xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
|--net--|---------Host------------|
The Class A address network number begins with the 0,b class address network number at the beginning of the 10,c class address network number at the beginning of the 110
The Class A address is represented by: 0.0.0.0~126.255.255.255, the default netmask is: The 255.0.0.0;a class address is assigned to a particularly large network usage. Class A networks use the first set of numbers to represent the address of the network itself, followed by three sets of numbers as the addresses of the hosts connected to the network. A large network assigned to a large number of hosts (direct individual users) and a small number of local network networks. For example, the network of IBM Corporation.
Class B addresses are represented by: 128.0.0.0~191.255.255.255, and the default netmask is: 255.255.0.0;b class addresses are assigned to a typical medium-sized network. Class B networks use the first to second set of numbers to represent the address of the network, followed by two sets of numbers representing the host addresses on the network.
Class C addresses are represented in the following range: 192.0.0.0~ 223.255.255.255, the default netmask is: 255.255.255.0;c class address assigned to small networks, such as the general LAN and campus network, it can be connected to the minimum number of hosts, the use of the user is divided into a number of network segments for management. Class C networks Use the first three sets of numbers to represent the address of the network, and the last set of numbers as the host address on the network.
In fact, there are also Class D addresses and Class E addresses. However, these two types of addresses are particularly useful, and here is simply a brief introduction: Class D addresses are called broadcast addresses and are used by special protocols to send information to selected nodes. Class E addresses are reserved for future use.
The definition of Netmark is very simple, netmask is also 32 bits, in numerical value, is located in the Net-id of 1 and Host-id is 0
For example, a common class C IP address
Net-id=24 bit, host-id=8 bit, with 2**8-2=254 IP
A traditional Class C network, such as 192.168.10.0, its netmark is bound to be 255.255.255.0 if the network is divided into 2 sub-networks, very simple, set Net-id use 25-bit, Host-id only 7 bit then this time netmark= 255.255.255.1 0000000 = 255.255.255.128, the two subnets to be divided are
129.168.10.0/25
192.168.10.128/25
Obviously, the/25 is the number of bits that are net-id in this IP (the Host-id of the 2 IPs are all 0, so the two IP represents the subnet in which they reside)
This representation is good for calculating the size of a subnet, such as
192.168.0.0/27 represents 2 of 5 (32-27=5) Times-2 (the first and last addresses of each segment are occupied for special purposes) = 62 IP
192.168.0.0/28, representing 2 of the 4 (32-28=4) -2=30 IP
So 192.168.1.1/24 is a sub-network 192.168.1.0 (with 254 IP addresses: from 192.168.1.1 to 192.168.1.254)
Classification of IP addresses and partitioning of subnets