I understand that public IP addresses are necessary because if the world only had MAC to move data between one host and another, the entire Internet would have to be one massive flat network such that every host could contact every other host. But what is the need for private IP addresses? Why can't routers just connect to local hosts using their MAC address?
feedback
|
|
The answer is your software applications and operating system are designed to communicate using TCP/IP, not directly with Ethernet MAC addressing. So regardless of whether the remote computer/node you wish to communicate with is in your local network or in some other network halfway round the globe, that logical link is established with TCP/IP. That way applications just define the destination IP address in the IP packet, fill it with data (which is actually packed into a TCP/UDP segment), and send it along the way without having to worry how the underlying layers deal with the actual transmission. It is the operating system's networking stack that determines if the IP address is local or remote:
Note: it is totally possible for IP packets to be delivered in another data link protocol other than Ethernet (guess what, your dial-up or DSL modem is not connected to your ISP via an Ethernet cable). And applications should not have to care so as long as the destination IP address is reachable. It is also totally possible to wrap other networking protocol data (that is not an IP packet) in an Ethernet frame for transmission. | |||
|
feedback
|
|
One reason is because MAC addresses aren't really "routable". IP is, so it's easier to keep IPs for addresses internally and externally. As well, you don't access other computers based on MAC address alone, you use IP. Te router then decides if it's destined for internal or external | |||
|
feedback
|
|
Ultimately, all packets are delivered to a MAC address. When an IP packet arrives at your router and the NAT table shows that it is destined for your private address 192.168.1.10, the router will do a look up to see what the MAC address of 192.168.1.10 is, and send the packet to that MAC address. However, a MAC address is a layer 2 address, and by definition only allows communication between items on the local network. So the question of "why private addresses rather than MAC address" assumes that all non-public networks are simple single flat networks. There are almost no private corporate networks that consists of a single LAN, and many domestic environments have multiple networks. In order to route between these networks, you need a layer 3 protocol such as IP. So a different way to phrase your question would be "Why don't router manufacturers and OS developers create a layer-2-only local network in the specific cases where layer 3 is not absolutely necessary?". And the answer to this question is that it would not be worth creating a niche solution to a scenario where the existing general solution already works perfectly. There would be no benefits whatsoever. | |||
|
feedback
|
|
Network communication is divided into multiple layers. The figure here shows OSI model. Each layer has a purpose of its own. From the bottom of diagram i. Physical layer: this layer is the actual medium which connects devices, it may be a cat5 cable,optica fibre etc. . ii) Data Link layer: this layer takes care of physical addressing and packet switching , checksum etc. iii) Network Layer: This layer takes care of logical addressing and routing packets. and so on This helps separate various functions of the network stack . so that layers are not dependent on other layers. Now coming to your question. MAC address is at data link layer, whose function is physical addressing . Network layers function is to provide a logical address to a communication node, So when you are communicating between two devices they have to be addressed by their network address. Also they may not even have the same data-link layer i.e therefore one of the nodes may not even have a MAC address.
| |||
|
feedback
|
