Original link: https://blog.vvzero.com/2022/09/18/Ethernet-Wiring/
Translator’s Note: Most people know that Fast Ethernet only uses 2 pairs of 4 wires in the RJ45 port, which are the differential signals of TX and RX.
Gigabit Ethernet uses all 4-to-8 wires in an RJ45 port, but how are these 4-to-8 wires defined? Which belongs to TX and which belongs to RX?
I don’t know, and I didn’t really understand it before, so I decided to find an article related to this and translate it and share it with you.
This article is part of the “Tapping Jade Project”, translated from https://www.practicalnetworking.net/stand-alone/ethernet-wiring/
When we talk about “Ethernet”, we may be talking about various concepts, including all cable sizes (10BASE-T, 100BASE-TX, 1000BASE-T, etc.). These protocols specify how the level (ie, 0/1 signal) is transmitted on the wire, and how the level signal is parsed into data frames.
Originally, this article only wanted to briefly introduce the basic difference between crossover and straight-through cables, but based on our principles , we felt that we should go deeper.
First, we’ll introduce some terminology, disambiguate some ambiguities, and then answer some basic questions: Why do we use crossover or straight-through cables? What exactly is twisted pair? How does one bit spread on the wire? Finally, we will synthesize these concepts and discuss the related standards of Gigabit Ethernet.
Even if you are new to network communication, you should have heard a lot of network cable related concepts, such as “Ethernet”, “twisted pair”, “RJ45”, “shielded cable”, “unshielded cable” and so on.
But what do these concepts represent? What are the similarities and differences between each other? Are there any concepts that have been misused? Frankly, these concepts are often misused, so take a look at:
This is the physical standard of the interface at both ends of the network cable, which means that it has 8 bayonet positions (Position) and 8 contacts (Contacts). This also defines the shape design and size of this plastic transparent interface.
Standard socket interface (Registered Jack) No. 45 standard defines the number of wires in the cable and the wire sequence, and stipulates the use of the 8P8C physical interface.
In particular, RJ45 defines two wiremap standards: T568a and T568b:
Note that the only practical difference between the two standards is the color of the 2nd and 3rd pairs of wires.
Many people often use RJ45 to refer to the 8P8C jack, but this is not true. There is another similar standard called RJ61, which also uses the 8P8C socket, but its internal line sequence is different. There are many other RJxx interfaces in the standard socket interface definition family, but the wiring definitions and physical dimensions are different.
A twisted pair is a combination cable that consists of 8 individual conductors, two of which are paired together, and the two wires of each pair are twisted around each other. Thus, 4 pairs of wires are obtained, and each pair of wires is used as a data transmission channel.
The concept of wires in pairs is important, as we’ll see later, to help reduce electromagnetic interference (EMI) in a nutshell.
Usually, twisted pair has two specifications: shielded and unshielded .
Note that no matter which specification, there are 4 pairs of wires in the network cable, that is, 4 independent data channels.
Unshielded Twisted Pair (UTP) is more common in actual engineering deployments. It has no additional protection against external electromagnetic noise, but thanks to the inherent characteristics of twisted pair, its data transmission is also very reliable. We will elaborate on this later.
Unshielded wire is cheaper, physically tougher, and softer. These advantages make unshielded cable more popular in most situations.
Shielded Twisted Pair (STP) wraps an extra metal shield on the outermost side of each twisted pair and all 4 pairs of wires, which helps isolate electromagnetic noise during signal transmission.
But at the same time, if the shield is broken somewhere, or the shield is not well grounded at both ends of the network cable, it may become an antenna itself, and it will be vulnerable to radio waves (such as Wi-Fi signals) that can be seen everywhere in space. ) and bring additional electromagnetic noise to the signal transmission.
What’s more, the shielded wire must be used together with the shielded 8P8C plug to realize the end-to-end shielding function of the whole link.
Obviously, shielded wire is more expensive and more fragile than unshielded wire, because the shield can easily break if the shielded wire is bent excessively. Therefore, the use of shielded wire is much less than that of unshielded wire.
Shielded cables are usually only used in situations that are highly sensitive to electromagnetic shielding, such as where network cables are next to generators or power lines for heavy machinery.
As we said before, Ethernet is a collection of standards, one of which is the different wiring specifications: 10BASE-T, 100BASE-TX, 1000BASE-T and so on.
The Ethernet protocol also defines how each bit (1s and 0s) is transmitted over the wire, and how these bit streams are combined into meaningful frames of data. For example, Ethernet stipulates that the first 56 bits of each frame of data must be alternating 1s and 0s (ie “preamble”), the next 8 bits must be 10101011 (ie frame start flag), and then the next 48 bits The bits are the destination MAC address, then the 48 bits of the source MAC address…until the entire data frame has been transmitted.
Next, we will discuss the wiring specifications of the different sizes in the Ethernet standard.
The concepts described in this section are all related to how the wires inside the network cable are used. For example, which ones are used to send data, which ones are used to receive data, how the signals are sent, and voltage levels.
There are three components to the concept of BASE T*, so before we go into specific standards, let’s take a look at them individually, taking 100 BASE-T as an example:
The number at the beginning indicates how many “mega (millions)” bits per second the network cable can transmit, or Mbps. A 100Mbps network cable can theoretically transmit 100,000,000 bits per second, or about 12.5 megabytes per second (MBps). Note that the uppercase B and lowercase b stand for bytes and bits, respectively.
Cables at this rate are sometimes referred to as “Fast Ethernet,” in contrast to “Normal Ethernet” at 10Mbps and “Gigabit Ethernet” at 1000Mbps.
The concept of base is the abbreviation of “baseband” signal, and the corresponding concept is “broadband” signal. When these concepts first appeared, the difference was: baseband transmits digital signals in the medium, and broadband transmits analog signals in the medium.
The difference between a digital signal and an analog signal is the number of values that can be resolved.
An analog signal can represent an infinite number of different values. For example, we can use a specific voltage value on one line to represent a green pixel, another voltage value to represent a red pixel, and so on, so , this line can transmit every pixel on an image.
A digital signal can represent a finite number of different values, usually just two: 1 and 0. If the above picture were transmitted over a digital signal line, we would transmit a stream of 1s and 0s. The receiving end can parse these binary data into a series of numbers, for example, based on RGB color coding , each pixel can be constructed.
That is to say, the main difference between digital signals and analog signals is that an infinite number of different values can be obtained on the analog signal line, while on the digital signal line, it is either 0 or 1, and the third situation is impossible.
In this way, digital signal transmission has a higher error tolerance rate, because the voltage range on the wire is divided into only two cases (1 or 0).
Translator’s Note: The original text gives more examples here to elaborate on the difference between “analog signal” and “digital signal”, but the translator thinks it is too redundant, so this part of the space is omitted.
“-T” indicates that it is a twisted pair (Twisted Pair). Similar standards are “-2” and “-5” for coaxial cables with a maximum length of 200 and 500 meters, and “-SR” and “-LR” for Short Range and Long Range fiber.
The above explains the three separate parts of BASE T* related terminology, we can now discuss two important specifications of Fast Ethernet (for the related specifications of Gigabit Ethernet, we will continue to discuss later):
100BASE-T4 uses all 4 pairs of 8 wires in the network cable. One pair is used only for transmit signals (TX) and one pair is used only for receive signals (RX). The remaining two pairs can be used for both RX and TX, which is determined by the negotiation between the devices at both ends of the network cable.
T4 was one of the early standards for twisted pair, but is rarely used today due to its complexity and lack of necessity.
100BASE-TX only uses 2 pairs of 4 wires in the network cable, one pair is used for TX and the other pair is used for RX, and the remaining two wires are not used. You can make a network cable with only 4 wires to achieve all the functions of 100BASE-TX, as long as the socket contacts are in the correct position (bit numbers 1, 2, 3, 6), but usually during the network cable laying process, the other 4 The root line is also reserved for occupying space and adapting to possible scene upgrades in the future.
100BASE-TX (including all 8 wires) is the most commonly used Fast Ethernet standard today. However, it is often abbreviated to 100BASE-T. To emphasize again, T only means that it is a twisted pair, and TX means that it uses two pairs of 1&2 and 3&6.
The above introduction can help readers understand the relevant concepts from a practical and technical point of view. In practice, even if you don’t understand the principle, it’s very easy to use these products directly, even if you make some small mistakes, it’s allowed.
There are many tutorials on the Internet for “crossover cable” and “straight cable” application scenarios, but they generally seldom explain the principle. In this section, we’ll take a closer look at related concepts.
The network cables defined in the 100BASE-TX and 10BASE-T standards both contain 8 conductors, which are combined into 4 pairs in the form of twisted pairs.
Of these four pairs, only two pairs are actually used: pairs 2 and 3. Each wire is a simplex medium, that is, the signal can only travel in one direction as specified.
For full-duplex communication, one pair of wires will always transmit data in one direction, and the other pair will always transmit data in the opposite direction.
The configuration of the Network Interface Card (NIC) determines which pair of wires is used for sending data and which pair is used for receiving data.
A NIC that transmits data (TX) using pair 2 (pins 1 and 2) and receives (RX) data using pair 3 (pins 3 and 6) is called a media dependent interface ( Media Dependent Interface) (MDI), in contrast, a NIC that uses pair 3 as RX and pair 2 as TX is called a cross-mode Media Dependent Interface Crossover (MDI-X).
Assuming a computer uses an MDI mode NIC, it will always use pair 2 to send data and pair 3 to receive data. But if two computers connected by a network cable are both sending data using the second pair, a conflict will arise. At the same time, neither computer can receive data from the 3rd pair.
Therefore, the cable pairs need to be crossed so that data sent from the 2nd pair of one computer is received by the 3rd pair of the other computer, and vice versa.
The following figure is a simple diagram (don’t care about the color of the line in the diagram, it’s just to distinguish two different paths):
Note that both computers are sending data on separate channels, and by means of a crossover mechanism (X in the middle as shown), both computers can receive data sent by the other.
Therefore, after the two computers are directly connected, they must use a crossover cable to communicate .
A switch makes it easier to communicate between two computers on the same network. The switch’s NICs are all MDI-X compliant, which means that the switch always sends data on pair 3 and receives data on pair 2 (as opposed to a computer’s NIC).
That is to say, there is a crossover mechanism inside the switch, and the network cable itself does not need to be crossed:
It can be seen that the computer connected to the switch can directly use the straight-through cable , and the switch can handle the line sequence crossover. The end-to-end communication path is the same: each device sends data on its own TX line and receives data on its RX line.
As we have just discussed, two computers are directly connected, and a crossover cable is required; similarly, a crossover cable is also required between two switches:
In this case, the end-to-end communication path is the same as above.
So, what about routers and hubs? What NIC did they use?
The actual situation is that the router is similar to the computer and uses the MDI standard (the second pair is TX, and the third pair is RX), so you can replace any computer in the above picture with a router, and the communication path analysis is the same. .
A hub, on the other hand, is similar to a switch and uses the MDI-X standard.
Translator’s note: The “router” here is a device that only has a “routing” function in a narrow sense, not equal to a common home wireless router
As mentioned earlier, there are two standards for RJ45 wire colors: T568a and T568b. The standard used on both sides of a twisted pair determines whether it is a crossover or straight-through.
If you want to make a straight-through cable, you only need to ensure that the standards at both ends of the cable are the same, either T568a or T568b:
To make a crossover cable, just one end is T568a and the other end is T568b.
Note that pairs 1 and 4 are not used (blue pair and brown pair). In theory, you can remove these wires from your network cable, but it is difficult to arrange the remaining wires after removing them.
In addition, the two pairs of wires do not need to be crossed because they are not used. However, the Gigabit Ethernet standard requires all 8 wires to be used, so for consistency, usually all pairs are crossed. We’ll discuss Gigabit Ethernet later.
The last thing to note is that the data signal itself doesn’t care about the color of the wires, as long as they are connected to the correct interface they can communicate. But being able to use it doesn’t mean it’s a good idea. If the colors are randomly connected, it will be a nightmare to maintain in the future.
To sum up, we can draw a diagram of the usage of crossover lines and straight lines:
The reason for this placement is that it is easier to draw. We draw the devices on the L1 and L2 layers on the left and right sides, and the devices on the L3 layer on the upper and lower sides, and then connect them in pairs. See OSI Model for network protocol layering.
- L1/L2 layer devices are connected to each other, and a crossover cable is required;
- L1/L2 layer devices are connected to L3 layer devices, and a straight-through cable is required;
- Layer 3 devices are connected to each other and require crossover cables .
or even simpler:
- same cross
- exception passthrough
Even knowing when to use straight-through cables and when to use crossover cables, cabling can often be a headache for network engineers.
As a result, a new technology has emerged that can automatically analyze the interface mode of two devices and decide whether to cross TX/RX. This technology is called “Auto MDI-X”.
Using automatic MDI-X technology, any two devices can be connected via a straight-through cable, and let both ends dynamically determine if they need to cross TX and RX.
Auto-MDI-X is an optional feature in 100BASE-T implementations and is required in all Gigabit Ethernet devices.
So, how does automatic MDI-X work? How do the devices at both ends determine which pair is TX or RX? Which side of the device will swap TX and RX if necessary? This section describes its inner workings.
Remember, the purpose of a crossover cable is to have one side’s TX connected to the other side’s RX. That is, one side’s NIC must use the MDI standard, and the other side must be the MDI-X standard. Auto MDI-X does this like this:
Both sides generate a random number from 1-2047 first, if the random number is odd, then this side will configure its NIC as MDI-X mode; if it is even, configure it as MDI mode. Then both parties start sending connection pulses on their selected TX lines.
If both parties can receive each other’s connection pulse on their own RX line, it means the negotiation is complete, because both parties can send on the TX line and receive on the RX line.
If neither side can receive the other’s connection pulse, then they must have both randomised odd numbers or both randomised even numbers. Therefore, one of them must exchange its own TX and RX.
But the two sides cannot exchange TX and RX at the same time, because this is still a conflict. Therefore, we designed a system that switches the TX/RX pair at random intervals until the two sides successfully negotiate.
As mentioned earlier, the randomly generated number (1-2047) will change cyclically so that both parties can choose a new standard (MDI or MDI-X). But this number cannot be incremented by 1 each time, because then both sides will go from odd to even, or even to odd. In other words, if both parties choose MDI mode at the beginning, if they add 1 at the same time, they will switch to MDI-X mode and still cannot negotiate.
So, this random number uses a device called “Linear Feedback Shift Register” to achieve cyclic change.
A Linear-Feedback Shift Register (LFSR) is an algorithm that loops through all numbers in a range without repeating each loop. The numbers cycle through in a predictable, but random order (that is, they don’t appear in order of magnitude, but in a definite place).
For example, if the initial random values of the two sides are 1000 and 2000, then the parity of their next number in the LFSR sequence is completely random. But if both parties randomly arrive at the same initial value, then the numbers they randomly come out after are still the same.
This process will continue until both parties successfully negotiate.
Now the question comes, what if both sides randomly get the same number, and then the time interval of the cycle is the same? We can simply calculate the probability of this happening:
The probability of both parties randomly getting the same number is 1/2047, and the probability of both parties choosing the same time interval is 1/4, that is, the probability of both parties switching the MDI/MDI-X standard at the same time is 1/8188.
The loop runs about every 62ms, which means there are about 16 loops per second (re-random at the beginning of each loop). Then the chance that both sides will always be the same cycle time within 1 second is 1/4,294,967,296 (1 in 4.2 billion, 1/2^32). Therefore, when the two are combined, the probability that both parties will always randomly get the same random number within one second, and the time interval is the same, is 1/8,791,798,054,912 (8.7 trillion). This kind of thing is almost impossible to happen. Just wait a second.
The use of twisted pair cables for the physical wiring of the network seems unquestionable. But why? What stemmed from the dominance of twisted pair in network cabling choices?
There are two main reasons, both related to Electromagnetic Interference (EMI):
- The use of twisted pairs can greatly reduce the electromagnetic interference radiated by the wires;
- Using twisted pair can reduce the effect of external electromagnetic interference on the wire itself.
The above two characteristics are very important if the network cable needs to be bundled with various other cables for long distances (such as data center or distribution box).
As long as there is a current signal in the wire, it will definitely radiate EMI, which in turn affects the surrounding cables – also known as “crosstalk”. EMI radiation can be compensated for with additional shielding, but the famous Mr. Bell invented an excellent way to counteract EMI.
His idea was to use two wires, one sending the original signal and the other sending the exact opposite of the original signal. As a result, the two wires will radiate EMI in exactly opposite directions and cancel each other out.
To explain briefly, if one wire sends +10V and radiates +0.01V EMI; and the other wire sends -10V at the same time and radiates -0.01V EMI. Their EMIs add up to zero.
In electrical engineering, these two wires are often referred to as a “differential pair” and can be represented by TX+ and TX-.
This invention can realize a wiring scheme that does not require a lot of shielding, and is also one of the reasons why the current unshielded wires are widely used.
But now we only answered the “double” in “twisted pair”, as for why “twist”, we continue to look down:
Even with the “differential line” described above, we cannot avoid all external electromagnetic interference. Wireless networks, Bluetooth, satellite communications, and cell phones are all sources of stray radio waves in space.
But luckily Bell reappeared and devised a very simple but effective solution to shielding from EMI.
This design is based on a basic concept of EMI: the closer you are to the source of EMI radiation, the stronger the interference you receive. If two wires are alternately placed close to the EMI radiation source, they can absorb the same amount of radiation. As shown below:
The initial voltage for the blue wire is +50V, the opposite for the green wire is -50V. The EMI radiation source is the red circle in the figure, a circle radiates outward, and the farther from the center, the smaller the interference voltage. If you simply add up the disturbance voltages at the points drawn on each line in the diagram, you will find that both lines have 22V added.
Although the voltage on the right side of the wire above is different from that on the left, the voltage difference between the two wires is always the same, always 100V. The effect of EMI on both conductors is equal. After simple calculation and transformation, the initial signals can be obtained as +50V and -50V respectively according to the final 100V voltage difference, as shown in the following figure:
As a reminder, the above EMI-related voltage figures are grossly exaggerated. In fact, the voltage disturbance caused by EMI under normal conditions is in the order of microvolts (µV), or 1/1000,000 V. But the principle remains the same.
As mentioned above, the data in the network cable is sent in the form of digital signals, that is, a series of data streams of 1s and 0s. But how exactly does the twisted pair send data? We will explain this next with a simplified model.
Sending a data signal is essentially applying a varying voltage to a wire over a period of time. The sender and receiver will first negotiate a clock frequency to determine how long each unit of voltage signal transmitted will last. For brevity, we call it “tags”. At a given point in time, each bit number can only represent 0 or 1 transmitted on the wire.
Different standards will specify different voltage levels, but since we simplified the model, it doesn’t matter what the actual voltage is. But we will still use the voltage levels specified by the 100BASE-TX standard, which are +2.5V and -2.5V.
If you want to send a bit 1 on a bit number, the sender will apply +2.5V to the TX+ line; if you want to send a bit 0, it will send -2.5V to the TX+ line.
The TX- line is always reversed, bit 1 is -2.5V and bit 0 is +2.5V.
The following table is related to sending the 110010101110 binary sequence:
Note that the above picture is not the physical layout of the network cable, but only represents the alternating voltage signals on the TX+ and TX- lines. The twisted pair is actually evenly wound.
As mentioned before, the voltages on the two wires of each pair are always opposite to each other, everything is neat and symmetrical in the horizontal direction.
Now let’s add a row of noise data to the table above, assuming there is a source of EMI radiation near the network cable, and see what it ends up being:
Notice that the image is no longer symmetrical now. The two wires still send opposite voltages, but with an added amount of bias.
However, the receiver doesn’t have to be perfect +2.5V and -2.5V, it just needs to determine which wire sends the higher level. If TX+ is sending a high level, then this bit number means 1, if TX- is a higher level, then this bit number means 0.
Or even simpler, if the blue line in the above picture is above, it represents 1, and the yellow line is above it, it represents 0.
In this way, the receiver can piece together the entire data bit by bit, no matter how EMI interferes with the original level. It can be seen that the unshielded wire cannot eliminate electromagnetic interference, but it can eliminate the influence of electromagnetic interference.
We’ve covered Fast Ethernet (100Mbps) in detail, now let’s move on to Gigabit Ethernet (Gigabit Ethernet, 1000Mbps or 1Gbps).
The first difference is that the Gigabit Ethernet standard requires all 4 pairs of 8 wires, unlike 100M which only uses 2 pairs. Therefore, when making Gigabit Ethernet cables, all 4 pairs need to be crossed.
As mentioned earlier, RJ45 has two different standards: T-568a and T-568b. The image below depicts what the 4 pairs of wires look like when they all cross each other:
That said, Gigabit Ethernet requires automatic MDI-X. So, you can use a straight-through cable directly in a gigabit network, and let the network card automatically choose whether it needs to be crossed.
There are two cabling standards for Gigabit Ethernet:
This standard uses all 4 pairs, but specifies that two of them are TX and the other two are RX.
In theory, this is simpler than 1000BASE-T, but it requires more expensive Cat6 cables instead of the usual Cat5 or Cat5e cables. Therefore, 1000BASE-TX is not common in practical deployments.
This is currently the most widely used Gigabit Ethernet standard. It uses all 4 pairs simultaneously in full duplex mode, which means that each pair can be used as RX and TX at the same time. This is achieved through an “echo cancellation” technique, which we elaborate on in the next section.
The biggest advantage of using this wiremap standard is that you can run to Gigabit on your existing Cat5e cable without having to upgrade to the more expensive Cat6 cable.
1000BASE-T is often incorrectly referred to as 1000BASE-TX. This is probably because in the Fast Ethernet protocol, the dominant standard is 100BASE-TX. In addition, the cable standards are often collectively referred to as 10/100/1000 BASE-TX. In fact, at different rates, the dominant Ethernet protocols are 10BASE-T, 100BASE-TX, and 1000BASE-T.
As mentioned in the previous section, the 1000BASE-T standard can transmit and receive data simultaneously on the same pair of wires. In this section we explain how this is achieved. First, let’s make a simple analogy.
You should have had this experience: When talking to someone on the phone, if the other party turns on the speakerphone, you can hear your own voice in the receiver. This is because your voice is emitted from the other party’s speakers, reflected by obstacles in the space, and received by the other party’s microphone. This is called an echo.
High-end phones can remove the sound waves from the speaker from the sound waves received by the microphone — a technique called echo cancellation.
Echo cancellation is also the basis for Gigabit Ethernet’s ability to send and receive data simultaneously on the same pair of wires. The rationale is that if you know what signal you’re sending, then you can cull it from the signal you’re receiving.
As mentioned earlier, sending a signal is essentially applying a voltage to a wire. Conversely, to receive a signal is to read the voltage value on the wire.
If the sender applies the following voltages to a wire:
+0.5V, +1V, -2V, -1V
At the same time, also the sender, it reads the following voltage values on the same wire:
+1.5V, 0V, -2.5V, +1V
Then, the sender can do a subtraction and subtract the value it sent from the read value, so as to get how much voltage the other party has added to this line:
+1V, -1V, -0.5V, +2V
In this way, the same wire can send and receive data at the same time.
Again, the above voltage values are only for explaining the principle. In actual situations, the voltage values may be completely different, including EMI and so on. Meanwhile, we’ve just discussed only one wire in a twisted pair, the other wire will still carry the reverse voltage.
Using this technique, all 4 pairs can be used as TX and RX simultaneously. In addition, as discussed in the previous sections, they also eliminate EMI in the incoming and outgoing directions due to the twisted pair.
After reading this, you should have a macro understanding of the knowledge points of Ethernet and twisted pair. Over the years, we have studied and compiled this article. It turned out that the seemingly simple network cable actually included so many technical points. Now I feel very sorry for those network cables that I just thrown away.
Ethernet cables are filled with a lot of technology we take for granted, but are actually quite complex. In order to facilitate understanding, this article also omits many details. If readers are interested, they can continue to study.
This article is reprinted from: https://blog.vvzero.com/2022/09/18/Ethernet-Wiring/
This site is for inclusion only, and the copyright belongs to the original author.