Supposing we have a router (Internet box for example) with 2 switch connected on it.

We have a machine A on switch 1 and a machine B on switch 2.

The router wants to transmit a packet to machine A on switch 1. ARP is already resolved, so the packet will contain machine A destination MAC addresse.

How does a router know which switch to send this packet?

2 Answers 2


Each router interface will be in a different network. The router will use the interface for the destination network, so the switch connected to the interface with the destination network will get the frame for the destination host. The router will look in its ARP cache or use ARP for the interface with the destination host.

  • "Each router interface will be in a different network" - What do you mean about "different network"? / "The router will look in its ARP cache or use ARP for the interface with the destination host." - Can you explain it please?
    – Duke Nukem
    Jul 29, 2016 at 22:03
  • The router will use the layer-3 address to determine to which interface the packet should be switched. When the packet gets to the interface, the router will build a frame for that interface, and it will first look in its ARP cache for that interface to see if it has the layer-2 address for the host. If it doesn't have the layer-2 address for the host, it will use ARP to resolve the layer-3 address to the layer-2 address. Once it has the layer-2 address, it can build the layer-2 frame for the layer-3 packet.
    – Ron Maupin
    Jul 29, 2016 at 22:06
  • I understand you viewpoint. However, the situation is not the same. I'm talking about a home Internet box router, on which two external switch are connected to. So they are on the same network. I don't think it's the same process you mentionned above
    – Duke Nukem
    Jul 29, 2016 at 22:18
  • Questions about home networking and consumer-grade devices are explicitly off-topic here. If that device has multiple ports, they are on a switch built into the box. The router only has two interfaces: a WAN interface, and an interface to the switch module in the box. You are not connecting the two switches to two router interfaces, you are connecting them to two switch interfaces. Routers route between networks; switches switch on the same network.
    – Ron Maupin
    Jul 29, 2016 at 22:20
  • Thanks, I got it. Please edit "you are connecting them to two switch interfaces". I think you mean "you are connecting them to the switch interface"
    – Duke Nukem
    Jul 29, 2016 at 22:26

Most home routers use a special-case of NAT called PAT. When the packet goes out from your internal machine, the source address is rewritten as you are aware. The source port is also changed, usually to a high number, and the router keeps an address translation table.

For more relative information:https://superuser.com/questions/105838/how-does-router-know-where-to-forward-packet

  • Actually, none of the RFCs refers to it as PAT. The real acronym is NAPT (Network Address Port Translation). See RFC 3022, Traditional IP Network Address Translator (Traditional NAT). A port is merely a layer-4 address, used by some layer-4 protocols, e.g. TCP.
    – Ron Maupin
    Aug 1, 2016 at 3:35
  • Whilst semantically you are correct Ron, Port Address Translation is used in most Nat implementations and is referenced extensively in a large amount of Networking literature. Arguing semantics for the sake of it seems a bit pointless in this instance. Aug 4, 2016 at 17:00
  • @MarkRiddell, it is not merely semantics, it is an RFC definition used by the RFCs. _RFC 2663, IP Network Address Translator (NAT) Terminology and Considerations explains NAT terminology. It is like people talking about routing ethernet frames; ethernet doesn't route, but people commonly refer to bridging or switching that way. There is a guy here who has a blog, and he has made up all his own NAT terminology, refusing to use the standard, and he insists his terminology is correct, but it really confuses people.
    – Ron Maupin
    Mar 4, 2019 at 0:10

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.