Differences and connections between MAC addresses and IP addresses (Computer Network)

Source: Internet
Author: User

Differences and connections between MAC addresses and IP addresses (Computer Network)
Recently, I took a test and always encountered mac address problems. So I did some research online. I remember that I learned this knowledge when I was a sophomore, I have basically returned it to Mr. Huang Peijie, but I am very grateful to him for his patience and responsibility in teaching us the principles of computer composition. At least I still remember that he had brought us a lot of good university memories.
Differences and connections between MAC addresses and IP addresses

Simply put, the IP address is provided by the service provider, and the mac address is the physical address of your Nic. I. I believe everyone is familiar with the IP address, that is, the 32-bit address assigned to the host using the TCP/IP protocol. An IP address consists of four octal groups separated by dots. For example, 192.168.0.1 is an IP address, which is written in dotted decimal format. An IP address consists of A network address and A host address. The number of BITs assigned to these two parts varies with the address class A, B, and C. The network address is used for routing, while the host address is used to find a separate host in the network or subnet. An IP address makes it possible to transmit data from the source address to the destination address through a route. 2. MAC addresses are not necessarily familiar with MAC addresses because they are not directly in contact with them. In the OSI (Open System Interconnection) layer-7 network protocol (physical layer, data link layer, network layer, transmission layer, Session Layer, presentation layer, application layer) reference model, the second layer is the Data Link ). It contains two sub-layers. The upper layer is Logical Link Control (LLC: Logical Link Control), and the lower layer is the Media Access Control layer we mentioned earlier, media Access Control Layer. Media refers to the various physical environments through which signals are transmitted. Commonly used network media include cables (such as twisted pair wires, coaxial cables, and optical fibers), as well as microwave, laser, and infrared rays, which are sometimes called physical media. A mac address is also called a physical address, hardware address, or link address. It is written into the hardware when produced by a network device manufacturer. This address has nothing to do with the network, that is, no matter where the hardware with this address (such as NIC, Hub, or router) is connected to the network, it has the same MAC address, generally, the MAC address cannot be changed and cannot be set by the user. 3. The length, representation method, allocation method, and uniqueness of the MAC address are 48 bits (6 bytes), usually expressed as 12 hexadecimal numbers, separate Two hexadecimal numbers with colons. For example, 08: 00: 20: 0A: 8C: 6D is a MAC address, the first six hexadecimal digits 08:00:20 represent the number of the network hardware manufacturer, which is allocated by the IEEE (Istitute of Electrical and Electronics Engineers, Association of Electrical and Electronics Engineers, the last three hexadecimal numbers 0A: 8C: 6D represent the serial number of a network product (such as a NIC) manufactured by the manufacturer. Each network manufacturer must ensure that each Ethernet device it creates has the same first three bytes and different last three bytes. This ensures that each Ethernet device in the world has a unique MAC address. 4. IP address and MAC address in the Internet connection. Since each Ethernet device has a unique MAC address at the factory, why do I need to assign an IP address to each host? Or why is each host assigned a unique IP address? Why is a unique MAC address embedded in the production of network devices (such as network adapters, hubs, routers, and so on? The main reasons are as follows: (1) IP Address allocation is based on the topological structure of the network, rather than based on who made the network settings. If an efficient routing scheme is built on the basis of the device manufacturer rather than the topological location of the network, this scheme is not feasible. (2) When there is an additional layer of address addressing, the device is easier to move and maintain. For example, if an Ethernet Card is broken, it can be replaced without getting a new IP address. If an IP host is moved from one network to another, you can give it a new IP address instead of a new Nic. (3) communication between computers in the LAN or Wide Area Network eventually means that data packets are transmitted from one node to another starting from the initial node on a certain form of link, finally transmitted to the target node. ARP (Address Resolution Protocol: Address Resolution Protocol) is responsible for ing IP addresses to MAC addresses. Let's take an example to see how IP addresses and MAC addresses are combined to send packets. Assume that A packet (called PAC) is sent from A host in Beijing (named A, IP address IP_A, MAC address MAC_A) to A host in Washington (named B, the IP address is IP_ B, And the MAC address is MAC_ B ). The two hosts cannot be directly connected. Therefore, data packets must pass through many intermediate nodes (such as routers and servers) during transmission ), we assume that during transmission, C1, C2, and C3 (their MAC addresses are M1, M2, and M3 respectively) are required. Before sending a pac, A sends an ARP request to find the MAC address M1 of C1, the first intermediate node that must be passed to IP_ B, then encapsulate these addresses in the data packet: IP_A, IP_ B, MAC_A, and M1. After a PAC is transferred to C1, ARP finds the MAC address M2 of the second intermediate node C2 Based on the IP address IP_ B, then, the data packet with M2 is sent to C2. And so on, until the MAC_ B address of host B with the IP address IP_ B is found, and finally sent to host B. During transmission, IP_A, IP_ B, and MAC_A remain unchanged, while the MAC address of the intermediate node is constantly changing through ARP (M1, M2, M3) until the target address is MAC_ B. Based on the above, we can conclude that the similarities between IP addresses and MAC addresses are unique. The main characteristics of different IP addresses are as follows: 1. for a device on the network, such as a computer or a router, its IP address can be changed (but must be unique), while the MAC address cannot be changed. You can specify any IP address for a host as needed. For example, you can assign an IP address of 192.168.0.112 to a computer on the LAN, or change it to 192.168.0.200. Once a network device (such as a NIC or vro) is created, its MAC address is always unique and cannot be changed by the user. 2. different lengths. The IP address is 32 bits and the MAC address is 48 bits. 3. Different allocation bases. IP Address allocation is based on network topology, while MAC Address allocation is based on the manufacturer. 4. The Addressing protocol layer is different. The IP address is applied to the Layer 3, that is, the network layer, and the MAC address is applied to the Layer 2, that is, the data link layer. The data link layer protocol transfers data from one node to another node on the same link (through the MAC address ), the Network Layer Protocol allows data to be transmitted from one network to another (ARP finds the MAC address of the intermediate node based on the destination IP address and transmits it through the intermediate node to reach the destination network ).


What is the difference between a mac address and an IP address?

An IP address is the IP address used by the Internet protocol, while a MAC address is the IP address used by the Ethernet protocol. There is no inevitable relationship between the IP address and the MAC address. the MAC address is the address on the Ethernet card and the length is 48 bits. Each Ethernet NIC manufacturer must apply for a set of MAC addresses from the IEEE organization and write a unique MAC address to the serial EEPROM of the NIC during Nic production. The MAC addresses of any two Ethernet NICs should not be the same from any manufacturer. Ethernet chip manufacturers do not have to apply for MAC addresses. MAC addresses exist in each Ethernet packet and are part of the Ethernet packet header, the Ethernet switch implements packet switching and Transmission Based on the MAC source address and MAC Destination Address in the Ethernet packet header. An IP address is an Internet Protocol address. Each Internet package must contain an IP address. Each Internet Service Provider (ISP) must apply for a group of IP addresses from the relevant organization, and then dynamically assign them to users. The IP address is now 32-bit long and is being expanded to 128-bit. The IP address has nothing to do with the MAC address, because the Ethernet user can still connect to the Internet through the Modem to obtain a dynamic IP address, which can be inconsistent each time. The IP address usually works on the WAN, And the router processes the IP address. MAC addresses work in local networks. The interconnection between local networks is usually through the existing public network or dedicated line, and inter-network protocol conversion is required. IP address information can be transmitted on the Ethernet. At this time, the IP address is only part of the data domain of the Ethernet information package. The Ethernet switch or processor does not see the IP address, but uses it as common data processing.

Related Article

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.