NAT stands for Network Address Translation and is the magic that joins networks together.
I have met a lot of really smart people that are experts in some pretty amazing fields. More often than not, these same people shy away from non-trivial network discussions when they come up. “that’s the network admin’s job.”
It is fair. Networking is a magical force that caries information from a user’s PC to a server on the other side of the planet…. and back again. Networking is often described in layers. At each layer there are a depth of implementation details to delve into.
One of the most confusing topics in networking for people seems to be Network Address Translation or NAT. While I am certainly no master of all topics networking, I would like to take the opportunity to attempt to trivialize and simplify some of the mysticism involved in NAT and networking as a whole. Once one understands the simple concepts behind the magic, complex networking problems should become easier to approach.
Baseline of Understanding
Before I can remove the magic and before we all can see how simple NAT is, we need to understand some things about networking in general. I don’t mean to bore you with mathematical equations involved in signalling processes, transmission physics, or software programming. We will try to keep things simple.
At it’s core, in it’s simplest form, networking is the medium that moves information from one location to another. If we want to confine ourselves to electric or photo signals on copper or glass-fiber, the simplest network we can imagine is a straight link between two end points. A single wire or a fiber optic cable that connects two nodes.
This may sound like a very inflexible and useless network. Maybe not even a network at all. But, there is still a lot that can be done in this setup.
Simplest Digital Data Encoding
In the interest of brevity, let’s pretend that our example involves two nodes connected by a single wire that allows one node to send electric current to the other node. This setup will be simple enough to build the basis of encoding information.
We have a ton of options to get information from the first node to the other. Perhaps the simplest information we could send is a “yes” or a “no”. Representing these values with electrons can be done several ways. We could use the presence or absence of current on the wire as an indicator of yes or no. We could use various predefined voltage levels to represent yes or no. We could go crazy and implement an entire networking stack on our single wire and encode it and encapsulate it in near infinite ways. Regardless, we need to move the yes or no from one node to the other.
The simplest way to represent our yes or no signal may be to use the presence or absence of current on the wire. No current present could mean no. A current present could mean yes. For as long as our first node transmits a current, the other node will read it as “yes”. When the current stops, the second node will read it as “no”.
This yes and no signalling forms the basis of digital computing. Building from this, we can create very complex systems (read: computers/networks/etc).
Basic Binary Encoding
I am not going to explain binary or base maths or anything similar. Let’s just agree to the following: A string of 1s and 0s can be converted into a numeric value which can be operated on by computer chips. Those that refuse to believe , are welcome to do their own research.
For those of us willing to accept binary maths as existent, how do we represent 1s and 0s in our simple yes/no single wire “network”? If we agree that no can mean 0 and that yes can mean 1, we have a way to send a 1 or a 0 to the second node. With our current setup, we have no way to send a numeric string that is more complex than a single 1 or 0. In order to represent more complex numeric values we will have to add something: Time.
If the second node were to have a clock of some sort, it could check the current on the wire every second, or every several seconds, or every fraction of a second. The results of these checks could be stored and combined to form the numeric strings of 1s and 0s, which can ultimately be converted into numeric values that can be operated on by computers.
Imagine our second node now “ticking” at 1000Mhz. Checking and recording the current on the wire every 1/1000 of a second. We will skip over the concepts involved in synchronizing the clocks on our first and second node. And, we will also just kind of pretend that we have a way interpret and operate on the exchanged numeric values.
At this stage we can send virtually any information we want from the first node to the second.