Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the uses and differences of ip address, subnet mask, gateway, network card and DNS

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is the use and difference between ip address, subnet mask, gateway and network card, and DNS". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usefulness and difference of ip address, subnet mask, gateway and network card, and DNS.

Example:

What does it mean to refer to the IP address setting interface in the Windows system (figure 1), IP address, subnet mask, default gateway and DNS server?

When learning about IP addresses, you will also encounter concepts such as network addresses, broadcast addresses, subnets, and so on. What does this mean?

One IP address

Overview

If the computer wants to realize network communication, it must have a network address for rapid location. IP address is the only identity of the computer in the network ID, and the real world express delivery needs to have a specific residential address is the same reason.

The ip address is represented by four decimal digits of the dot separator, each from 0 to 255. for example, the ip address of a host is: 128.20.4.1

Composition of IP addresses

IP address = network address + host address (also known as: host number and network number)

Think about why there are administrative divisions (countries, provinces, municipalities, streets, etc.), in order to manage and locate more efficiently.

Similarly, we usually divide the network into many subnetworks, each with its own network address, and each subnetwork is made up of many computers (of course, it can also contain another subnetwork).

To find the specified IP address, we just need to find the specified network address first, and then find the corresponding host address within the network.

The IP address is a 4 * 8bit (1 byte) numeric string consisting of 0 stroke 1 (IP4 protocol).

Take the IP address 192.168.1.168 and the subnet mask 255.255.255.0 in the win7 screenshot at the beginning of the article as an example, this address contains many meanings:

192.168.100.168 (IP address) = 192.168.1.0 (network address) + 0.0.0.168 (host address)

How is the network address and host address calculated? We need to learn the subnet mask simply first.

Second subnet mask (subnet mask) refer to "Baidu Encyclopedia-Subnet Mask"

How many bits are the network address and host address in IP? If you do not specify, you do not know which bits are network numbers and which are host numbers, which needs to be achieved through the subnet mask.

Overview

The subnet mask, also known as the netmask, address mask, and subnet mask, is a 4 * 8bit (1 byte) numeric string composed of 0Band 1.

Its function is to mask (mask) part of the IP address to divide it into two parts: the network address and the host address, and to indicate whether the IP address is on the local area network or on the remote network.

Through the subnet mask, the network can be divided into subnets, namely VLSM (variable length subnet mask), and small networks can also be merged into large networks, namely supernets.

The subnet mask cannot exist alone and must be used in conjunction with the IP address.

Rules for subnet mask

The length is 4 * 8bit (1 byte), which consists of consecutive 1s and consecutive zeros.

For example: 11111111.1111111111111111.00000000, corresponding to decimal: 255.255.255.0

Suppose that the IP address of computer An on the LAN is 192.168.1.1 and the subnet mask is 255.255.255.0, as shown in the following figure:

Assuming that the IP address is 192.168.1.168 and the subnet mask is 255.255.255.0, the network address conversion steps are as follows:

1) convert the IP address and subnet mask to binary respectively

192.168.1.168 converted into binary 11000000.10101000.00000001.10101000

255.255.255.0 converted into binary 11111111.11111111.11111111.00000000

2) operate the two together

3) convert the operation result to decimal: 192.168.1.0

Put into practice immediately

Take connecting two computers directly with a network cable as an example:

Here are several IP address settings to see if the network is connected or not under different settings.

Experiment

Serial number

Machine 1 machine 2 network connectivity IP address subnet mask network address IP address subnet mask network address 1192.168.0.1255.255.255.0192.168.0.0192.168.0.200255.255.255.0192.168.0.0Y2192.168.0.1255.255.255.0192.168.0.0192.168.1.200255.255.255.0192.168.1.0N3192.168.0.1255.255.255.192192. 168.0.0192.168.0.200225.225.225.192192.168.0.192N

Explanation: the first case can be connected because the two computers are in the same network 192.168.0.0, so they can communicate, while in the three cases, the two computers are in different networks, so they can't.

The process of calculating the network address is the same as above, so I will not repeat it.

Conclusion:

Computers connected directly with a network cable or through a HUB (hub) or an ordinary switch must be on the same network (network address) and the host address must be different in order to communicate.

Note: the same network does not refer to a physical connection, but to a network address.

For example, two computers are linked to the same router (simply understood as the same link), and they cannot communicate if they do not set the same network address.

Extension: IP segment representation

Example: 192.168.0.0 Universe 24

192.168.0.0: network address

24: represents the number of consecutive ones in the binary representation of the subnet mask, here: 11111111 11111111 11111111 00000000, that is, 255.255.255.0

five。 Default gateway (address)

Reference: Baidu Encyclopedia-Gateway

What is a gateway?

Can you associate it with the Customs? What is customs? )

Devices connecting two different networks can be called gateway devices; the function of the gateway is to realize the communication and control between the two networks.

Gateway devices can be interactive machines (three or more layers to cross the network), routers, servers with routing protocols enabled, proxy servers, firewalls, etc.

The gateway address is the IP address of the gateway device.

Suppose we have two networks:

The IP address range of network An is "192.168.1.1" 192.168.1.254 "with a subnet mask of 255.255.255.0.

The IP address range of network B is "192.168.2.1" 192.168.2.254 "and the subnet mask is 255.255.255.0.

To achieve communication between the two networks, it must be through the gateway.

If the 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 forwards it to the gateway of network B. the gateway of network B then forwards it to a host of network B (as shown in the attached figure). The process by which network A forwards packets to network B.

Only by setting the IP address of the gateway can the TCP/IP protocol realize the communication between different networks.

Default gateway

A host can have multiple gateways. The 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.

Extensions: automatically setting default gateway

Automatic setup uses DHCP (Dynamic Host Configuration Protocol, dynamic Host configuration Protocol) servers to automatically assign IP addresses, subnet masks and default gateways to computers in the network.

Once the default gateway of the network changes, as long as you change the setting of the default gateway in the DHCP server, all computers in the network will get the IP address of the new default gateway. This method is suitable for networks with large network scale and possible change of TCP/IP parameters.

Another way to obtain the gateway automatically is by installing the client program of proxy server software (such as MS Proxy), which is similar to DHCP in principle and method.

Extension description

Q: I saw some people on the Internet asking why they can't communicate if they are connected to a computer on the same (layer 2) switch or hub if they set a different network address.

Answer:

In TCP/IP protocol, when the packet of the network layer (identifying the communicator by the IP address) is handed over to the next data link layer (the communicator is identified by the MAC address), the MAC address corresponding to the target IP needs to be obtained through ARP broadcast.

However, because ARP messages can only be broadcast in the same network address, if the target computer and the source computer are in different networks, it can not respond, so the source computer can not complete the link layer data encapsulation.

Information about the ARP protocol can be found here.

Special note 1: a host can have multiple gateways. The default gateway means that when a host cannot find an available gateway, it will send the packet to the default gateway, which will process the packet.

Special statement 2: the network card (also known as the network adapter) is responsible for the physical layer and the data link layer. There is a MAC address on the network card, which corresponds to the ip address in the network layer. At the same time, the network card is also responsible for converting digital signals into optoelectronic signals to communicate with cables and optical cables. The gateway is the application of the network layer and is mainly responsible for the routing of ip addresses.

Introduction of six network cards

Gateways are different from network cards. The specific differences are as follows:

1. The difference in meaning

Gateway: a gateway through which one network is connected to another. That is, the network level.

Network card: a piece of computer hardware designed to allow computers to communicate over a computer network.

2. Differences in main functions

Gateway: a computer system or device that acts as an important task of transformation. Used between two systems with different communication protocols, data formats or languages, or even with completely different architectures, the gateway is a translator. Gateways can be used for both wide area network interconnection and local area network interconnection.

The main function of the network card is the encapsulation and unencapsulation of the data. When sending, the data transmitted from the upper layer is added to the head and tail to become the frame of Ethernet; the link management is mainly realized through the CSMA/CD protocol; data coding and decoding is one of the commonly used binary code line coding methods, which is used by the physical layer to encode a synchronous bit stream clock and data.

3. Differences in classification

Gateways are divided into transmission gateways, application gateways, signaling gateways, relay gateways, protocol gateways and so on. The application gateway performs protocol conversion on the application layer. The transmission gateway is used to establish a transmission connection between the two networks. Using transmission gateways, cascaded, point-to-point transmission connections across multiple networks can be established between hosts on different networks.

The types of computers supported by network cards are divided into standard Ethernet cards and PCMCIA network cards. Standard Ethernet cards are used for desktop computer networking, while PCMCIA network cards are used for notebook computers. According to the bus types supported by the network card, it can be divided into ISA, EISA, PCI and so on.

seven。 DNS server

Domain name and DNS

When we visit a website, we often use the domain name (clearer semantics and easier to remember than IP, such as www.baidu.com).

A domain name consists of a string of names separated by dots, which usually contains the name of the organization, and always includes a two-to three-letter suffix to indicate the type of organization or the country or region in which the domain is located.

However, the communication network communication between computers is carried out through IP, so it is necessary to resolve the domain name to the corresponding IP,DNS, which is the server for domain name resolution.

DNS maintains a comparison table of domain names (domain name) and IP addresses (IP address) to resolve the domain name of the message.

DNS maintains a comparison table of domain names (domain name) and IP addresses (IP address) to resolve the domain name of the message.

1. Enter the www.qq.com domain name in the browser, and the operating system will first check whether the local hosts file has this URL mapping relationship. If so, call the IP address mapping first to complete the domain name resolution.

2. If there is no mapping of this domain name in hosts, look for the local DNS parser cache to see if there is this URL mapping relationship. If so, return directly to complete the domain name resolution.

3. If there is no corresponding URL mapping relationship between hosts and the local DNS parser cache, we will first find the preferred DNS server set in the TCP/ip parameter, here we call it the local DNS server. When this server receives the query, if the domain name to be queried is included in the local configuration zone resources, the resolution result will be returned to the client to complete the domain name resolution.

4. If the domain name to be queried is not resolved by the local DNS server region, but the server has cached the URL mapping, the IP address mapping is called to complete the domain name resolution. This resolution is not authoritative.

5. If the local DNS server local zone file and cache resolution are invalid, the query will be made according to the settings of the local DNS server (whether to set the forwarder). If the forwarding mode is not used, the local DNS will send the request to 13 root DNS. After receiving the request, the root DNS server will determine who is responsible for the authorization and management of the domain name (.com), and will return an IP responsible for the top-level domain name server. When the local DNS server receives the IP information, it will contact the server responsible for the .com domain. After the server in charge of the .com domain receives the request, if it cannot resolve it, it will find a DNS server address (qq.com) to manage the next level of the .com domain to the local DNS server. When the local DNS server receives this address, it will find the qq.com domain server, repeat the above action, and query until the www.qq.com host is found.

6. If the forwarding mode is used, the DNS server will forward the request to the DNS server at a higher level, which will be parsed by the server at the next level. If the server at the next level cannot resolve the request, it can either find the root DNS or transfer the request to the superior in a loop. Whether the local DNS server uses a forwarding or root prompt, the result is finally returned to the local DNS server, which in turn returns the DNS server to the client.

At this point, I believe you have a deeper understanding of "ip address, subnet mask, gateway and network card, what is the use and difference of DNS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report