the distinction is often based on the namespace used for
making the forwarding decision
the term "router" is *usually* applied to a device which is
examining an L3 token, specifically an IP destination address.
from that destination address it decides how to forward the
packet. (note that, for example, Novell has routers too and
they operate at the equivalent of L3 - the (Network,MAC) tuple)
a switch is usually examining a token other than an IP
destination address - often an L2 address token such as an
Ethernet MAC address, MPLS LSP Tag, Frame Relay DLCI,
or ATM VPI/VCI indicator.
another part of this distinction has to do with whether
the forwarding token has global or local significance.
IP routers are using a token which generally (if not
always) has global signficance, while at least for
MPLS, Frame and ATM (tag-swapping forwarding models)
the forwarding tokens have only local significance
(hence the need for tag swapping). the Ethernet
switch is the odd man out in this view, and more
on this follows below.
one does hear phrases like "layer 7 switch", which was taken
to describe a device which performs certain unnatural acts on
packets thought to contain HTTP traffic. this still meets
the description above ("routers" are L3), although this
fiddling is largely semantic lawyering about things better
left unexplained, or at least not exhibited for public viewing.
to my mind, the distinction is really about the complexity of
the work function of the lookup operation.
ironically, based on this view, an Ethernet "switch" is in
fact a router because the purely associative lookup in a full
table (ie, "flat-routed") done by an etherswitch is computationally
more complex than "longest match wins" in the compressed table
a IP router uses. but this view is not shared by many (grin).
So the short answer is:
Routers route and Switches switch.
the rest is details. (and the Devil be therein)
cheers,
-mo