Also, a crossover cable can connect a switch to a hub? A straight through cable can connect a router to a switch? Connecting a workstation to wall jack uses a straight through or patch cable? Connecting a patch panel to a switch uses a straight through or patch cable?
Couple More Questions
Here's the principle The use of the crossover cable vs the straight through.
This all depends on the pinouts of the devices you're connecting
Devices that send(TX) on 1 & 2 and receive(RX) on 3 & 6:
Routers, PCs and laptops (usually devices that are source or destination for data)
Devices that receive(RX) on 1 & 2 and send(TX) on 3 & 6:
hubs, bridges and switches.
So...if my PC transmits (TX) it must enter a device that is ready to receive (RX).
for a PC to send to a switch -- the PC TX on pins 1 & 2 and the switch RX on pins 1 & 2. ( straight through cable will do)
So, if My PC must go through a patch panel, it still must do the same thing as above. So drop cable, premise cabling to the patch panel and patch panel to the switch must do the same thing. So a straight through cable will do here as well)
You only need a cross over when connecting two similar devices in which the pin out is the same.
Switch to switch, router to router, router to pc, hub to hub, bridge to a bridge.
In each preceding pairing, the TX pins must connect to the RX pins on that device. The crossover cable accomplishes this for us.
Some terminology is useful here:
MDI (Media Dependent Interface) refers to interfaces that send on 1&2 and receive on 3&6.
MDI-X (X for crossover) refers to interfaces that receive on 1&2 and send on 3&6.
End devices and dedicated routers generally have MDI interfaces. Switches and switch/routers generally have MDI-X interfaces, though many have an "uplink" interface that is either MDI or can be set to be either MDI or MDI-X. Most newer switches have Auto MDI-X ports that detect whether MDI or MDI-X is needed and set the interface appropriately.
A crossover cable is needed to connect two MDI interfaces (e.g., connecting two routers without an intervening switch) or two MDI-X interfaces (e.g., connecting two hubs). A straight through cable is used for the normal cases of connecting an end device to a switch. With Auto MDI-X ports, either type of cable can be used!
Patch panels are generally wired straight through, so connecting through a patch panel is the same as connecting directly to the device. Use a crossover between the patch panel and an end device if one is needed, but not between the panels; that would get too confusing!
...Most newer switches have Auto MDI-X ports that detect whether MDI or MDI-X is needed and set the interface appropriately.
Rick (and Ronnie) are very good in their descriptions, however I would add an incident I experienced in the field. A switch would lose connectivity to an end device on one port. Power-cycling the switch cleared the issue for about a half-hour. It turns out that the cable was a crossover, and the switch would fail only on that "auto-flip" capability after that period of time. Replacing the cable (actually re-terminating it at one end) with the needed straight-through type solved it completely.