2

I'm studying the difference between Hub and Switches.

The first ones are dummy devices who simply repeat the input signal to every output port. The anti-collision protocol CSMA/CD is implemented by the NIC of the devices connected to the hub. So i guess that we are dealing with HALF-DUPLEX communications because otherwise the CSMA/CD would not be needed.

Switches are smarter and they manage the collision protocol. I can't get this. I mean, we are dealing again with half-duplex communications? What changes if the CSMA/CD is implemented in the switch instead or in the NIC's device? If the switch implement the protocol-collision, means that the medium between the switch's port and the host is a full-duplex? Otherwise it should have again collision !

Please clarify for me how half-duplex and collision might be related in a switched ethernet network

4 Answers 4

3

The first ones are dummy devices who simply repeat the input signal to every output port.

Right, more specifically, they copy the signal on all ports except the one the signal was received on

The anti-collision protocol CSMA/CD

Wrong, CD state for Collision Detection, this is not an anti-collision mechanism. Collisions can occurs but are detected. Such "anti-collision" mechanism exist, it is CSMA/CA (Collision Avoidance) and it is used in WiFi for example.

Switches are smarter and they manage the collision protocol. I can't get this. I mean, we are dealing again with half-duplex communications? What changes if the CSMA/CD is implemented in the switch instead or in the NIC's device? If the switch implement the protocol-collision, means that the medium between the switch's port and the host is a full-duplex? Otherwise it should have again collision !

CSMA/CD is not located in a single place, the NIC or the switch. It is a protocol (think "language") known by both the hosts(computer NIC) and the switch.

Switches don't "manage the collision protocol". They do speak it and are capable of detecting a collision prior to decide to send the frame to the destination host.

You are right in that if the connection between a host NIC and the switch is full duplex, CSMA/CD is not needed since a collision cannot occur.

But the same port of a switch can be connected to a device that supports only half-duplex (increasingly rare nowadays) and in this case the switch port will automatically set itself to half-duplex (if it supports auto-negotiation) or can manually be configured for half-duplex. In this case CSAM/CD will be used.

Edit to respond to comments:
In a single collision domain (which is on a switch the host and the switch port), all hosts must be set with same duplex setting. This can be achieved either automatically with auto-detect if at least one host support it, or manually. But If one host is set to FD and another one to HD, problem arise. Still today it is not rare that duplex issue arise, and despite the fact that auto-detect is almost ubiquitous, from time to time we have to manually set a port to a given mode.

As explained by @Ron Trunk in his comment, each pair of [switch port - host ] is a single collision domain. So on a single switch you can have a port connected to a host in FD and another one in HD.

This is not, by far, the only difference between a hub and a switch. The major feature of a switch is that it records the MAC addresses of all connected devices, so it knows which MAC address is behind which port and it can forward the frame only to the appropriate port instead of copying it to all ports. (there's many answers on this site that deal with this aspect).

4
  • Such a great answer! Yes, i did not mentioned the main differences between hub and switch because i got it and i'm just looking for some clarification on HD and FD and the CSMA/CD. So in a segmented network with switches for example, they can detect collisions and resend packets in the "right " orders thansk also to the buffers in the input and output ports. So HD or FD is a sort of "capability" that a device might have, and this depends by what? The NIC of the device? So if switch and host would support FD they would communicate in this way, else they would negotiate for HD? Nov 15, 2017 at 15:46
  • So suppose that each port is setted as FD, the only component that is shared is the NIC of the host? Or the NIC can be set up as FD as well? So ports are individuals collision domain only if there is a component (port or NIC) that is HD right? Nov 15, 2017 at 16:09
  • @rollotommasi Both devices need to be set to the same duplex mode. Switch ports are separate collision domains regardless of duplex setting
    – Ron Trunk
    Nov 15, 2017 at 16:21
  • @rollotommasi please accept the answer if it's sufficient for you. :-)
    – user36472
    Nov 15, 2017 at 16:26
3

In addition to the already great answers here: the core difference between a switch and a repeater hub is that a switch buffers frames. This allows for sending out a frame to a destination that's currently busy receiving another frame - it doesn't matter and you don't have to check because it's buffered in the network and forwarded hop by hop as soon as possible.

Buffering is also the mechanism that enables full-duplex communication. For full duplex without buffering, the complete sender-to-destination path would first have to be cleared of other communication before data could actually be sent. This is what circuit switching does - it's not as efficient as packet switching.

For half-duplex communication, buffering also establishes a separate collision domain on each port - it's not the actual sender that has to retry sending data after a collision, the switch does it for him.

2
  • Thanks ! but i don't get this statement "This allows for sending out a frame to a destination that's currently busy receiving another frame - it doesn't matter and you don't have to check because it's buffered in the network and forwarded hop by hop as soon as possible." Buffering would be like a temp memory that stores packages when the medium is currently busy.Whit "is forwarded hop-by-hop as soon as possible" you mean that the frame would be sent to the medium as soon as the medium become free, and crossing all the components (routers,switch,hubs) it will arrive to the destination? Nov 15, 2017 at 20:51
  • There is no "the medium" with a switched network - well, there is, but it's only between two ports. Imagine a switch with three hosts, A, B, and C. A is transmitting to B (exactly: A is transmitting to switch for B, switch is forwarding to B). Now, C also starts sending to B - instead of having to wait, the switch accepts the packet right away and sends it to B as soon as the packet from A is done.This increases efficiency signifcantly, and the larger your network, the larger the increase.
    – Zac67
    Nov 15, 2017 at 21:30
2

Regarding hubs: when we say "devices who simply repeat the input signal to every output port", it's important to realise it's done essentially with a transistor: it copies voltages from one place to another.

Pretty much everything else -- bridges, switches, routers -- have a CPU inside them which gets bits, interprets them in various ways as addresses, and decides where to send them out. The obvious technique is to put the ethernet frame into a memory queue, figure out what to do, then emit it in the right way. There is therefore a measurable delay between the input and the output. In contrast, the output signal on a hub is following the input with sub-bit-time delay.

Clever switches can start forwarding before the input has finished; stupid ones are store-and-forward. You normally have to put an oscilloscope on the signals to find out exactly what a given switch does.

1

In a modern Ethernet switch, each port is a separate collision domain. Because there are only two devices in the domain (the switch port and the host NIC), switch ports are configured (by default) as full duplex.

5
  • I would rather say that in a modern ethernet switch, ports are configured by default as auto-detect / negotiate (both speed and duplex mode) and in most case the expected result of said negotiation is full-duplex.
    – JFL
    Nov 15, 2017 at 14:20
  • So the disputed resource is no more the cable that actually is full-duplex but is the port itself and the host NIC? So for example the switch's port can get conflicts between packets sent FROM the host and packet directed TO the host? (The same for the NIC adapter i gues.....) Nov 15, 2017 at 14:23
  • But a full duplex cable is different from an half-duplex right? Nov 15, 2017 at 14:24
  • 2
    there's no such thing as half or full duplex cables. This is a characteristic of the interface.
    – JFL
    Nov 15, 2017 at 14:34
  • 2
    All modern cables are full-duplex capable. Historic Ethernet used coax cables (and some twisted-pair PHYs) that were inherently half-duplex in that the cable couldn't support both directions simultaneously. Then came dual-simplex (10BASE-T, -FL, 100BASE-TX, -FX, ...) with dedicated send/receive wires, and for twisted pair this was followed by real full-duplex connections with everything being two-way (1000BASE-T onwards).
    – Zac67
    Nov 15, 2017 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.