Transcript for:
Understanding Ethernet Network Encoding

So in this video I want to show you an example of exactly how information is encoded on a real network link. So this is a setup that I put together. I have my computer here connected to an Ethernet network, and I've stripped away the Ethernet cable like this. And so if we look inside the cable, we can see there's like four pairs of wires. There's an orange pair, a blue pair, a brown pair, and a green pair. And now in this setup, the other end of this cable is connected to a 10BASE-T network. which is a particular standard that's developed by the IEEE. The IEEE is the Institute for Electrical and Electronics Engineers. And 10BaseT is kind of an older standard that allows you to transmit data at 10 megabits per second. 10 megabits per second, which is how we write this, which is 10 million bits per second, which may sound like a lot, but this same ethernet port on my computer also supports a couple other standards. It supports 100. base, oops, 100 base Tx, which allows you to send data at 100 megabits per second, and it also supports 1000 base T, which lets you transmit data at one gigabit per second, or one billion bits per second. But for this experiment, I'm going to use 10BaseT because it's a relatively basic, uses a relatively basic line coding mechanism, which is Manchester encoding, which we saw in the last video. These other two standards are a bit more complex. So for this video and for this demonstration, I just want to use this sort of relatively simpler standard. So of these three standards, I guess, the 1000BaseT, the 1 gigabit or gigabit Ethernet standard, is the only one that actually uses all four pairs of wires in here. The other two standards only use two pairs. So from the computer's perspective, the orange pair in this case is used for transmitting data in this direction, and the green pair is used for receiving data. And then the blue and the brown pairs are unused. So what I've done here is stripped away a little bit of the insulation on the orange pair. and from the two different wires here on the orange pair, and connected an oscilloscope, which is this thing here. I've connected this oscilloscope to the orange pair to see exactly what's going on. And what the oscilloscope does is it measures the voltage across the two wires in the orange pairs, and it plots that voltage over time on this graph. And so here we can see the voltage seems to be going up and down a lot over time. So if I scroll down here, what I've done is taken a screenshot from the oscilloscope so we can look at this in a bit more detail. Okay, so to orient you with what's going on here, this center line here across the middle is zero volts, and this key here is telling us that each division is 500 millivolts. So this is 500 millivolts, this is 500 millivolts per division, which means two divisions is gonna be one volt. And then down here this is going to be negative 1 volt and so what we can see is that the signal is fluctuating between positive 1 volt and negative 1 volt positive 1 volt negative 1 volt and so on now in the horizontal Direction this is telling us that each division represents 100 nanoseconds so from you know here to here for example is 100 nanoseconds and Just to remind ourselves 1 nanosecond is equal to 10 to the minus nine seconds. And if we, I guess we can multiply both sides of this by 100 to see that 100 nanoseconds is equal to 10 to the minus seven seconds. Or another way to look at this is to say that 100 nanoseconds is equal to one over 10 to the seven seconds. Or you could also write that as one over 10 million seconds or 1 10 millionth of a second there another way to think of this is that basically each of these divisions is 1 10 millionth of a second or in other words you're going to have 10 million of these Divisions per second and if you remember the speed of this ethernet link is 10 Megabits per second and so 10 megabits per second is 10 million bits per second and so we're basically going to expect to see 10 million you know one bit every 100 nanoseconds. So this is a very convenient division here. We should be able to find one bit per division. And so what's going on here is we're using the same Manchester encoding that we saw the last time. And so the signal looks a little bit different, but really what's going on is we have these same symbols where the symbol for a zero is a voltage transition from a positive voltage to a negative voltage. And then the symbol for a one... is a transition from a negative voltage to a positive voltage. And so these symbols are happening at this center time here, where that voltage transition is taking place. And so if we want to, we can just start looking at this signal and see if we can see some of these patterns here. So right here, for example, we see a voltage transitioning from a negative voltage to a positive voltage right here. And so that would indicate that that is a 1. And then if we go another 100 nanoseconds, we see that same transition from a negative voltage to a positive voltage, and that means that's another one going from negative to positive. And so here in the middle, we have this transition going back down from positive to negative, but because that's not happening 100 nanoseconds apart, we know to ignore that because we know that the link speed is 100 megabits per second, which means we should expect a symbol. per 100 nanoseconds. So even if our clock is a little bit off, we should be able to tell the difference between 50 nanoseconds and 100 nanoseconds. And so if we keep going, now we get to a transition where we're going from a positive voltage to a negative voltage, and that's a zero. And here we're going from negative to positive, so that's a one. Positive to negative is a zero. Positive to negative again is a zero. Negative to positive is a one. And positive to negative is a zero. And so here we've decoded eight bits, and eight bits makes a byte. And so we've decoded a byte of information from this Ethernet. But if we want to, we can keep going. I've taken another screenshot and just kind of appended it here and lined it up so it all lines up perfectly. And so if we keep going, we see that we get another, looks like a one actually right here, followed by a zero, another zero. Another zero, another zero, we're going positive to negative, so that's a zero. Another positive to negative, which is a zero. And then a negative to positive, so this is a one. And then a positive to negative, which is a zero. And so this is another eight bits, or another byte. And so we could keep going, but we've decoded two bytes here from this Ethernet. And one thing that's sort of, I guess, a little bit different about Ethernet is that the way that it puts these bits onto the wire in this format, It reverses the order of the bits so in other words the sort of 128 place is sent is sent last and the ones place is sent first So if we want to convert this to a real binary number we actually have to flip all these bits around so the zero Goes first then the one then this zero then this zero then this one then this zero And then the one and the one so we've just flipped these bits from from first to last. And then the same thing for this. So we start over here and just go backwards. 0, 1, 0, 0, 0, 0, so that's five zeros. And then finally this one. And if we look at these two bytes here and convert these to decimal, this one, if we convert to decimal, we get a 75. And this one, we get a 65. And this is actually the information that I was trying to send on my Ethernet interface that I captured here. And actually if you were to use that ASCII table that we looked at a couple videos ago, 75 stands for the letter K and 65 stands for the letter A, and this is exactly the data I was trying to send. So this gives you just kind of a sense of how information is actually encoded on a real Ethernet link.