In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "what is the IP address, network address and subnet mask". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. IP address
In order to realize network communication between computers, there must be a legal ip address. IP address = network address + host address, (also known as: host number and network number)
The structure of ip address makes it easy for us to address on Internet. Ip addresses are usually more intuitive, in dotted decimal, with each number from 0 to 255. for example, the ip address of a host is 128.20.4.1.
In the local area network, the ip address is also required. Generally, the ip address of the intranet begins with 192.168, so it is easy to distinguish the ip address between the public network and the intranet.
[note] Network address, also known as network location, network number, network segment, and subnet IP, is a synonym for which subnet it belongs to.
[note] the network segment in which the host is located can only be determined when the IP address and mask are known. The host number under any network segment cannot be all 0 or 1. All 0 indicates the network address of the network segment, and all 1 is the broadcast address.
Second, thoroughly understand the meaning of IP address
Whether learning the Internet or surfing the Internet, IP addresses are words that appear very frequently. The interface for setting IP addresses in the Windows system is shown in figure 1, where IP addresses, subnet masks, default gateways and DNS servers need to be set, and the network can be connected only if they are set up correctly. what do these nouns mean?
When learning about IP addresses, you will also encounter concepts such as network addresses, broadcast addresses, subnets, and so on. What does this mean?
To answer these questions, first look at an example from daily life.
As shown in the picture below, residents living on North Street must each have a house number if they can find each other. This house number is the address of each house, and the house number is expressed as: North Street + XX. If No. 1 household is looking for No. 6 resident, the process is like this: No. 1 shouted on the street: "who is No. 6, please answer." at this time, the residents of North Street all heard, but only No. 6 answered. The process of shouting is called "broadcast". All the users of North Street are his broadcast range.
If there are 20 users on North Street, the broadcast address is: 21 North Street. In other words, a cry from any user on North Street can be heard by "broadcast address-1" users.
In the Internet network, every computer surfing the Internet has an address like the above example. This address is the IP address, which is the house number assigned to the network equipment, so that the computers in the network can access each other.
IP address = network address + host address
Suppose the IP address is 192.168.100.1, which contains a lot of meaning. As follows:
Network address (equivalent to street address): 192.168.100.0
Host address (equivalent to the door number of each household): 0.0.0.1
IP address (equivalent to household address): network address + host address = 192.168.100.1
Broadcast address: 192.168.100.255
III. Types of IP
The IP address consists of two parts: the network identity and the host flag. The commonly used IP addresses are A, B and C, each of which specifies the number of bits occupied by the network ID and host ID in 32 bits.
Category An address: 0.0.0.0Murray 127.255.255.255
Category B address: 128.0.0.0Murray 191.255.255.255
Class C address: 192.0.0.0Murray 223.255.255.255
Class An addresses are usually assigned to networks with a large number of hosts, Class B addresses are usually assigned to medium-sized networks, and Class C addresses are usually assigned to small Lans.
Fourth, why to calculate the network address
In a word, it is to enable computers in the network to communicate with each other.
Take a look at the simplest network first. The following two computers are directly connected by a network cable (cross cable). Here are several IP address settings to see whether the network is connected or not under different settings.
1. Set the IP address of unit 1 to 192.168.0.1 with a subnet mask of 255.255.255.0 and the IP address of unit 2 to 192.168.0.200 with a mask of 255.255.255.0, so that the two computers can communicate normally.
2. If the address of Unit 1 remains the same, and the IP address of Unit 2 is changed to 192.168.1.200 or the subnet mask is 255.255.255.0, then the two stations will not be able to communicate.
3. Set the IP address of Unit 1 to 192.168.0.1 with a subnet mask of 255.255.255.192, and the IP address of Unit 2 to 192.168.0.200 with a subnet mask of 255.255.255.192. The difference between this and the first case lies in the subnet mask, which is 255.255.255.0 in this case, and this computer cannot communicate normally.
The first situation works because the two computers are on the same network 192.168.0.0. On the other hand, the two computers are in different networks in three cases, so they are not connected.
Here is a conclusion: for computers directly connected by network cables or indirectly through HUB (hub) or ordinary switches to communicate with each other, computers must be on the same network, that is to say, their network addresses must be the same, and the host addresses must be different.
You can't get through if you're not on the same network. This is like the example we gave above, the residents of the same North Street can find each other because the street names are all North Street and their house numbers are different.
Calculating the network address is to determine whether the computers in the network are on the same network. You can get through if you're not here, but you can't get through without it. Note that when you are not on the same network, you mean the IP address, not the physical connection. So how to calculate it?
5. Subnet mask
A network identity of an IP address can contain a large number of hosts, but in practical applications, it is impossible to connect so many hosts in a single network, which brings inconvenience to network addressing and management.
To solve this problem, the concept of "subnet" can be introduced into the network. The host identification domain is further divided into subnet identification and subnet host flags. By flexibly defining the number of bits in the subnet identification domain, the size of each subnet can be controlled. After a large network is divided into independent and interrelated subnets, each subnet within the network can be addressed and managed independently, and each subnet is connected by cross-subnet routers, which also improves the security of the subnet.
Subnet mask classification
1) default subnet mask
That is, without subnetting, the bits of the corresponding network number are set to 1, and the host numbers are set to 0.
Class A network default subnet mask: 255.0.0.0
Class B network default subnet mask: 255.255.0.0
Default subnet mask for Class C network: 255.255.255.0
2) Custom subnet mask:
Dividing a network into several subnets requires a different network number or subnet number for each segment. In fact, we can think of the host number as divided into two parts: the subnet number and the subnet host number. The form is as follows:
Unsubnetted IP address: network number + host number
IP address after subnetting: network number + subnet number + subnet host number
In other words, after the IP address is subnetted, part of the previous host number location is given the subnet number, and the rest is the subnet host number.
6. How to calculate the network address
The address in our daily life, such as No. 1 North Street, literally shows that the street address is North Street, but it is difficult for us to see the network address from the IP address. To calculate the network address, we must use the subnet mask mentioned above.
The calculation process is that the IP address and subnet mask are converted to binary, and then the and operation is performed, and the result is the network address. The and operation is shown below, aligned up and down, 1-bit, 1-bit, 1-bit and 1-bit, and the other combinations are 0.
For example, the steps to calculate a network address with an IP address of 202.99.160.50 with a subnet mask of 255.255.255.0 are as follows:
1) convert the IP address and subnet mask to binary respectively
202.99.160.50 is converted to 11001010 01100011 10100000 00110010 in binary
255.255.255.0 converted to 11111111 11111111 11111111 00000000 in binary
2) operate the two together
3) convert the result of the operation into decimal, which is the network address.
11001010 01100011 10100000 00000000 converted to decimal system is 202.99.160.0
Now we can answer the questions of whether the above three situations are common or not.
1. The network address of the two computers is 192.168.0.0 and the IP address is different, so they can get through.
2, the network address of Unit 1 is 192.168.0.0, and the network address of Unit 2 is 192.168.1.0, which is not in a network, so it is not available.
3. The network address of Unit 1 is 192.168.0.0, and the network address of Unit 2 is 192.168.0.192, which is not in a network, so it cannot be connected.
VII. Case understanding
Using a case on the network, the details are as follows:
Once upon a time there was a landlord who had 256 houses. The house number of the landlord's house was "192.168.1", so the house number of the first house of his family was 192.168.1.0, and the second house was 192.168.1.1. The number of room 256 is 192.168.1.255.
When the landlord is old, he needs to divide 256 houses among his four sons, and each son can be divided into 64.
Ask a gentleman to preside over justice, sir to operate like this:
192.168.1.0-192.168.1.63 to the eldest son
192.168.1.64-192.168.1.127 to the second son
192.168.1.128-192.168.1.191 to the third son
192.168.1.192-192.168.1.255 to the fourth son
How to describe the subnet segment of the four sons?
192.168.1.0/26
192.168.1.64/26
192.168.1.128/26
192.168.1.192/26
What the hell is / 26?
What is the binary of 255.255.255.192? "11111111-11111111-11111111-11" how many 1s do you count? Don't count, it's 26 1s. To simplify the representation of the subnet mask, use / 26 instead of 255.255.255.192.
Bitwise and arithmetic Let's take a look at how did the eldest son's network segment 192.168.1.0x26 be obtained?
Take the eldest son's room as an example:
192.168.1.0-192.168.1.63
Binary representation:
192.168.1.0
11000000.10101000.00000001.00000000
192.168.1.63
11000000.10101000.00000001.00111111
What is the exact same address at the beginning and end?
11000000.10101000.00000001.00
How many digits are there in total? Twenty-six! Then you can use this "192.168.1.0 lap 26" to represent all the rooms of the eldest son.
Compared with the house number of the room "192.168.1.199", it obviously belongs to the fourth son.
Q1: can a host 192.168.1.199 Universe 26 communicate with a directly connected host 192.168.1.200 ax 24?
Yes, because they are all rooms of the fourth son.
Q2: can a host 192.168.1.199Universe 26 communicate with a directly connected host 192.168.1.1According to 24?
No, because one is the eldest son's room and the other is the fourth son's room, so we can't communicate directly!
This is the end of "what is the IP address, network address and subnet mask". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.