[Switch] IP address and Mav address -- difference and contact

Source: Internet
Author: User

Http://wenda.tianya.cn/question/27f9476d1e86f6b6

I. IP Address 
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.

 

Ii. MAC address 
We are not familiar with MAC addresses because we are not directly in touch 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. length, representation, allocation and uniqueness of MAC addresses 
The MAC address is 48 characters long (6 bytes). It is usually expressed as 12 hexadecimal numbers. Each two hexadecimal numbers are separated by 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, it is distributed by the IEEE (istitute of Electrical and Electronics Engineers, Association of Electrical and Electronics Engineers), and the last three hexadecimal numbers 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 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.

 

Iv. Functions of IP addresses and MAC addresses in 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.

 

5. Based on the above descriptions, we can conclude that the similarities between IP addresses and MAC addresses are unique. Different features mainly include: 
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 ).

 

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.