Network basics (ip subnet mask port DNS gateway)

ip address

The address format is: IP address = network address + host address or IP address = network address + subnet address + host address

Class A IP: from 0.0.0.0 – 127.255.255.255

Type B IP: from 128.0.0.0 – 191.255.255.255

Type C IP: from 192.0.0.0 – 223.255.255.255

1 . Class A IP address A Class A IP address consists of a 1-byte network address and a 3-byte host address. The highest bit of the network address must be "0". There are 126 available Class A networks, and each network can accommodate more than 16.7 million hosts.

 2 . Class B IP address A Class B IP address consists of a 2-byte network address and a 2-byte host address. The highest bit of the network address must be "10". There are 16,382 available Class B networks, and each network can accommodate more than 60,000 hosts.

 3 . Class C IP address A Class C IP address consists of a 3-byte network address and a 1-byte host address. The highest bit of the network address must be "110". Class C networks can reach more than 2.09 million, and each network can accommodate 254 hosts.

In fact, there are Class D addresses and Class E addresses. However, these two types of addresses have special purposes. Here is just a brief introduction: Type D addresses are called broadcast addresses and are used by special protocols to send information to selected nodes. Class E addresses are reserved for future use.

Among the three main types of IP addresses, three areas are reserved as private addresses, and their address ranges are as follows:

Class A address: 10.0.0.0 ~ 10.255.255.255

Class B address: 172.16.0.0 ~ 172.31.255.255

Class C address: 192.168.0.0 ~ 192.168.255.255

Subnet mask

ip must be used in conjunction with the subnet mask. The subnet mask numbers are only 255 and 0 (except for non-standard subnet masks). The number corresponding to 255 in the IP address indicates the network segment,

For example, the subnet mask of 192.168.1.1 is 255.255.255.0, then 192.168.1. These three numbers mean that 192.168.1.2 and 192.168.1.3 are on the same network segment.

Generally use the standard subnet mask :

Class A ip: 255.0.0.0 

Class B ip: 255.255.0.0 

Class C ip: 255.255.255.0

port

Function: ip can lock a physical machine, corresponding to a network card, the network card sent by the outside world will receive. But the problem is coming, the network card provides an interface for the program, you listen to me, if there is news, I will forward it to you. So that the application can receive the data. But the question is coming, both program A and program B need to monitor the network card to receive and send data. The network card says to whom do I send the received data?

This is the role of the port, each service has a specific port listening! No need to worry about computer miscalculation

classification:

1. Well Known Ports

      Well-known ports are well-known port numbers ranging from 0 to 1023, of which port 80 is allocated to WWW service, port 21 is allocated to FTP service, etc. When we enter a URL in the address bar of IE, we do not need to specify the port number, because the port of the WWW service is "80" by default .

The network service can use other port numbers. If it is not the default port number, you should specify the port number on the address bar by adding a colon ":" ( half-width ) after the address and then the port number . For example, use "8080" as the WWW service port, you need the address bar , enter "address: 8080" inside.

However, some system protocols use a fixed port number, which cannot be changed. For example, port 139 is used exclusively for communication between NetBIOS and TCP / IP, and cannot be changed manually.

2. Dynamic Ports

The range of dynamic ports is from 49152 to 65535. The reason it is called a dynamic port is because it generally does not allocate a certain service fixedly, but dynamically allocates it.

3. Registration port

Ports 1024 to 49151 are allocated to user processes or applications. These processes are mainly some applications that the user chooses to install, rather than the commonly used programs that have been assigned well-known ports. When these ports are not occupied by server resources, they can be dynamically selected as source ports by the client.

According to the different types of services provided , the ports are divided into two types, one is the TCP port and the other is the UDP port. TCP port and UDP port. Since the two protocols of TCP and UDP are independent, the respective port numbers are also independent of each other. For example, TCP has 235 ports, and UDP can also have 235 ports. The two do not conflict . But generally only one is used at the same time, TCP uses port 50, and UDP leaves this port empty

DNS

Domain name resolution server turns domain name such as www.sina.com into IP address 56.104.117.201 (domain name is easy to remember)

Gateway

Function: The gateway is essentially the IP address of a network leading to other networks. For example, there are network A and network B, the IP address range of network A is "192.168.1.1 ~ 192. 168.1.254", the subnet mask is 255.255.255.0; the IP address range of network B is "192.168.2.1 ~ 192.168. 2.254 ", the subnet mask is 255.255.255.0. Without a router, there is no TCP / IP communication between the two networks. Even if the two networks are connected to the same switch (or hub), the TCP / IP protocol will be based on the subnet mask (255.255 .255.0) Determine that the hosts in the two networks are on different networks. To achieve communication between these two networks, you must pass 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, and then the gateway forwards it to the gateway of network B, and the gateway of network B forwards it to some of network B. Host (as shown in the figure).

The gateway used by the host now generally refers to the default gateway . In a general router network, the most common default gateways are: 192.168.1.1 and 192.168.0.1, which is the default IP address of the router's LAN interface. Of course, some smart routers will use other IP addresses as the default gateway, which is mainly set by the router manufacturer before leaving the factory.

To connect to the external network, DNS and gateway must be configured. These two are not used to connect other computers in the LAN.

Published 59 original articles · Likes46 · Visits 30,000+

Guess you like

Origin blog.csdn.net/sinat_41852207/article/details/88820936