Subnet mask (NETMASK), IP address, default gateway

Source: Internet
Author: User

Subnet Mask:

What is a subnet mask subnet mask cannot exist alone,
It must be used in conjunction with an IP address. The subnet mask has only one effect,

is to divide an IP address into two parts: network address and host address.

The subnet mask setting must follow certain rules. Same as IP address

For example, the subnet mask 255.255.255.0 into binary is

11111111.11111111.11111111.00000000

The subnet mask must be multiple 1 connected, with multiple 0 connected forms, a total of 8 * 4 = 32 bits.

1 is part of the network address part 0 is the host address part

255.255.255.0 This subnet mask can accommodate 2 of the 8-square (set) computer, which is 256, but there are two IP is not available, the number of bits is 0 for the network number is all 1-bit broadcast number, minus the two, is 254 units.

The subnet mask setting for the IP address is not arbitrary. If the subnet mask is set too large, that is, the subnet range is enlarged, then, according to the subnet path rule, it is likely to be sent to the local machine is not in the same subnet of the destination machine data, because of the wrong judgment and think that the destination machine is in the same subnet, then the packet will be in the network loop, until the timeout and So that the data does not reach the destination machine correctly, causing the network transmission error, if the subnet mask is set too small, then the communication between the machines belonging to the same subnet as cross-subnet transmission, the packet is given to the default gateway processing, which will inevitably increase the burden of the default gateway, resulting in network efficiency degradation. Therefore, the subnet mask should be set based on the size of the network.

A simple way to code a seed mesh mask:

192.163.1.199/24

The/24 behind the IP is the subnet mask 255.255.255.0, which means that the network bit is 24 bits, which is the binary left 24 1

IP Address:

is a 32bit address assigned to each host that is connected to the Internet.

The address consists of two parts, one for the network address and the other for the host address.

IP addresses are divided into categories A, B, C, D, E 5. Commonly used are classes B and C two.

The number of bits of network address directly determines the network that can be allocated;

The number of bits in the host address determines the maximum number of hosts in the network.
Class A address: Network bit 8 (7) bit + host bit 24-bit, 0****************************
IP range: 1.0.0.0--126.255.255.255
127 network bits are local test addresses and cannot be used for data communication.
IP range: 127.0.0.0--127.255.255.255
Class B Address: Network bit 16 (14) bit + host bit 16 bit, 10***************************
IP range: 128.0.0.0--191.255.255.255
Class C Address: Network bit 24 (21) bit + host bit 8-bit, 110**************************
IP range: 192.0.0.0--223.255.255.255
d:224.0.0.0--239.255.255.255
e:240.0.0.0--255.255.255.255

Default gateway:

So what exactly is a gateway? A gateway is essentially an IP address of a network to another network. For example, network A and network B, network A's IP address range is "192.168.1.1~192." 168.1.254 ", the subnet mask is 255.255.255.0, and the IP address range for Network B is" 192.168.2.1~192. 168.2.254 ", the subnet mask is 255.255.255.0. In the absence of a router, TCP/IP communication between the two networks is not possible, even if the two network connections on the same switch (or hub), the TCP/IP protocol will determine the subnet mask (255.255.255.0) on the two network hosts in a different network. To achieve communication between the two networks, you must pass through the gateway. If the host in Network a discovers that the destination host for the packet is not on the local network, forwards the packet to its own gateway, which is then forwarded by the gateway to Network B's gateway, and the gateway of Network B is forwarded to a host on network B. The same is true of network B's process of forwarding packets to network A. To achieve communication between the two networks, you must pass through the gateway. If the host in Network a discovers that the destination host for the packet is not on the local network, forwards the packet to its own gateway, which is then forwarded by the gateway to Network B's gateway, and the gateway of Network B is forwarded to a host on network B. The same is true for network B to forward packets to network a so that only the IP address of the gateway is set up, the TCP/IP protocol can realize the communication between different networks. So which IP address is the IP address of the machine? The IP address of the gateway is the IP address of the device with the routing capability, a router with routing capabilities, a server with a routing protocol enabled (essentially a router), a proxy server (also equivalent to a router)

Subnet mask (NETMASK), IP address, default gateway

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.