IP address, subnet mask, default gateway, DNS server details

Source: Internet
Author: User
Tags comparison table domain name server

In order to learn more about the TCP/IP protocol, I have read a lot of relevant information recently and collected the following records for later use and convenience:

 

What does IP address, subnet mask, default gateway, and DNS server mean?

(1) Problem Analysis

001. Q: What is the difference between IP address, subnet mask, default gateway, and DNS server?I know that I cannot access the Internet without an IP address, and I know that I cannot access the Internet without a DNS.But what are their functions and differences? It's strange that my computer has no DNS and can access QQ, but cannot open the webpage. Why?>

A: The IP address is a 32-bit binary data, which is usually expressed in decimal format and separated. An IP address is a logical address used to identify a host in the network. The IP address is unique, that is, the IP address of each machine is unique in the world.
DNS is a domain name server used to resolve the domain name (resolution between the domain name and IP address). If there is no such thing, you must enter the IP address of the website, with DNS, you can enter the URL directly. 
Because QQ does not need DNS (QQ is only a client program and cannot use DNS), it is only used to browse the Web page (when the web site needs to be entered.


(2) DNS Server

DNSDomain Name Server ). Domain names and IP addresses on the Internet correspond one by one. Although domain names are easy to remember, machines can only know each other's IP addresses. The conversion between them is called domain name resolution, domain name resolution must be completed by a dedicated domain name resolution server. DNS is the server for domain name resolution.

The software that translates a domain name into an IP address is called the Domain Name System (DNS. It stores a table of domain names and corresponding IP addresses to resolve the domain names of messages. A domain name is the name of a computer or computer group on the Internet. It is used to identify the electronic location (or geographic location) of a computer during data transmission ). A domain name is composed of a string of names separated by dots. It usually contains the Organization Name and always contains two to three letter suffixes, to specify the type of the Organization or the country or region where the domain is located. Domain Name Server Introduction: http://baike.baidu.com/view/543329.htm

 

Most of us use Google.com for search, but have you ever wondered why you can connect to Google's server by entering Google.com in your browser? Hmm ...... To understand this, we need to understand the concept of Domain Name Server (DNS.

Just as in real life, people distinguish each other by name, in the world of computer networks, different computers are differentiated by the IP addresses assigned to them. There are two types of IP addresses: public and private. Generally, servers use public addresses because they are accessible to millions of computers around the world. As for your PC connected to a vro, it usually gets a private IP address. Because the number of public addresses is limited, it is very popular to build local networks (built under a route with a public IP address) and use private addresses.

Tasks such as memory IP addresses are difficult for most people, so each server has a name (such as Google.com ). In this way, the end user only needs to remember the name, enter it in the browser, and press Enter. Now let's take a look at what happened after you enter a name in the browser and press Enter. First, you need to convert the domain name to the corresponding IP address. To complete this task, you need to send a DNS request to the default gateway (in most cases, the router. A DNS server address is configured for the route. This address is the destination of the DNS request.

The DNS server is used to convert a domain name to an IP address. When the DNS server receives a request, it checks whether the request has the required conversion information. If this conversion information is not provided, the DNS server forwards this request to other DNS servers. In this way, the conversion from the domain name to the IP address is completed. The conversion result is then sent back to the requesting computer.

Reference: http://network.51cto.com/art/201406/442086.htm
(3) IP Address

To implement network communication between computers, you must have a valid IP address.IP address = network address + host address (also known as host number and network number)The IP address structure enables convenient addressing on the Internet. Generally, IP addresses are displayed in four decimal numbers separated by dots. Each number ranges from 0 to 255. For example, the IP address of a host is 128.20.4.1.In the LAN, IP addresses are also required. Generally, the IP addresses in the Intranet start with 192.168, which makes it easy to distinguish public and Intranet IP addresses..


Thoroughly understand the meaning of IP addresses

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. The network can only be accessed if the IP addresses are correctly set, what do these terms mean? When I learn about IP addresses, I also encounter concepts such as network addresses, broadcast addresses, and subnets. What do they mean?



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 users in North Street are their broadcast range,If there are 20 users in North Street, the broadcast address is No. 21 North Street. That is to say, any user in North Street can hear the "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: Address of the last resident + 1In 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 do we need to know how to calculate these addresses? First, we need to understand the principle that the purpose of learning the network is to allow computers in the network to communicate with each other, that is to say, we need to learn and understand the concepts in the network around the word "tong", rather than just a few nouns.

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


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. Figure 3 uses a network cable (crossover line) to directly connect the two computers. the following 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 the computer can communicate normally.

2. If the address of Host 1 remains unchanged 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, 255.255.255.255.192. The computer cannot communicate normally.



Figure 3

In 1st cases, the two computers are in the same network as 192.168.0.0, so the two computers are in different networks.

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 in 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. as shown in the preceding example, 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 that the computer in the network is not in the same network, and the computer will be able to access without being able to access the network.Note: here we are talking about IP addresses rather than physical connections in different networks. How can we calculate them?


2. How to calculate the network address (subnet mask)

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, we must useSubnet Mask.
The calculation process is like this: Convert the IP address and subnet mask into binary, 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.



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.

Thanks for the rain http://new.qzone.qq.com/649329690/blog/9


(4) Subnet Mask

The subnet mask is used to determine whether the IP addresses of any two computers belong to the same subnetwork. The simplest understanding is that after the IP addresses and subnet masks of the two computers perform the and operation, the results are the same. It means that the two computers are on the same subnet, direct communication is supported.. (The meanings of subnet masks are to be added .)

(5) Default Gateway

What is a gateway?

So what is the gateway? A gateway is essentially an IP address from a network to another network. For example, if Network A and Network B exist, the IP address range of Network A is "192.168.1.1 ~ 192. 168.1.254 ", The subnet mask is 255.255.255.0, And 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. Without a router, the two networks cannot communicate with each other through TCP/IP, even if the two networks are connected to the same vswitch (or hub, the TCP/IP protocol also determines that the hosts in the two networks are in different networks based on the subnet mask (255.255.255.0. To realize the communication between the two networks, you must use the gateway. If the host in Network A finds that the destination host of the data packet is not in the local network, it forwards the data packet to its own gateway, and then the gateway forwards the data packet to the gateway of Network B, the gateway of Network B is then forwarded to a host of Network B (as shown in the figure below ). The process in which network a forwards data packets to Network B. Therefore, only the IP address of the gateway can communicate with each other through the TCP/IP protocol. Which machine is the IP address? The IP address of a gateway is the IP address of a device with the routing function. A device with the routing function has a router and a server with the routing protocol enabled (essentially equivalent to a router), proxy server (also equivalent to a vro ). In the context of interaction with Novell Netware, the server information Block (SMB) protocol used by the gateway in the Windows Network and the NetWare Core Protocol (NCP) used by the NetWare network) it serves as a bridge. A gateway is also called an IP router.
For example, assume that your name is xiaodiandian (very small). You live in a large courtyard, and your neighbors have many friends. Your parents are your gateway. When you want to play with a friend in the yard, as long as you shout out his name in the yard, he will respond to you when he hears it and runs out to play with you. However, your parents do not allow you to go out of the door. If you want to contact the outside world, You must contact your parents (GATEWAY) by phone. If you want to chat with your classmate James, James lives in another yard far away and has his parents (James's gateway) at home ). But you don't know the phone number of James's house, but your teacher in charge has a list of all the students in your class and a phone number comparison table. Your teacher is your DNS server. So you had the following conversation with your parents at home: 1. Click mom (or dad). Can I ask the class teacher to check James's phone number? 2. Parents: Well, you are waiting. (Then, your parent hangs up a phone number for your class teacher and asks james's phone number clearly.) Ask, his phone number is 211.99.99.993. No small point: Great! Mom (or dad), I want to contact James. Could you help me contact James. 4. Parent: No problem. (Then, the parents sent a request to connect the phone number of Xiaoming's house to the telephone Bureau. The last pass was, of course, transferred to the parents of Xiaoming's house, and then the parents sent the call to James ). in this way, you have contacted James.

Gateway example

Gateway concept Source: http://baike.baidu.com/view/807.htm


What is the default gateway?

If you find out what the gateway is, the default gateway is easy to understand. Just like a room can have multiple doors, a host can have multiple gateways. The default gateway means that if a host cannot find an available gateway, it sends data packets to the default gateway, which processes data packets. The gateway currently used by the host generally refers to the default gateway.


How to set the Default Gateway

The default gateway of a computer cannot be specified at will, and must be correctly specified. Otherwise, a computer will send data packets to a computer that is not the gateway, and thus cannot communicate with other networks.The default gateway can be set manually or automatically.

1. manually set

Manual settings are applicable when the number of computers is small and the TCP/IP parameters remain unchanged. For example, there are only a few to a dozen computers. This method requires setting the "Default Gateway" on each computer connected to the network, which is very difficult. Once the IP address of the default gateway must be modified due to migration or other reasons, this will cause a lot of trouble to the network management, so it is not recommended.

In Windows 9x, you can set the Default Gateway by right-clicking "Network neighbors" and clicking "properties" in the pop-up menu ", in the network Properties dialog box, select "TCP/IP protocol" and click "properties". On the "Default Gateway" tab, enter the IP address of the new default gateway.

Note that the default gateway must be an IP address in the CIDR block where the computer is located, rather than an IP address in another CIDR block.

2. Automatic settings

Automatic setting is to useDHCP (Dynamic Host Configuration Protocol, Dynamic Host Configuration Protocol) ServerTo automatically assign IP addresses, subnet masks, and default gateways to computers on the network. The advantage of this is that once the default gateway of the network changes, you only need to change the settings of the default gateway in the DHCP server, then all the computers on the network obtain the IP address of the new default gateway. This method is applicable to networks with large network sizes and variable TCP/IP parameters. Another way to automatically obtain the gateway is to automatically obtain the Gateway by installing the agent server software (such as MS proxy) client program. Its principles and methods are similar to those of DHCP. Due to space limitations, we will not go into detail anymore.

 

Reprinted please indicate the source: http://www.cnblogs.com/JuneWang/p/3917697.html

 

Source: http://www.cnblogs.com/songQQ/archive/2009/05/27/1490612.html

Http://baike.baidu.com/view/807.htm

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.