MAC address and IP address, subnet mask, and default gateway

Source: Internet
Author: User

MAC address
MAC (Media access control or medium access control) address, which is a translation of media access controls, or physical addresses, hardware addresses, to define the location of network devices. In the OSI model, the third layer of the network layer is responsible for the IP address, and the second layer of data link is responsible for the MAC address. So a host will have a MAC address, and each network location will have an IP address dedicated to it. [1]The MAC address is determined by the NIC and is fixed.
IP is a virtual address
Mac is a network card address there's only one thing in the world that doesn't repeat

First, IP address

for IP addresses, I believe everyone is familiar with the 32-bit address assigned to the host using the TCP/IP protocol. The IP address is composed of 4 88-bit groups separated by dots, such as 192.168.0.1 is an IP address, which is called dotted decimal format.
The IP address consists of the network address and the host address, and the number of bits assigned to the two parts varies with the address class (Class A, Class B, Class C, and so on). The network address is used for routing, and the host address is used to find a separate host within the network or subnet.
An IP address makes it possible for future data from source addresses to be routed to the destination address.

Second, MAC address

for MAC address, because we do not directly contact with it, so people are not necessarily familiar. In the OSI (Open System interconnection, open systems interconnect) 7-Layer Network Protocol (physical layer, Data link layer, network layer, transport layer, Session layer, presentation layer, Application layer) Reference Model, the second layer is the data link layer.
It contains two sub-layers, the previous layer is the logical link control (llc:logical link controls), the next layer is the MAC (media access control) layer we mentioned earlier, that is, the media access controls layer. The so-called medium (Media), refers to the transmission of the signal through a variety of physical environment. Common network media including cable
(such as: twisted pair, coaxial cable, optical fiber), as well as microwave, laser, infrared, etc., sometimes referred to as physical media.
The MAC address is also called the physical address, hardware address, or link address, which is written by the network device manufacturer when it is produced inside the hardware. This address is not related to the network, that is, regardless of the hardware with this address (such as network cards, hubs, routers, etc.) access to the network where, it has the same MAC address, MAC address is generally immutable, can not be set by the user.
What is a subnet mask and default gateway 
What is a subnet mask
The subnet mask cannot exist alone, it must be used in conjunction with an IP address. The subnet mask has only one function, which is to divide an IP address into two parts: network address and host address.
The subnet mask setting must follow certain rules. The same as the IP address, the length of the subnet mask is also 32 bits, the left is the network bit, with the binary number "1", the right is the host bit, the binary number "0" is represented. The accompanying figure shows the binary control of the IP address "192.168.1.1" and the subnet mask as "255.255.255.0". Among them, "1" has 24, representing the corresponding IP address to the left 24 bits is the network number; "0" has 8, representing the corresponding IP address to the right of the 8-bit is the host number. In this way, the subnet mask determines which of the 32-bit binary digits of an IP address are the network number and which are the host numbers. This is very important for the network with TCP/IP protocol, only through the subnet mask, it can indicate the relationship between the subnet of one host and other subnets, and make the network work properly.
Common subnet Masks
There are hundreds of subnet masks, only the most commonly used two-seed netmask, which are "255.255.255.0" and "255.255.0.0", respectively.
1. The subnet mask is a network of "255.255.255.0": the last digit can be changed arbitrarily within the 0~255 range, so 256 IP addresses can be provided. However, the actual number of IP addresses available is 256-2, or 254, because the host number cannot be all "0" or all "1".

2. The subnet mask is a network of "255.255.0.0": the next two digits can be arbitrarily varied within the 0~255 range, providing 2,552 IP addresses. However, the actual number of IP addresses available is 2552-2, or 65,023.

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.

If a network of no more than 254 computers, the use of "255.255.255.0" as a subnet mask, and now most of the local area network will not exceed this number, so "255.255.255.0" is the most commonly used IP address subnet mask , I see the largest school campus network with more than 1500 computers, this size of the local area network can use "255.255.0.0".

Default Subnet mask

In Windows Server, if you assign an IP address to a network card, a default subnet mask is automatically populated. This is the subnet mask that Windows Server automatically generates in order to save user input time. For example, the local area network most commonly used IP address "192.168.x.x" The default subnet mask is "255.255.255.0". In general, the IP address is available using the default subnet mask.

It's like a room can have more than one door, 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 handles the packet. The gateway used by the host is now generally referred to as the default gateway.
How to set the default gateway

?? The default gateway for a computer cannot be specified casually and must be specified correctly, or a computer will send the packet to a computer that is not a gateway, so that it cannot communicate with other computers on the network. The default gateway is set up manually and automatically in two different ways.

?? 1. Manual Setup

?? Manual settings are suitable for situations where the number of computers is relatively small and the TCP/IP parameters are basic, such as only a few to more than 10 computers. Because this method needs to set the "default gateway" on each computer in the network, it is very laborious, if the IP address of the default gateway must be modified because of the migration and so on, it will cause great trouble to the network management, so it is not recommended.

?? In Windows 9x, the way to set the default gateway is to right-click on "My Network Places", click "Properties" in the pop-up menu, select "TCP/IP protocol" in the Net Properties dialog box, click on "Properties", and in the "Default Gateway" tab, fill in the IP address of the new default gateway.

?? It is important to note that the default gateway must be the IP address in the computer's own network segment, not the IP address in other network segments.

?? 2. Automatic Setup

?? Automatic provisioning is the use of a DHCP server to automatically assign IP addresses, subnet masks, and default gateways to computers in your network. The advantage of this is that once the default gateway for the network changes, all computers in the network get the IP address of the new default gateway as long as the settings for the default gateway in the DHCP server are changed. This method is suitable for networks with large network size and possible changes of TCP/IP parameters.

?? Another way to automatically obtain a gateway is by installing Proxy Server software (such as MS Proxy) of the client program to automatically obtain, its principle and method and DHCP have similarities. As space is limited, it is no longer detailed.

MAC address and IP address, subnet mask, and 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.