2 Ethernet Switches
Crossover vs. Straight-through Cable
On a NIC - Network Interface Card OR Wireless Adapter theres's a TX and RX pin on both sides:
- Straightthrough hooks up the transmit to transmit and receive to receive
- Crossover hooks up the transmit of one to the receive of the other, and vice versa.
Clearly crossover is usually better, and crossover is usually automatically done by most modern devices. Most cables nowadays are straight through because of this.
How do we know which one to use?
The idea is:
- If the device is different, then it's straight-through
- If the device is the same, then use crossover.
So switch and switch would use crossover. If it's switch to router, then it's straight-through.
The Plan for Today
We'll be looking at ethernet switches. It's a layer 2 device (creates frame). It looks like:
- Destination MAC
- Source MAC
- Type (of payload)
At the tail there's actually a CRC checksum, but you won't see that (nor will you see the level 1 header information).
Ethernet used to be Broadcast Connection, so then:
- There was lots of throttling for access to the hub
- Unsecure viewing of all traffice
Instead, a switch will learn about this network. If PC1 and PC2 talk a lot ot each other, then it directs traffic only between these PCs, and creates a direct connection.
The way it does this is address learning:
This is done on the ethernet switches. It is passive (done passively) and generates the MAC address table, with columns "Destination MAC | Physical Interface".
Let's look at how the MAC address table is generated. Say PC1 has MAC1 and talking to PC2 with MAC2. Say it does a ping
to IP2 (PC2's IP). At some point it'll create a frame with the destination, source, and type. Here:
- The source is MAC1
- The destination is MAC2
- The type is IP
- Then the payload is determined by
ping
When this hits the switch it'll:
- Learn the source address (MAC1 in this case is with physical interface 1 in our picture)
- Try to find the destintation MAC address.
- If it's not in the table, then broadcast the frame to all other interfaces (it'll hope for the best).
- The other PCs will effectively throw it away.
- PC2 sees this and make a frame response:
- Source: MAC2
- Dest: MAC1
- ... (all other stuff is the same)
- MAC2 is thus added to the table.
- Now MAC1 can be found in the MAC table to the interface, and then is sent directly over that interface.
Doing this is not a security feature (they would always break), but it works.