1

My understanding of how you "ask" a router to route a packet for you is that you simply put the IP(v6) address of the destination host and the MAC address of the router you are routing via on your packet, and then send it out the interface that is physically connected to your router (whether that be a direct layer 1 ethernet cable or something more complicated like a set of switches).

The router then receives that packet from the L2 ethernet network because it has the router's MAC address, and the OS on the router actually sees the packet (even though the NIC is not in promiscuous mode) because it has the right MAC address. The OS checks if IP forwarding is enabled (it is, it's a router) and then finds the match route in the routing table, sets the new MAC address on the packet and sends it out the right interface. This repeats across each L3 hop all the way to the destination.

But I kind of skipped over something in that explanation: Every next hop I've seen in a routing table is an IP(v6) address -- not a MAC address and interface. This means that the router needs to do a routing table lookup (for a connected route) and then ARP or NDP to resolve that next hop to a MAC address and an interface, and then cache that ARP/NDP result for future packets.

If all that is really needed to route a packet is {MAC of next router, interface to send it out on}, why is an IP(v6) address required?

Why can't I just put a route in my routing table "0.0.0.0/0 via 12:34:56:78:9a:bc on ether1" (or "::/0 via 12:34:56:78:9a:bc on ether1")?

I can see the benefits of a layer of abstraction in many scenarios (think what fun a router upgrade is gonna be if you have to change the default route MAC address on 253 servers), but why is it required? Am I missing something obvious here? Or is it being required not a protocol thing, and just an implementation detail that is remarkably consistent across every OS and network equipment vendor I've seen so far?

What got me thinking about this was OSPFv3 and its preference to create routes with link-local IPv6 addresses, which basically just encode an interface and MAC address. No need to bother with assigning, tracking, and using up (usually public) address space on each router interface -- every interface has those fe80 addresses already!

3

Not all layer-2 protocols use MAC addressing (what do you do for those that do not?), and of those that do, there are some that use 48-bit MAC addresses and some use 64-bit MAC addresses. You cannot have the network protocol depend on any specific data-link protocol.

A host will use whatever method, e.g. ARP or NDP, to convert the network address to the data-link address, or in the case of PPP, there is no data-link address.

4
  • So then, if a network vendor so chose, they could build a routing stack that allows routing via interfaces with no IP subnet -- but they would have to deal with all the complexities of entries in the routing table potentially having varied format, as outgoing interfaces could have different L2 protocols with different information required for those routes. For example, an ethernet interface would be 48 bit MAC + interface; while PPP would just be what interface to use. Right? – Azendale Mar 6 at 22:35
  • ... so basically there's nothing preventing it, other than it could be messy to implement support for these "IP free" routes for each possible data link protocol. (right?) – Azendale Mar 6 at 22:38
  • @Azendale Point-to-point network interfaces may be unnumbered, using neither IP nor MAC address. That's why a routing table entry holds an interface and it may also hold a gateway address (only required for a P2MP network). – Zac67 Mar 6 at 23:00
  • @Azendale, I did not say IP-free. IP, a network protocol, is independent of the data-link protocol or MAC addresses, just as the data-link protocol is independent of IP or any other network protocol. For example, using frame relay for a WAN uses DLCIs instead of MAC addresses, but you can still run IP on such an interface and protocol. PPP has no data-link addressing, but you can still run IP on PPP. – Ron Maupin Mar 7 at 1:17
2

I'll answer with a quote from Time Bandits:

Robin Hood: How long have you been a robber?
Strutter: Four foot one.

[ https://www.imdb.com/title/tt0081633/quotes?item=qt0279226 ]

Routing is a layer-3 operation. Thus, route tables contain layer-3 information. A MAC is a layer-2 address. You can't put that in a route table, because it isn't a layer-3 address. It's nonsense, just like Strutter's answer.

We don't put L2 addresses in L3 tables, mostly due to the vast selection of L2's available. While one might think the entire world is ethernet, it isn't.

1

A slight variant to Ron's view:

Routing is a fundamental concept of the network-layer (L3). Accordingly, an L3 node trying to send a packet needs to find a path to the destination. For that, it queries its local routing table resulting in the gateway to be used. If there is none, the packet is dropped. If the destination is on a shared network then it is its own gateway. Finally, the packet is passed to the gateway.

If the network interface towards that gateway is connected to a point-to-multipoint network, the "passing to the gateway" requires some kind of addressing. NDP (or ARP for IPv4) is just the mechanism to properly use an underlying MAC-based link layer, so the packet can go the right way. Other network types use other mechanisms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.