If I have an infrastructure type network, why does a local PC send out an ARP request for a MAC? Doesn't the router know the MAC addresses already, since it is using at least Layer 2?

Does it do this to speed things up, no MAC lookups?

Frames are delivered directly from host to host on a local LAN, and they do not pass through a router. Even routers need to use ARP to resolve the MAC address from the IP address when sending frames to a host.

A source host (including a router) that has the IP address of a destination host must somehow resolve the IP address to a MAC address on the LAN. IPv4 uses ARP for that. It first looks in its ARP table, and if it doesn't find an entry for the IP address, it will send an ARP request. It needs the MAC address in order to build a frame for the LAN.

  • I don't understand. How can they not pass through the router? Do you mean they pass through they physical machine but are only using the switch part of the switch/router? – johnny Sep 13 at 19:53
  • Routers route packets between networks, bridges bridge frames on the same network. What is the device model you mean? – Ron Maupin Sep 13 at 20:26
  • 2
    @johnny it seems you only know about residential gateways that are devices that embed several devices: a switch, a router and a wifi access point (which is also a kind of switch actually). For two hosts on the LAN to communicate together, the router function is not used, only the switch. – JFL Sep 13 at 21:16
  • Don't some of the Cisco boxes have both functions? If I have an older 3750 and turn on ip routing, does that change anything for the clients on the network? – johnny Sep 14 at 15:15
  • Not really, the switch still acts as a layer-2 switch for most connections, but you can enable a router inside the switch and configure some layer-3 interfaces (SVIs and physical interfaces). In any case, the frames on a LAN are still delivered directly from host to host, and packets destined for a different network are passed through the router, where the frames are stripped from the packets, and forwarded to a new LAN, where new frames are built for the packets. ARP is still used to resolve the MAC addresses from the IPv4 addresses for the frames. IPv6 uses ND, rather than ARP. – Ron Maupin Sep 14 at 15:57

When a client has just booted and is configured by DHCP, it knows its own IP address, the network mask and the default gateway's IP address (plus other options like DNS servers).

In order to actually pass an IP packet to the gateway, the packet needs to be encapsulated in an Ethernet frame addressed to the gateway's MAC address - which needs to be learned by ARP on IPv4.

Of course, packets may also be sent to other local destinations (DNS server, file server, directory server, ...). All of these IP addresses also require being "translated" by ARP.

I would assume that what you are calling a "router" is actually a home/small buisness gateway device. These devices are typically a combination of several logical devices intended to provide a "network in a box".

  1. A router with NAT support and basic firewalling to connect your LAN to the internet.
  2. An ethernet switch.
  3. A wireless access point (basically a wifi to Ethernet bridge).
  4. A dhcp server
  5. An administrative interface.
  6. Generally a DNS proxy (though sometimes the DNS server details received from upstream are just passed through)
  7. Sometimes VPN client or server support.

The clients don't know or care that all these functions are in one box. The hardware implementing the functions may or may not care that they are in the same box, the Ethernet switch functionality in particular tends to be done in dedicated hardware while the IP routing and the wifi bridging stuff are often done in software on an embedded CPU.

All the client knows is the details the DHCP server gave it, typically it's IP address, subnet mask, default gateway and DNS server.

From the IP address, subnet mask and default gateway the client fills out it's routing table. A default route is created from the default gateway setting and an on-link route is created from the IP address and subnet mask.

So if the IP is in the local subnet it is treated as on-link and arp is used to find a MAC address for the destination. Otherwise arp is used to find the MAC address for the default gateway.

Don't some of the Cisco boxes have both functions?

Yes, cisco make a massive range of devices.

If I have an older 3750

The 3750 is what is known as a "Layer 3 switch", it has ethernet switching functionality,fast but relatively basic IP routing functionality and DHCP server functionality. However from what I can tell it does not have NAT or stateful firewalling support. So unless you have public IPs for every machine and are prepared to leave all your machines open to the Internet you can't really use it as an internet gateway.

and turn on ip routing, does that change anything for the clients on the network?

Depends how the clients are configured. If you want your switch to do routing between your internal networks then you need to tell your DHCP servers on your internal networks to hand out the switch's IP as the default gateway to clients.

You will also need to set up a default route on the switch to point to your internet gateway and (unless your internet gateway has an interface on all networks) a route on your internet gateway to bring traffic back to the switch.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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