Essence recommended
18 Internet classic introductory experimental cases, follow it or not
Amazing, 21 mind maps will take you through the basics of networking
1. What is a VLAN?
VLAN Chinese is Virtual Local Area Network. A LAN can be a network of a few home computers or a corporate network of hundreds of computers. VLANs refer to LANs specifically refer to networks that are segmented using routers – that is, broadcast domains.
Listening to the above concept, there must be many friends who are confused, what is a virtual local area network? Okay, why divide VLANs?
Here's an example: popular understanding
A high school, the new semester of high school recruited 800 students, these 800 students, if placed in a class, it must not be manageable, in the face of 800 people, the teacher also has a headache, here is teaching, there is no hearing at all, what tasks the teacher assigns, there will be some can not be conveyed, if the teacher wants to find a student's information, to find from 800 pieces of information, extremely troublesome, waste of time;
In fact, it is the same, computer A wants to communicate with computer B, so computer A needs to send an arp request, and there are many computers in the network, and eventually ARP requests will be forwarded to all computers in the same network in order to find computer B, so that in order to find computer B, the overall bandwidth of the network is consumed, and the computer that receives the broadcast information also consumes part of the CPU time to process it. This results in a large unnecessary consumption of network bandwidth and CPU computing power.
So what to do?
For these 800 students, the school is divided into 10 classes, each class has 80 people, named the first (1) class of high school, the first (2) class of high school... In the first (10) class of high school, each person will be given a class number.
1101 represents student number 01 in a class.
1102 indicates student number 02 in a class.
1201 means student number 01 in class 2.
The mantissa of the student number in the same class is different, and the others are the same.
Then in this way, the teacher can manage it much easier, you can manage the 80 people in a class properly, and the 2nd and 3rd classes next door are messed up into a pot of porridge and don't care about the affairs of the class, I want this class of 80 people to go to class well.
This is VLAN, each class is equivalent to a VLAN, and each class name is equivalent to the name of VLAN, and the number of each student is the IP address; Classmates (the same VLAN IP), because the same classroom, get along day and night, and can communicate with each other, students in different classes, if they do not do other work, it is difficult to communicate back and forth.
So the same VLAN can communicate with each other; Different VLANs cannot communicate with each other without configuration.
So how do different VLANs communicate? This requires one-arm routing and Layer 3 switches.
2. One-arm routing and Layer 3 switches
We know that in order to achieve communication between different VLANs, it is necessary to have a routing function, and there are two ways for different VLANs to communicate with each other (one-arm routing, Layer 3 switching).
What is a one-arm route?
The implementation of one-arm routing is actually a common Layer 2 switch plus a router, so that different VLANs can communicate with each other.
So what is a Layer 3 switch?
For small networks, one-arm routing can cope, but as the traffic between VLANs increases, it is likely to cause the router to become the bottleneck of the entire network, packet drops, or communication congestion.
In order to solve the above problems, Layer 3 switches came into being. Layer 3 switches are essentially "Layer 2 switches with routing capabilities." Routing is a function of the Layer 3 network layer in the OSI reference model, so switches with Layer 3 routing are called "Layer 3 switches".
For the internal structure of the Layer 3 switch, you can refer to the following diagram.
In one body, the switch module and router module are set up respectively; The built-in routing module, on the other hand, is the same as the switching module and uses ASIC hardware to handle routing. Therefore, high-speed routing can be achieved compared to traditional routers. Moreover, the routing and switching module is aggregated link, because it is an internal connection, it can ensure a considerable bandwidth, so for regular projects, a three-layer switch is required to achieve communication between network networks.
3. What is a gateway?
After understanding the VLAN and the Layer 3 switch, whether the gateway can communicate depends on whether the gateway is correct.
1. What is a gateway
Gateway is also known as network connector and protocol converter. Gateways are used at the transport layer to achieve network interconnection and are the most complex network interconnection devices, only used for the interconnection of two networks with different higher protocols.
2. How to understand the gateway
Everyone knows that walking from one room to another necessarily requires passing through a door. Similarly, sending information from one network to another must also pass through a "gate", which is the gateway. As the name suggests, a gateway is a "gateway" to one network to another.
There are many types of gateways according to different classification standards. The gateway in the TCP/IP protocol is the most commonly used, and the "gateway" we talk about here refers to the gateway under the TCP/IP protocol.
3. The IP address of the gateway
So what exactly is a gateway?
The gateway is essentially the IP address of a network leading to other networks, and the gateway chooses one of the available IPs in the network segment, but generally the first and last ones are used.
For example
For example, there are networks A and B,
Network A: The IP address range is "192.168.1.1~192. 168.1.254", subnet mask 255.255.255.0;
If it needs to communicate with other network segments, its gateway can be set to 192.168.1.1, or it can be set to another IP address in the network segment.
The IP address of network B: is "192.168.2.1~192.168.2.254", and the subnet mask is 255.255.255.0.
If it needs to communicate with other network segments, its gateway can be set to 192.168.2.1, or it can be set to another IP address in the network segment.
4. How does the gateway communicate?
In the absence of a router, TCP/IP communication between two different networks is not possible, even if two networks are connected to the same switch (or hub), the TCP/IP protocol will determine that the hosts in the two networks are in different networks according to the subnet mask (255.255.255.0). For communication between these two networks, it must go through a gateway.
If a host in network A finds that the destination host of the packet is not in the local network, it forwards the packet to its own gateway, which then forwards it to the gateway of network B, and the gateway of network B forwards it to a host of network B (as shown in the attached figure). The process by which Network B forwards packets to Network A.
Therefore, only by setting the IP address of the gateway, the TCP/IP protocol can realize mutual communication between different networks.
5. What is the default gateway?
If you figure out what a gateway is, the default gateway is easy to understand. Just as a room can have multiple doors, a host can have multiple gateways. Default gateway means that if a host cannot find an available gateway, it sends the packet to the default designated gateway, which processes the packet. The gateway used by the host now generally refers to the default gateway.
4. What is DNS?
DNS is the Domain Name System, which is the server that turns URLs into IP addresses.
DNS is used to translate domain names into IP addresses, and here is an example, and it is easy for everyone to be clear.
For example, when we enter www.baidu.com in the browser, the machine has to communicate with the Baidu website, the machine wants to send data packets outside, the data packet must write the IP address of Baidu this server, we don't know what the IP address is, then the host needs to ask the DNS server, and the DNS server will automatically help us translate the domain name of the www.baidu.com into the IP address 61.135.169.105. Then write to the destination IP address of the packet to communicate.
Just like we write a letter, you have to write a recipient's address post office to send it to you, you write a letter abroad, you write Chinese address the post office does not know, you need this person to help you translate into English. This is the role of DNS, so you can write DNS in the local connection to browse the web normally, if you do not set DNS, you can not access the web page normally.
5. MAC address
When it comes to MAC addresses, you have to mention IP addresses, and here by the way, IP addresses are also mentioned.
IP vs. MAC
Although IPv6 is now available, most of the basic ones we use are still IPv4 protocol, and the so-called IP is the number of your computer's entire network. Other computers need this number to access the computer. But this number changes all the time in many cases. The only constant is your MAC address: the physical address.
MAC is a unique network address in a network that identifies a network card device. Assigned by the relevant hardware manufacturer, each computer's MAC address is unique.
To make a metaphor, you often move, you haven't moved once and have an address, XX cell XX unit XX number, this is IP. But your name does not change, this is MAC, the difference is that our MAC does not allow duplicate names.
Our IP is divided into two parts: as shown in the figure above, it is divided into a network part and a host part. The network part is like you are in XX town, XX city, XX town, XX province, this is fixed by the state. However, the XX cell XX unit XX number was set by the developer himself. The two numbers add up to your IP. The difference is that in reality, the length of the two numbers is fixed, and the IP addresses of A, B, C, and D on the network are changed, which was discussed in detail the day before yesterday.
6. Subnet mask
The subnet mask is to distinguish between network bits and host bits, as we mentioned above, an IP address is composed of the network part and the host part. Just as a person's first name consists of a surname and a given name.
Then we can compare the IP address to a person's name, then the subnet mask is like a list, you can quickly know who has the same surname, those people have different surnames, and group people with the same surname so that they can communicate with each other before.
Take an example
There is a network segment is 192.168.1.0-192.1.254, this network segment is like a village, call it a security village, this network segment has an IP address is 192.168.1.1, we call him security one, the other person is called security two, its IP address is 192.168.1.2, we look at them, we know that they are the same village.
There is another network segment, is 192.168.0.0-192.168.255.254, we call it An Village, there is also two IP addresses in the village 92.168.1.1 and 192.168.1.2, also called security one, security two, so the problem? At this time, how to distinguish which village they belong to?
At this time, you need the subnet mask to determine that they belong to that network segment, you need to bring security one and security two to the village to recognize, you know that they belong to that village, the network segment of the security village is 255.255.255.0, and the network segment of the village is 255.255.0.0.
IP addresses similar to "same name" and "same surname" will also appear in the network, and how to distinguish which network segment they belong to depends on the subnet mask.