简体   繁体   中英

Do routers (not layer 3 switches) directly forward ip packets without MAC?

Consider this scenerio. Router A connected to Router B. B is connected to a bunch of host x,y,z. When A forwards a packet to B does it send it directly based on the network ip of B or does it use MAC address and ARP table? What about B to x,y,z ? If x, y, z are connected through separate lines to A, do they really need MAC addresses? Cant B just map address to the links?

If router A and router B are connected by Ethernet, the Ethernet network has to know to send the Ethernet datagrams to router B. This is accomplished by the Ethernet packet being addressed to router B's MAC address.

This is property of the header of the Ethernet packet that contains the IP datagram. It has a "destination hardware address" field because that's how Ethernet packet headers work. The IP packet inside the Ethernet packet has an destination IP address field. That contains the destination IP address, which may or may not be router B's address.

When A forwards a packet to B does it send it directly based on the network ip of B

That would be a disaster. Router B is not the IP destination of the packet. If the router did that, how would router B know where to forward it since it wouldn't know the IP destination?

or does it use MAC address and ARP table?

That depends on how the routers are linked. If they're linked by Ethernet, then MAC and ARP are used because that's how Ethernet works.

What about B to x,y,z ? If x, y, z are connected through separate lines to A, do they really need MAC addresses? Cant B just map address to the links?

Say they're connected by Ethernet. How would the Ethernet network (such as switches) know how to get the packets to the correct next device?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM