Thoroughly understand the meaning of IP addresses

Source: Internet
Author: User
IP addresses are frequently used in terms of learning networks and surfing the Internet. As shown in interface 1 for setting IP addresses in Windows, the figure shows the IP addresses, subnet masks, default gateways, and DNS servers that need to be set. The network can be connected only when the IP addresses are correctly set, what do these terms mean? What do I mean when I learn about IP addresses, such as network addresses, broadcast addresses, and subnets?

Figure 1
To answer these questions, let's take a look at an example in daily life. As shown in figure 2, residents of North Street must have a house number for each other to find the other party. The house number is the address of each house. The house number is expressed as: North Street + XX. If the number 1 household is looking for the number 6 household, the process is like this. The number 1 shouted on the street: "Who is the number 6? Please answer. "At this moment, the residents of the North Street heard this, but only answered on the 6th. This shouting process is called" broadcast ". All the users of the North Street are their broadcast range, if there are 20 users in North Street, the broadcast address is: 21 North Street. That is to say, any user in Beibei street can hear "broadcast address-1.

Figure 2
In this example, you can extract the following words:

Street address: North Street. If you give the street an address, use the address-1 of the first household. In this example, the street address is no. 0.

Number of residents: for example, number 1 and number 2.

Residential Address: street address + XX, such as No. 1 North Street and No. 2 North Street

Broadcast address: the address of the last resident plus 1, in this example: No. 21, North Street

In an Internet network, each computer on the Internet has an address similar to the above example. This address is an IP address, which is the house number assigned to the network device, so that computers on the network can access each other, IP address = network address + host address. The IP address in Figure 1 is 192.168.100.1, which contains many meanings. As follows:

Network Address (equivalent to street address): 192.168.100.0

Host address (equivalent to the number of each house): 0.0.0.1

IP address (equivalent to residential address): network address + host address = 192.168.100.1

Broadcast address: 192.168.100.255

How are these addresses calculated? Why are these addresses calculated? To know how, first understand the truth. The purpose of learning a network is to allow computers in the network to communicate with each other, that is, to learn and understand the concepts in the network, instead of just a few nouns.

Note: 192.168.100.1 is a private address, which cannot be applied directly in the Internet. The Internet must be converted to a public address, which is described below.

I. Why do I need to calculate the network address?

In a word, computers in the network can communicate with each other. First, let's look at the simplest network. In Figure 3, we use a network cable (crossover line) to directly connect the two computers. Below are several IP address settings to see if the network is accessible under different settings.

1. Set HOST 1's IP address to 192.168.0.1's subnet mask to 255.255.255.0, and host 2's IP address to 192.168.0.200's subnet mask to 255.255.255.0, so that computers can communicate normally.

2. If the address of Host 1 remains the same and the IP address of host 2 is changed to 192.168.1.200 subnet mask or 255.255.255.0, the two cannot communicate.

3. Set HOST 1's IP address to 192.168.0.1's subnet mask to 255.255.255.255.192, and host 2's IP address to 192.168.0.200's subnet mask to 255.255.255.255.192. Note that the subnet mask is different from the subnet mask in the 1st cases, 1 is 255.255.255.0. In this example, communications can be established between 255.255.255.255.192.

Figure 3
In 1st cases, the two computers are in the same network 192.168.0.0, so they can be connected. In 2 or 3 cases, the two computers are in different networks, so they cannot be connected.

The following is a conclusion: computers that are directly connected by a network cable, or computers that are indirectly connected through a HUB or common switch, must be interconnected over the same network, that is to say, they must have the same network address and the host address must be different. If you are not in the same network, you cannot connect. This is like the example above. The residents of the North Street can find each other because their street names are both North Street and their street numbers are different.

The computing network address is used to determine whether a computer in the network is in a different network and that the computer is accessible only when the computer is not in the same network. Note: In this case, IP addresses rather than physical connections are not used in the same network. So how to calculate it?

Ii. How to calculate the network address

In our daily life, we can see from the literal that the street address is North Street, but we cannot see the network address from the IP address. We need to calculate the network address, the subnet mask we mentioned above must be used.

The calculation process is like this: Convert the IP address and subnet mask into binary values, and then perform the calculation. The result is the network address. As shown in the following operation, alignment up and down, 1 bit and 1 = 1, and the remaining combinations are 0.

Figure 4
For example, if the calculated IP address is 202.99.160.50 and the subnet mask is 255.255.255.0, follow these steps:

1) convert the IP address and subnet mask to binary

202.99.160.50 is converted to binary 11001010 · 01100011 · 10100000 · 00110010

Convert 255.255.255.0 to 11111111 · 11111111 · 11111111 · 00000000

2) perform and calculate the two

Figure 5
3) convert the calculation result to decimal, which is the network address.

11001010 · 01100011 · 10100000 · 00000000 is converted into decimal format: 202.99.160.0

Now we can answer the communication and communication problems in the above three cases.

1. The calculation result below shows that the network addresses of the two computers are 192.168.0.0 and the IP addresses are different.

Figure 6
2. The calculation result below shows that the network address of machine 1 is 192.168.0.0, and the network address of Machine 2 is 192.168.1.0 but not the same network.

Figure 7
3. The calculation result below shows that the network address of machine 1 is 192.168.0.0, and the network address of Machine 2 is 192.168.0.192 and is not in the same network.

Figure 8
I believe that this should understand why the network address is calculated and how it is calculated, but there may be many questions, such as why the IP address is written, what is the subnet mask, and so on. Don't worry, the following is a brief introduction. (To be continued) (T101)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.