switches work on layer2 and routers on layer3
(UDP/TCP)/IP are Layer3 which means they ride on top of Layer2. Layer2 can be anything from ethernet to infiniband to T1 ... etc..
My understanding, which is probably incorrect , is that a switch doesn't read the destination IP address in a packet header, whereas a router does, in order to "route" the packet to the correct device according to the DNS assignment.
My understanding, which is probably incorrect , is that a switch doesn't read the destination IP address in a packet header, whereas a router does, in order to "route" the packet to the correct device according to the DNS assignment.
this is actually a good description.
To follow through on it:
A switch routes via the MAC address (Layer 2)
A router routes via the IP address (Layer3)
Your MAC address is not sent over the internet because not all layer 2 protocols have MAC addresses. But since all routers work on Layer 3, a MAC address is not needed, just an IP.