Intermediate devices like Repeaters and Hubs are used at the physical layer to amplify or regenerate the signal over longer distances. As the distance of the telecommunication link or cable increases, the signal strength automatically keeps decreasing due to attenuation (loss of energy due to cable resistance and external noise factors). To overcome this, devices like repeaters and hubs are used between links that span long distances.
A repeater is a physical layer device and consists of two ports/interfaces. Its main use is to amplify and regenerate signals. Whenever a repeater receives a signal through one of its ports, it repeats or sends the incoming signal onto the other port.
As a signal travels through a media, not only is its strength lost, but additional line noise gets added to it. So, if a repeater blindly repeats the incoming signal onto the other port, then it may result in the noise too getting amplified. To overcome this factor, repeaters are intelligent and they understand the line coding technique used at the physical layer. Instead of blindly repeating the signals, repeaters decode the incoming digital signal continuously. Since it understands the line coding technique, it is able to decode each digital symbol coming on the incoming port. After decoding the incoming bit, it regenerates a fresh signal using the line encoding strategy, thereby helping in filtering out unnecessary noise. For this reason, repeaters are protocol specific (e.g. Ethernet Repeaters, Wireless LAN repeaters etc.).
A hub is nothing but a multi-port repeater, with more than 2 ports. Whenever a hub receives a signal on one of its ports, it copies the same signal on each of its other ports. There are both dumb hubs (that blindly copies signal including noise) as well as intelligent hubs (that understand the line encoding technique, decodes the incoming digital signals and regenerates fresh signals on other ports).