Routers vs Switches vs Hubs

A router uses TCP/IP or another routable protocol to determine where traffic that reaches it should go. Most routers are two segment (e.g. it can only route between a private network and the internet), but there are multisegment routers.

A switch uses Ethernet MAC-level routing between each individual port, meaning that there is a maximum cross-sectional bandwidth of the number of ports times the maximum speed per port (effectively each port has its own dedicated bandwidth). For instance, my gigabit switch has eight ports and can run at full duplex (2000 Mbps) so I have a maximum cross-sectional bandwidth 16000 Mbps.

A hub shares the same bandwidth for every port, and can usually only run in half duplex. For instance, a 10/100 Hub with 8 ports has a maximum cross-sectional bandwidth of 100 Mbps, but that same switch would have 1600 Mbps of cross-sectional bandwidth since each port can run at 200 (100 in each direction) Mbps and each port has its own dedicated bandwidth.

A router can handle traffic at TCP/IP level rather than an Ethernet MAC level, and hence can also do some fancy tricks like sharing the internet. There are literally dozens of reasons to go with a router. Most consumer routers combine a router and a switch into one; one port of the router goes to the internet, and another port of the router goes into an eight port switch (interally of course so you don’t see it) and you get 8 ports on your LAN.

The only way a switch can share an internet connection is if each machine has its own internet acessible IP address.  With a router you can use one IP to share the internet to several internal private IPs.


 
In my case my new setup will have the following:
                       /– GALAXY (dual Xeon server)
                      / 
                     /– Extra IP
                    /     
DSL Modem – Switch <– SINGULARITY (Sun webserver)
                    \
                     \– QUANTUM (dual PIII server I’ll have in the future)
                      \
                       \                   IBM ThinkPad
                        \                 /
                         Router – Switch < Desktop
                                          \
                                           Dual processor workstation

This is a pretty good example.  Each connection to the first switch will have its own internet IP address, but those computers behind the router/firewall will have only a private (invisible to the internet) IP address.

 
(obviously this isn’t the entire topology – it’s a bit more complex but this is the basic topology)