Jump to content

Networking 101: The first 3 layers

Haru

DISCLAIMER: As the title states, this should be considered as "a 100s class". I'm only cover the first 3 layers of the OSI layer model. If someone wants to continue this college course naming scheme be my guest, It'd be nice to coordinate with you though so we don't have a "103" with subnetting in it or something. I plan on making cable and wireless standards 102 and the next few layers of the OSI model 103.

2/2/2013: Linus made a great video about Ethernet cables and standards, I might go over that in more depth, but here's what you need to know for the basics:

Okay, now that's out of the way we can jump right into the content.

Have you ever heard Linus (or anyone really) talk about a switch or a router and wonder "What's the difference between all of this networking equipment?" That's essentially what I'm going to cover and defog. It might be useful to read my cable standards guide (link will be here after I'm done writing it) to get a bigger picture. To get into the right mindset we should first pose the question "What is all this networking business anyway?" To put it simply, networking is how you get "stuff" from point A to point B. Say you want to print something out at your local library, typically, when you hit the print button your job (aka: your stuff) gets sent to a print station where you can select you job and get your documents. Networking is also when you go to a website and watch a movie, or when you download something off of Itunes. Networking is involved almost every time you do something that has another device that isn't your computer (or phone or tablet or whatever you're using) involved.

The above paragraph was something of a formality, now we get into the hard stuff. To send a file to someone else we use something called the OSI Layer Model. This is the FOUNDATION of understanding networking, you will be doing yourself a MASSIVE disservice if you don't memorize this and get a good grasp on it. To send data from point A to point B we need to do it in a way that all computers understand and it also has to work with networking equipment we have. We do this by sending our stuff through the 7 layers of this model, we're only covering the first 3. We'll start with layer one and work our way up;

Layer 1: Physical

The physical layer, also known as the hardware layer, is where your data is in it's raw format "bits". These are literally the 1s and 0s everyone always talks about. The physical layer is where Networking cables, radio transmissions (wireless), and hubs reside. In networking we have various things to transmit out stuff from point A to point B, to get a better picture of the physical layer and the various networking equipment we'll go over the hub.

A hub is the bane of network techs. Think of a hub like a military radio transmission in war time... only it broadcasts everything on public channel so the enemy can hear it too. A hub gets data from point A to point B by sending it through all Ethernet ports, part of the protocol essentially says that the receiving computer should check to see if it's the file it wanted. This can be VERY bad because someone of a nefarious nature can tell their computer to grab all data, not just the ones that were meant for the computer in question. The other reason hubs suck is because collision rates are very high. Hubs are Half Duplex, which means that they're like walkies talkies in that you can either talk or receive, but not both. When you try to talk and receive at the same time then you get a data collision and your bits have to be resent for you to get your "stuff".

Timings: (I'm going to try and cover this without getting into waves or anything to make it simpler)

This little chunk here will probably get some things cleared up about how collisions can occur and the speed of cables. When you send "stuff" over a cable it's broken down into smaller parts to handle (we'll cover that in a bit). If you consider that all we're doing is sending chunks of data down some copper wire with electrical variations, you have to wonder "the speed of electricity going down this cable is (theoretically) a constant, so how do we have "faster" cables?" This is where timing comes in, we're not sending data "faster" just sending more of it in a given moment. Imagine a clock, every 5 seconds we'll throw a crumpled up piece of paper with a message on it at a friend. If I wanted to give him messages 5 times faster I'd throw a message at him every second instead of every 5. It's the same principle with sending data.

Layer 2: Data Link

The data link layer, also known as the media layer, is where your data is now being transmitted in "frames". I've put what unit (officially called a protocol data unit) the layer uses in quotations at the start of each section to provide easier differentiation from layer to layer. What makes this layer in particular very different from the first is that we've moved on from broadcast. On the data link layer we use MAC addresses to send files to each other. MAC stands stands for Media Access Control (hence this layer being called the media layer sometimes). To any of you confused about this address business, think about this like house addresses. MAC addresses are physically attached to the network interface you use, in other words each Ethernet port, Wi-Fi adapter, or other interface has it's own unique address.

The device we'll go over on this layer is the *drum-roll* the switch. A switch differs from the hub in that it sends data to another person's mac address (who is also plugged into the same switch) instead of sending it to everyone. The wireless equivalent of this is a Wireless access point or WAP (different from a wireless router). The next major difference with switches is that they're full duplex which combined with not broadcasting to everyone GREATLY reduces collisions. The only time collisions occur now is when two people send something at the EXACT same time to on person in particular.

Layer 3: Network

The network layer transmits data in "packets" (starting to sound familiar?) Packets are what we use to send people stuff across the internet. To wrap up this idea of layers (see what I did there) packets are inside of frames, frames are broken down into bits. How many packets are inside of a frame differs on what kind of frame it is (more on that in 103). The main difference between layer 3 and layer 2 is that the network layer is for transferring things to other networks you're not directly connected to with a planned route.

That leads me into the device for this layer, the router. Switches can only see what are directly connected to them and can only send frames to those mac addresses it knows. A router can look beyond it's own personal network and through routing protocols determine which route to take. Think of this like driving to a different country, there are a bunch of different ways you can do it, and you may not always want to take the shortest (using the scenic route for example). We'll go over routing protocols more on a later topic (probably 104 or 105). Routers and Layer 3 use IP addresses, now I could go on and on about ipv4 and ipv6 but for simplicity's sake let's save this for later. IP addresses differ from MAC addresses in that these can be assigned, it's not tied down to one piece of hardware. Probably the most important thing you should know about routers and IP addresses is NAT or network address translation. NAT is why you don't have to buy an IP from your internet service provider for every device you have. Remember when I said IP addresses are like house addresses? Think of NAT like an apartment complex. We share the same address but have a letter at the end it. A router gives you a PRIVATE IP address which is only used in your personal network. When something comes through your router for you it sends it to your private address if it was meant for you (this is handled by the higher layers).

As I said at the beginning, this is only meant to be an introduction, in small readable chunks. Honestly I gave a rather rough explanation of most things, I don't encourage just reading this, go look up more. If you have any feedback or questions please leave a comment and I'll get back to you as soon as I can. I'm interested in working with people on making more of these, so let me know if you're up for it.

Link to comment
Share on other sites

Link to post
Share on other sites

That was really long but I got through the end and actually found it interesting!

Feel free to PM for any water-cooling questions. Check out my profile for more ways to contact me.

 

Add me to your circles on Google+ here or you can follow me on twitter @deadfire19.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

Very informative! I've been wanting to learn more about networking recently and this has tingled my tastebuds :)

export PS1='\[\033[1;30m\]┌╼ \[\033[1;32m\]\u@\h\[\033[1;30m\] ╾╼ \[\033[0;34m\]\w\[\033[0;36m\]\n\[\033[1;30m\]└╼ \[\033[1;37m\]'


"All your threads are belong to /dev/null"


| 80's Terminal Keyboard Conversion | $5 Graphics Card Silence Mod Tutorial | 485KH/s R9 270X | The Smallest Ethernet Cable | Ass Pennies | My Screenfetch |

Link to comment
Share on other sites

Link to post
Share on other sites

Great little read there. Looking forward to future posts that are similar to this :)

Link to comment
Share on other sites

Link to post
Share on other sites

Ahhh, the OSI model. The top two layers are very interesting... the bottom five not so much :P

Link to comment
Share on other sites

Link to post
Share on other sites

Ahhh, the OSI model. The top two layers are very interesting... the bottom five not so much :P
I dunno about that, as a security buff I find there's fun things you can do involving all of the layers. In terms of ethical hacking that is.
Link to comment
Share on other sites

Link to post
Share on other sites

Great little read there. Looking forward to future posts that are similar to this :)
I'm writing another one today, I'm going to try to be more active with this, but college is taxing right now.
Link to comment
Share on other sites

Link to post
Share on other sites

Interesting, have my like!
Nononono, you have MY like.
Link to comment
Share on other sites

Link to post
Share on other sites

Very informative! I've been wanting to learn more about networking recently and this has tingled my tastebuds :)
Cranking another one out today. I've come to love the networking field more than hardware, it's a really good industry to get into.
Link to comment
Share on other sites

Link to post
Share on other sites

That was really long but I got through the end and actually found it interesting!
I thought it was a little long, but I tried to keep it in plain English the best I could.
Link to comment
Share on other sites

Link to post
Share on other sites

Nice little read
Thanks, I like that spare server rig, though in my humble opinion it could use a little more punch in the processor department.
Link to comment
Share on other sites

Link to post
Share on other sites

Bigups! Very nice read :)
Thank you, kind sir~
Link to comment
Share on other sites

Link to post
Share on other sites

Oh the OSI model. In the university I had 2 courses about layers 2 and 3, 2 courses about layer 1, and 3 for the top ones. Your article seems pretty accurate and I admire you for your dedication in writing a fairly lengthy article summarizing the layers.

Link to comment
Share on other sites

Link to post
Share on other sites

Nice little read
I agree with you completely, however being 15 doesn't exactly help with funds for an upgrade :p
Link to comment
Share on other sites

Link to post
Share on other sites

Nice little read
I totally understand where you're coming from, I didn't get anything bawler until I was around your age, and that was with months of saved up money.
Link to comment
Share on other sites

Link to post
Share on other sites

Wow, some stuff came up, I'll probably end up posting the next one tomorrow. Hint, it's about cable standards and topology.

Link to comment
Share on other sites

Link to post
Share on other sites

I'm glad there is someone else out there willing to educate. Gives me that warm and fuzzy feeling.

My daily driver.

  • CPU
    Intel i5 6600 K
  • Motherboard
    Asus Maximus VIII Hero
  • RAM
    16 Gig of G.Skill TridentZ Series 3000 Mhz
  • GPU
    EVGA 1070 FTW edition
  • Case
    Fractal Design Define R5
  • Storage
    Samsung 850 Series 250GB for boot + WD 2TB Black
  • PSU
    Corsair RM 750W
  • Cooling
    Corsair H100 V2
  • Keyboard
    Corsair K 70 LUX
  • Mouse
    Corsair Raptor M45
  • PCPartPicker URL
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×