IP foundation --1.ip address
Binary and logical operations
We think we must know two concepts and logical operations before we know the IP address. Although I also know that these two stuff don't understand it but if you don't know their working principle, we will rely on the IP address and the subnet. However, once you know the principle, then you don't lose your so-called "10,000 changes from it" in any IP network.
Binary (binary)
Why do we have to learn the second bart? It's not the dead stupid computer. It only knows 0 and 1. Then we want to communicate with the computer. When the computer is to process IP operations, it is finally carried out in a binary.
The rules of our human beings are in the 10th, which is from 0 to 9 to return to zero. When we go back to zero, the Bit and BYTE we discussed earlier are the eight-in-one, 0 to 7 is a circle. Zero will enter a number of sixteen bits from 0 to 15 back to zero one, but use numbers 15 easy and ten in-one, in the sixteenth to 15, from 10 to 15 Letters A to F instead, so we usually see the hexadecimal arrangement from 0 to F.
I know that the above arithmetic rules I believe that it is not difficult to understand that the second bind is not even the same. From 0 to 1 to a circle back to 0. Then let's take a look at the comparison between the seventeen continuous increasing ten-in-one bits and the hexadecimal numbers will be like this.
Ten into the second binary sixteen
0 0 0
1 1 1
2 10 2
3 11 3
4 100 4
5 101 5
6 110 6
7 111 7
8 1000 8
9 1001 9
10 1010 a
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
16 10000 10
If you want to carry out the corresponding number in the list in the list, it is the easiest way to find the appropriate number. However, if you have seen the sixteen numbers you have just seen, if you have to find thousands of hundreds Numbers are not easy. However, we see the ten-in digits that we see on the IP address will not exceed 255 values. We can first list 2 from 0 to 7 times.
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
When we want to change the ten in two, we will find the field corresponding to the number (the method is to find the two values, and take the right) Fill in the opposite field 1 and then use the remainder Continue to find the next column and then fill in 1 until no number is finally filled with the other fields.
For example, we have to convert 220 10-in-one digits to two into the position
We found 128 this column is the most suitable (because the left side of the 128 is 256 and 220 is more than 128). Then we fill in 1 on the 128 column.
Continue the remainder 92 We found 64 this column is the most suitable, then fill in the 64 fields
Continue the remainder 28 we found 16 this column is the most appropriate, then fill in the 16 fields
Continue the remainder 12 We found 8 this column is the most appropriate, then fill in the 8 fields
Continue the remainder 4 We found 4 this column just right, this is the best found. So in this field, you also fill in 1
Because there is no other than the other fill in 0 is right.
The result is as follows 128 64 32 16 8 4 2 1
1 1 0 1 1 1 0 0
If we want to use the bin to convert the binary to the top of the top, it is more simple to make the binary number from the right left order, then the number corresponding to the 1st is added. And that is a ten-in number.
Of course, this is a manual method. If you have a binary counter or use the WINDOW's small abacus for conversion more easy. If you still don't know how to use Windows's small calculation, you can follow the steps below.
"Start / Program Set / Affiliated Application / Small Abacus"
Then pull down the "View" menu to determine "engineering" has been selected.
Then click "Ten Granses" input value
You can get the "binary" again to get the conversion value.
logic operation
The logical operation is a compulsory unit of Microcomputer ArchitaRe Here we only need to know a few of the most basic calculations, and one is or one or one is NOT.
Only the same results in the two parties participating in the binary and the two parties are the same (0 or 1), otherwise it is 0, which is only one 1, and the result will be 1 otherwise 0. Its situation is
0 and 0 = 0
1 and 1 = 1
0 and 1 = 0
Here you can't figure it out that there is a one-on-one and the results will be the other party (regardless of 0 or 1), and the result of 0 participating and the results will be 0. There is only one part to 0 in the binary OR operation. Otherwise, it will be 1. Its situation is
0 or 0 = 0
1 or 1 = 1
0 OR 1 = 1
Memory method All the results of 0 participation OR operations are each other, and as long as there is 1 participation or the result is 1.
The easiest way to operate in NOT is involved in the result of any NOT operation.
NOT 0 = 1
NOT 1 = 0
As for other NAND or NOR operations, NOT and AND NOT and OR are combined together.
Know IP address
After a round of "brainwashing", we finally talked about the IP address. If your machine is now connected to the Internet and uses the IP protocol (I think you should do this, otherwise, how to see my article).
I assume that you are using the Windows system. So now, please press "Start" and "Execute", please use the keyboard to enter "Winipcfg" and "OK". At this time, you should see a window running out and displaying the IP number currently used by your machine on the "IP Address" section. Perhaps a group of numbers such as 139.175.152.254 However, what do you mean about the representative of this number? Road.
How can I know haha waiting for you to read the following article You can also tell me more?
IP class and identification code
As you have seen, the IP address is used in four groups "." The decapitated ten-in number. We call each set of numbers as a "OCTET" format called "dotted quad". In fact, each group is an 8-bit-binary number (using a 10-input habit of being able to move to human habits) is a 32-bit IP address is also an IP V4 (Version 4) version of the address. IP V6 (IP address using 128-bit) is also like a fire.
If you remember that the IPX address mentioned in front of the Internet is discussed, you should know that the INTERNAL address is used to identify the host and the External address is used to identify the network. The IP address actually there is such a function only to place the identification code of the network and the identification code of the host on a single IP address.
However, let us know the classification of IP addresses before distinguishing NET ID and HOST ID:
If we represent all IP addresses all OCTETs are 8-bits if they are not 8-bit, they fill in the left to fill up. At this time, you will look at the leftmost number to start.
If it is the IP starting with "0" is an IP of a A Class
If it is the beginning of "10" this is a b class IP
If it is starting with "110", it belongs to the IP of C Class.
I believe you know why we learn the second in the beginning, if you don't know how to change you, you can still die from 1 to 126 IP is a class from 128 to 191 IP is B class and starts from 192 to 223 It is C class. Obviously, it is easy to see the IP class relatively easy. Don't you feel?
Ok, when we know the Class of the IP, we can know the IP NET ID and HOST ID.
A class's IP uses the first set of numbers to do NET ID, the rest of the three groups do Host ID
B Class's IP uses the front two sets of numbers to do NET IDs, two groups do Host ID
Class's IP uses the front three sets of numbers to do a NET ID. The remaining group is Host ID.
From the figure below, you can easily distinguish between three different IP Class above
Why do we need to divide IP? This is for the original IP management needs.
If you want to form a single IP network, then you have to assign the same NET ID to all hosts and each host's Host ID must be unique, saying that no two host IDs will be the same. Your network also wants to connect on the Internet or other network, then the NET ID you use must also be unique. Otherwise, it will cause a sudden. It is better than your phone number if it is 1234567 (Host ID), others will not use this number in the same area number (NET ID), but you don't keep it in other area prices, there are 1234567 this number, but if Taipei is used Don't use 02 in Area Code 02. No matter how the entire area number is added, it must be unique. The same truth must be unique on the Internet. There is a very special NET ID 127 (ie, the binary 0111111) is to reserve it to the host loop test it cannot be applied to the actual network. In addition, there is a rule that we must also comply with the two-in-one when the Host ID is specified, can not be all 0, and it is not all 1. When the Host ID is 0, it refers to the network itself identification code and the address of the broadcast packet is transmitted to the entire domain broadcast address.
It is clear that a Class network can be allocated Host ID is more than how much more than C Class. Let us calculate the number of NET IDs that can be divided and the number of Host ID inside each level will know.
Because the first bit of the A class must be 0, only 7 bits of 8 BITECT in the head is variable. Then 27 = 128 minus 0 and 127 this NET ID can not be used. Then we can actually only divide 126 A Class's network. Each A class of the network can be assigned a 24 (the number of HOST IDs that can be used), that is, 16,777,216 HOST IDs, because the binary number cannot be all 0 or 1, so actually available The host has only 16,777,214.
Because C Class is subtracted from 110 to minus 3 BIT, it can be divided into 21 (24-3) of 2 21 (24-3), which is 2,097,152 NET IDs and then each Class C can be divided. 28 = 256 - 2 = 254 Host ID.
Ok, try your own yourself to calculate how many NET IDs can be divided into available Host IDs under each NET ID. (TIPS should not forget that the ID cannot be 0 or 1). Then come back to the list below
The number of horses using the number of horses using the number of applications
A 0 126 16, 777, 214 1.x.x.x to 126.x.x.x national level
B 10 16, 384 16, 382 128.x.x.x to 191.x.x.x multinational organization
C 110 2,097,152 256 192.x.x.x to 223.x.x.x Enterprise Organization
D 1110 - - 224.- to 239.- Special Use
E 1111 - - 240.- to 255.- Reserved
Know Net Mask
Below we have to know, Net Mask (network mask or network mask).
Here, I have to explain one thing to everyone, IP and Net Mask must be a pair of IP and Net Mask when we use the IP address division, but we can use when we use the level IP address. The preset Mask is like a Class of Mask is 255.255.0.0.0.0.0.0.0.0.
This means, see 255 is more difficult to understand if you convert it to the binary, it is easy to understand 255 = 11111111 (8 1). Then when you look at these Net Mask and each level IP, you will find a phenomenon ~~ Any IP part corresponding to 1 is that NET ID is where the corresponding part of 0 is Host ID.
Haha ~~ It should be a worthy of discovering ~~~ I think your mood is nothing in the original Columbus to send the American mainland. However, since we have already divided the level, we use the Mask, we use the grade Isn't it just fine?
Oh ~ Oh ~~ You are too smart and admire, but you don't forget the computer is a stupid fool, please tell me how the computer identifies the NET ID and HOST ID. Will not let it be good. I tell you.
Remember the logical operation of and NOT? If you forgot to overlook the tutoring and taking it again. When the computer gets a pair of IP and Mask (both binary numbers), the computer first uses an operation to use an operation to find the NET ID. You can do an example with your computer's IP, let us take the IP you read by Winipcfg to calculate 139.175.152.254 to change to a binary.
10001011.10101111.011010101111111110
(At this time, you should know why I said that this is a b class IP, I don't know what to see, the first two bits are?
This Class's preset Mask is 255.255.0.0 to change to the second.
111111111.111111111.00000000.00000000
Then add IP and Mask and operate
10001011.10101111.011010101111111110
AND
111111111.111111111.00000000.00000000
inferred
10001011.10101111.1.00000000.00000000000000
Changed to ten into a bit is 139.175.0.0 This is NET ID.
So how do you ask Host ID?
First make Net Mask to make a NOT operation can be drawn
00000000.00000000.11111111111111111
Then you can get a Host ID with an ip to get the AND operation:
00000000.00000000.01101010111111110
It is 0.0.152.254.
Simple, is it haha ~~ I see you smashing it ~~~ Don't worry about more IP examples to operate, you have to worry.
There is also a way you need to specify the broadcast address (Broadcast) in addition to entering an IP address NetMask network address when we set up a network environment. I already know that if the Host ID is 0, it is a network address, and all of them is a broadcast address. In fact, the broadcast address can also be obtained by a simple operation.
First make Net Mask to make a NOT operation can be drawn
00000000.00000000.11111111111111111
Then do the OR operation with IP to get Broadcast Address:
10001011.10101111.011010101111111110
Oral
00000000.00000000.11111111111111111
inferred
10001111.1010111111111111111111111111
It is 139.175.255.255.
However, I always feel that there is a little improper because many nets have a certain node limit, such as Ethernet, usually connect up to 1,200 hosts. If you get a b class ID, don't you waste a lot of Host ID? It is a horribleness of using a class.
When you encounter this "troubles of rich people", Sub-Net Mask is sent to the field. If you have just thought that the preset Net Mask is how much, then when you know the Sub-Net Mask's function, I dare to pay you no longer ignore Net Mask.
The use of Sub-Net Mask is to use "borrow" or can be said to be "robbing" is from left to right. Some bits will be converted to the Sub-Net ID of the Host ID. That is, the "1" of the preset Net Mask has gradually increased the "0" of the "0" of Net Mask's "0". Such a result is of course possible to get more NET IDs to change a sentence you can divide a large IP network into more subnets and the number of hosts of each subnet is correspondingly reduced.
Its situation will be to cut two (2 1 = 2) subnet if you borrow a Bit's Host ID to do a Sub-Net ID (2 1 = 2) Subnet If you use 2 bits, there are 4 subnets 3 Bit 8 4 bits 16 ..... When all Host IDs are borrowed out, you can get the maximum number of subnets but this is meaningless because there is no Host ID. How do you assign IP? Give the host, if your host ID is left, only one bit is not borrowed out, then you can only get 0 and 1 to the host ID, because these two IDs can not be used to assign Host.
When you cut the network, you have to leave 2 bits to do the Host ID. This time you can only connect up to 2 hosts. (咦 22 is not equal to 4, but don't forget Host_ID can't be two 0 or Two 1 oh). Such a network is usually used in a router between the WAN and the LAN. The applications in the LAN are usually at least 3 Bit to do Host_ID. In order to better understand the use of SUB-NET MASK, we still take a look at the original IP (139.175.152.254).
We know that it is Net Mask under the preset situation.
111111111.111111111.00000000.00000000
If we borrow the three bits of the Host ID to do the sub-net ID, make the original Net Mask and Sub-Net Mask.
111111111.111111111.00000000.00000000
Oral
0000000000000000.11100000.000000000000
inferred
111111111.111111111.11100000.00000000
Replacing the actual NET Mask will become like this 255.255.224.0.
Because only 3 BIT borrowed, cut into 8 subnets and their SUB-NET IDs added from 000 to 111. The original NET ID (100011111111.00000000.00000000) actual number of subnets Net ID is
10001011.10101111.00000000.00000000 (139.175.0.0)
10001011.10101111.00100000.00000000 (139.175.32.0)
10001011.10101111.01000000.00000000 (139.175.64.0)
10001011.10101111.01100000.00000000 (139.175.96.0)
10001011.10101111.10000000.00000000 (139.175.128.0)
10001011.10101111.10100000.00000000 (139.175.160.0)
10001011.10101111.11000000.00000000 (139.175.192.0)
10001011.10101111.11100000.00000000 (139.175.224.0)
At this time, there were only 13 bits left only in the 16 BIT, that is, there is only 2 13 = 8, 192 - 2 = 8,190 hosts in each subnet, and the number they can allocate is
00000.00000001 to
1111.1111111110 between.
But we don't simply express it from 0.1 to 31.254, which we have to add each other Sub-NetID to the final IP number. E.g
The host number under Sub-Net Id 001 will be from
00100000.00000001 to
10011111111111111110
That is, between 32.1 to 63.254
The entire IP address is between 139.175.32.1 to 139.175.63.254.
The host number under Sub-Net ID 100 will be from
10000000.00000001 to
10011111.11111110
That is, from 128.1 to 159.254
The entire IP address is between 139.175.128.1 to 139.175.159.254.
understood
Oh ~~~~ Headache yeah ~~~
Don't COMPLAINT ~~ Do yourself to calculate how much the host number under 110 Sub-Net ID is
If your answer is not 139.175.192.1 to 139.175.223.254, you need to leave the screen for a while to breathe the air (don't smoke) and then go back to look at the previous paragraphs. When you reread, you must make sure that every concept is clearly read.
Of course, you say that there is nothing to give up, anyway, any, you will not deduct your money ~~~
The actual application of IP
Ok, let us pay us to the above-mentioned IP level to start the binary number of the beginning of the 010110 is ABC level, respectively.
IP is divided into two NET IDs and HOST IDs. In the preset case, a uses the first OTECT to use the three OTECTC to use three OECT and do the Host ID;
When you specify the NET ID and HOST ID for the machine, it is not possible to all 0 or all of the IP addresses must be unique.
Net Mask is to calculate the NET ID and HOST ID to draw the IP and MASK and the AND operation can be obtained with the NET ID to make Mask first NOT operation, and the AND operation can be obtained.
SUB-NET MASK is "borrow" Host ID to use rules for Sub-Net IDs from left to right increments to cut a larger network into multiple smaller networks. When IP is displayed, it must be added with the SUB-NET ID to be represented by a complete OTECT.
Setting rules
When we set the IP network, if you want to communicate directly, you have to use the same NET ID and different Host IDs. If you want to use a different NET ID (such as sub-net division), Host's host between the NET IDs can be successfully interoperable.
When the computer is concluded by the AND operation, it will check if the source NET ID and the destination NET ID are consistent. If the package can be passed directly to the other party, otherwise, the package is passed to the Router or Default Gateway. I will in the future ARP and RIP will tell.
Also, if you use Sub-Net technology to be very careful when assigning an IP address, it is very careful to avoid IP beyond the subnet and cannot communicate. For example, in the case where there is no division (for example using 255.255.0.0 Mask) 139.175.31.254 and 139.175.32.1 are all in their IP packets within the same network without ROUTER, but after borrowing After the three Bit subnets (Net Mask became 255.255.224.0) They were separated within two IP networks, they must use Router to pass the package.
At the same time, some effective IP addresses have been used after Sub-Net to become all 0 or 1, which cannot be allocated to the host, for example, 139.175.63.255139.175.64.0, etc. (If you don't understand why it will be changed to a binary and then find out that the number of the Host ID part after the subnet is cleared.)
So when we have a design network at the beginning, we have to have the responsibility and the distance from afar early. Otherwise, all machines have set good and operated for a period of time, it will become abundant. If you want to redistribute the planning of IP, it is more than a hundred times more than the network, the more it is more than a hundred times, the bigger the network is more than a hundred times.
IP
When we have to connect the Internet, we must first book a NET ID. If the ID has been used, you must use another ID. The organization responsible for the Internet IP book is called the Internet information center.
http://www.internic.net.
Due to the Internet's explosive growth IP address, there is also a need to use the IP address of the book in many institutions. So we are in the three levels of the ABC to have some addresses to reserved them to private addresses.
10.0.0.0 - 10.255.255.255
172.16.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
Of course, when you use these addresses.
Routing information of private address cannot be spread out
Use private address as a source or destination address package cannot be transferred through the Internet
Reference records for private sites (such as DNS) can only be used within internal networks
However, it is precisely because of these restrictions When we use these private locations to set the network, there is no need to worry about the network that is also used to use the same address.
This gives us a big convenience for our IP network, for example, even if your current company has not even connected to the Internet but not in the future. If you use the public IP, if you don't have a book, you will be very likely to stand with others when you have access to the Internet. It is also a problem that IP is very headache if the previously analyzed IP is again replaced. At this time, we can use the private address to erect the network. When you want to connect to the integrating, we can use the IP conversion protocol such as NAT (Network Addresss Translation) to cooperate with the number of IPs. It is also advantageous to have a routing of the private address in the Internet. Of course, if you use a private address in the classroom or in your home, it is also a good idea.
IP
Think about my IP is 139.175.152.254 and Net Mask is 255.255.255.0. Do you think if you use a wrong Net Mask? 203.56.6.18 is used to do MASK with 255.255.0.0.
We cut larger IP grades into many smaller networks to be said to be "annoyance of rich people" but is "the poor" is not worried? Of course,, for example, your company has close 600 hosts to connect an IP Online application, a B class network seems to be too wasteful and it is not necessary to apply for the application to apply 3 C Class's network. Of course, there is no problem (if you have no light, if you haven't used it).
However, as we just know because of the three C Class networks their NET IDs are independent, if you want to communicate, you will be involved in ROUTER. But Router is not very suitable ~~~ You can change a "Benz" Route almost, even if you don't care, it is not a relaxed thing, it is not a relaxed thing. Also specifically, "half" personal is also pleasedon.
The good news is that you can use these three C Class networks together to use the CIDR (ClassSs Inter-Domain Routing) technology is the so-called no level IP.
When you use the CIDR, you can make a big name of the IP, you can set your Net Mask length casual. That is to say a Class of Class, can also use Mask like 255.255.0.0, which we call "SuperNet" and Subnet just the opposite.
Of course, if you want to communicate with other networks, you must also support CIDR and set it more comparison.
If you think 139.175.0.0 and 19255.255.0.0 and 192.168.1.1/255.25555.0 This IP performance method is too much trouble here. There is a better representation using Mask's bit number to represent Net Mask. In this way, we can write 139.175.152.254/16 and 203.56.6.18/24 If you use three bits Sub-Net we can change 16 to 19 and change 24 to 27, if you use three Bit's supernet we will change it into 13 and 21.
Is it very convenient? I like it ~~~