MAC address and IP address difference and contact (computer network article)

Source: Internet
Author: User

recently take an exam, always encounter the problem of MAC address, so in the online to do a knowledge collation, remember these knowledge or sophomore time learned, has basically returned to Huang teacher, but thank him patiently and responsibly to teach us the principle of computer knowledge, At least remember that he had brought us a lot of good college memories.
MAC address and IP address difference and contact
Simply put: The IP address is the service provider to you, the MAC address is the physical address of your network card. IP address for IP address, I believe everyone is familiar with, that is, the use of TCP/IP protocol assigned to the host 32-bit address. 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. Commonly used network media including cables (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. Third, the length of the MAC address, the method of representation, the method of allocation and its unique MAC address length is 48 bits (6 bytes), usually expressed as 12 16 binary number, each 2 16 binary number separated by a colon, such as: 08:00:20:0A:8C:6D is a MAC address, The first 6-bit 16-digit 08:00:20 represents the number of the network hardware manufacturer, which is assigned by the IEEE (Istitute of Electrical and Electronics Engineers, Institute of Electrical and Electronics Engineers), and then 3 bits of 16 binary 0a:8c 6D represents 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 manufactures has the same first three bytes and a different last three bytes. This will guaranteeEvery Ethernet device in the world has a unique MAC address. Four, the role of IP address and MAC address in the interconnection network since each Ethernet device has a unique MAC address at the factory, why do you need to allocate an IP address for each host? Or why is it that every host is assigned a unique IP address, and why should a unique MAC address be embedded in the production of network devices such as NICs, hubs, routers, etc.? The main reasons are as follows: (1) The allocation of IP addresses is based on the topology of the network, not on who created the network settings. It is not feasible to build efficient routing schemes on the basis of equipment manufacturers rather than on the topological locations where the network is located. (2) The device is easier to move and repair when there is an additional layer address addressing. For example, if an Ethernet card is broken, it can be replaced without having to obtain a new IP address. If an IP host moves from one network to another, it can give it a new IP address without having to change a new network card. (3) The communication between the local area network and the computer in the wide area network, the end result is that the packet from the initial node of some form of link, from one node to another node, and eventually transferred to the destination node. The movement of packets between these nodes is done by the ARP (address Resolution Protocol: Addresses resolution Protocol) that maps the IP address to the MAC address.  Let's look at an example of how IP addresses and MAC addresses are combined to transmit packets. Suppose the network is going to send a packet (named PAC) to a host in Beijing (called the A,ip address of the Ip_a,mac address of mac_a) to one of the hosts in Washington (with the name B,IP address Ip_b,mac address mac_b). The two hosts can not be directly connected, so the packet is passed through a lot of intermediate nodes (such as routers, servers, etc.), we assume in the transmission process through C1, C2, C3 (its MAC address is m1,m2,m3) three nodes. A before the PAC is emitted, send an ARP request to find the MAC address M1 of the First intermediate node C1 that it must go through to reach ip_b, and then encapsulate (encapsulation) These addresses in their packets: ip_a, Ip_b,mac_a, and M1. When the PAC is passed to C1, it is ip_b by ARP according to its destination IP address, finds the MAC address M2 of the Second intermediate node C2 it is going through, and then transmits the packet with M2 to C2. So and so on, until finally found the address of the Host B with the IP address of ip_b Mac_b, eventually transmitted to host B. Ip_a, Ip_b, and mac_a are not changed during transmission, while the MAC ground of the intermediate nodesThe address is constantly changing through ARP (M1,M2,M3) until the destination addresses are mac_b. Synthesis of the above, we can conclude that the IP address and MAC address the same point is they are unique, different features are: 1. For a device on a network, such as a computer or a router, its IP address is variable (but must be unique), and the MAC address is immutable. We can assign an arbitrary IP address to a host as needed, as we can assign an IP address of 192.168.0.112 to a computer on the LAN or change it to 192.168.0.200.  and any network device (such as network card, router) once produced, its MAC address is always unique and can not be changed by the user. 2. Different lengths.  The IP address is 32 bits and the MAC address is 48 bits. 3. The distribution basis is different.  The allocation of IP addresses is based on network topology, and the allocation of MAC addresses is based on the manufacturer. 4. The Addressing protocol layer is different. The IP address is applied to the third layer of the OSI, the network layer, while the MAC address is applied to the second layer of the OSI, the data link layer. The Data Link layer protocol enables data to be passed from one node to another on the same link (via MAC address), while the Network layer protocol enables data to be passed from one network to another (ARP locates the MAC address of the intermediate node based on the destination IP address, transmits through the intermediary node, So that the destination network is eventually reached).


What is the difference between MAC address and IP address

The IP address refers to the address used by the Internet Protocol, and the MAC address is the address used by the Ethernet protocol. There is no necessary connection between the IP address and the MAC address, and the MAC address is the address on the Ethernet NIC with a length of 48 bits. Each Ethernet NIC manufacturer must request a set of MAC addresses from the IEEE organization to write a unique MAC address in the serial EEPROM of the NIC when the network card is produced. The MAC address of any two Ethernet network card, no matter which manufacturer is produced should not be the same. Ethernet chip manufacturers do not need to be responsible for MAC address application, MAC address in each Ethernet package, is Ethernet Baotou part, The Ethernet switch implements packet Exchange and delivery based on the MAC source address and Mac destination address in the Ethernet header. An IP address is an Internet protocol address, each Internet package must have an IP address, and each Internet service provider (ISP) must request a set of IP addresses from the organization concerned, and then generally dynamically assign it to its users. The IP address is now 32 bits long and is expanding to 128 bits. The IP address is not related to the MAC address, because Ethernet users can still connect to the Internet via modem, get a dynamic IP address, this address can be inconsistent each time. The IP address usually works on the WAN, and the router handles the IP address. MAC addresses work on local area networks, and interconnection between LANs is generally done through existing public or dedicated networks, and inter-network protocol conversions are required. IP information can be transmitted on the Ethernet, when the IP address is only part of the Ethernet packet data domain, the Ethernet switch or processor does not see the IP address, just as normal data processing.


MAC address and IP address difference and contact (computer network 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.