The difference between a router and a switch is what level of the protocal stack they operate at.
You see how a network works is a very multilayered thing. Each layer is a different level of abstraction.
Check out the
osil stack for details
What we will take a look at is how a basic Ethernet setup using TCP/IP works.
The bottom layer is the PHYSICAL LAYER.
In a ethernet setup this is the actual CAT5 (or CAT6 or thinnet or thicknet, those are different protocols) wires, your nic cards and the protocols for how the electricity flows thru the wires.
A example of a device that operates at the bottom layer is the HUB.
A hub is simple device just for connecting a bunch of wires together. The advantage of this device is that:
1. it's cheap.
2. you can take one very long wire, plug it into a port and have another very long wire and plug it into another and have a total length of wire much longer then you can get otherwise.
3. Makes it easier to route cables and have more then one computer hooked up together.
The major disadvantage is that it creates a very large "collision zone". Since it effectively makes a network one gigantic wire, any signals that get transmitted get transmitted to ALL computers on the hub. So it can slow things down if you have a lot of stuff going on.
The next layer is the DATA LINK.
This is still part of ETHERNET setup.
In this layer it provides the very basic ways to identify devices.
Devices are identified by a MAC address. Each nic card or any ethernet device has a unique number called the mac address assigned to it.
That way each network device (network printer, router (but not hub or switch!)) can identify each other.
For example my nic card's Mac address is: 00

0:09:EC:F0:98
My router's address is: 00:60:08:b0:f3:6
So if I want to send a ethernet "packet" from my computer to the router, My computer will say "I am 00

0:09:EC:F0:98, I am sending these signals to 00:60:08:b0:f3:6. Everydoy else ignore it."
A switch operates on this level. It keeps track of each MAC address and knows which port to send those signals to reach each computer.
They have all the advantages of a hub, PLUS:
1. The reduce collision zone. Each wire is split up into it's own little "zone" represented by the MAC address. That way a signal sent from 00

0:09:EC:F0:98 to 00:60:08:b0:f3:6 won't go to 00:02:44:0a:1b:7a's wire.
This increases network performance, because you can have 2, 4, 6, 8 etc machines talking to each other AT THE SAME TIME. Since the electical signals don't cross over each other (or "collide" or cause a "collsion").
2. Because each wire is dedicated for one computer/device you can go "full duplex". Since you only are dealing with a one on one basis the Ethernet protocol down their on the "physical layer" allows you to effectively double the bandwidth!
So a 100MB/s ehternet network becomes a 200MB/s network!
3. Security is increased. Hackers/computer techs use "packet sniffers" to find out information. On a hub every signal gets recorded, so that you can (for example) record a telnet password, from 2 machines talking to each other. On a switch the signals only go from one computer to another, a third computer can't record their conversation.
The bad things are:
1. Slightly more expensive then a hub.
2. adds a small amount of latency.
Both these are immaterial nowadays. A switch is 150% more desirable then any hub.
Basicly switch does the hub's job + some extra stuff to increase performance.
The next layer is SESSION.
This controls the packets and quality of service and makes sure the everything is being sent correctly.
The next layer is TRANSPORT
This provides a way to make sure that all 3 lower layers are doing their job. THis provides a level of "abstraction".
That way layers above this are isolated. Programmers working on the upper layers don't have to worry about the lower layers, makeing their job easier. Just as long as it works.
For example TCP/IP works on ATM networks, Token Ring networks, PPP networks, Ethernet networks.
Now you don't need to create a new TCP/IP program for each type of network, the same TCP/IP packet gets "encapsulated" OR put inside a network "FRAME".
That way the bottom 3 layers don't have to worry about TCP/IP, just as long as they do what they are suppose to do. They don't give a damn weither or not it's TCP/IP, Netbuie, IPX/SPX or any other number of "ROUTED" protocols. (protocols that get routed from one network to another, netbuie realy doesn't fit into that catagory though.)
The next layer is NETWORK.
This is were routers operate. They are MUCH MUCH more complex then any switch or hub. (although nice switchs usually have some routing abilities built in for conveinence)
This is were stuff like IP addresses happen. This is were Routing happens.
Routers operate like hubs a little bit and they operate like switch. But they also ROUTE packets. They have ROUTING TABLES.
So a router can be a hub. A router can be a switch. A router can be a router
but a switch can't be a router.
So this statement is wrong(well not wrong, but misleading.)
In theory, you could just use a switch, and plug the internet into one of the ports just like it was a local computer.
It can't go: I need to find IP address 192.168.1.10, or a website on 216.239.53.99.
It can't go I need to find a way to get thru router 1 to get to router 2 to get to router 3 to get to router 4 to get to the webserver.
Because it has no CLUE what a IP address is and it doesn't care. It does it all thru MAC addresses which are much more primitive/lower. MAC addresses can't be routed.
Plus your going thru a Cable line or a DSL, or ISDN or T1 network. They don't even use MAC addresses!!
You need a router to go from one type of network to another. You can't use a switch to go from Token ring to Ethernet to ATM, but a router can do that.
You need a router to go from one LAN to another. If you have a switch connecting 2 LANs, then they become 1 big LAN, because it can't seperate them like a router can.
EDIT:
Note that Cablee and DSL modems ARE NOT modems, They are more like a connection between 2 different digital network types.
Modem are designed to go from analog to digital and visa versa. (MODulate DEModulate)
You can connect a switch to a Cable Modem (for instance) and the "modem" will translate that from the Ethernet network to a cable network.
But a cable modem is not a Router OR a switch. It's something different, its sort of a half switch and a half router.
So then what happens is that you home network becomes part of the Cable company's network. You gateway becomes the Cable Company's router. That way you still have a router moving your packets around, it's just the Cable company's and not your own.
The bad thing then is that everybody in that cable network segment has access to your LAN inside your home. They can access your computer directly. A router at home can seperate your computer from the rest of the Cable company;s network, thus protecting you from hackers and viruses. THIS IS A VERY GOOD THING.