Options

OSI Encapsulation/Decapsulation process

DeemeetriDeemeetri Member Posts: 60 ■■□□□□□□□□
Hey guys, I'm a visual type of guy, I need to see it at work in my head in order to understand it but I'm reading the Odom book and Lammle book and none of them are penetrating my brain... so I tried youtube and google but none are answering my questions so I figured I'd ask you guy... How does the OSI Encapsulation/Decapsulation process work??? one of the things are puzzle me after looking at numerous videos and looking at diagrams... is the process different when A and B are on the same network then A and B being on a different network?? can someone please explain the process to me? Thank you guys

Comments

  • Options
    TehToGTehToG Member Posts: 194
    I can't post it for copyright reasons but page 63 on the Lammle CCNA book has a pretty good diagram explaining it. Figure 2.12

    It would be helpful if you explained how you think it works and we'll correct you if wrong.

    osi7.gif

    Think of it like a package. The data is in the package and you want to 'post' it. You bring the package to the post office.

    They place the address on the package and send it on to the sorting office. It may be placed in a van/freightcontainer (i.e. a bigger package). Once the container arrives it's opened and the package removed. The destination is read and the package is delivered. Finally you get it and open it to get the data.

    Each layer wraps up the data into a new 'wrapper' which adds information for sorting/delivery/error checking. etc.
  • Options
    DeemeetriDeemeetri Member Posts: 60 ■■□□□□□□□□
    Thanx TehTog i still don't get it though lol ok so this is how I see it correct me if i'm wrong, lets say computer A is sending a message to computer B which is on a different network, on the network that computer A is connected to, it starts at the Application layer which checks if the resources are there to continue the transmission... when it goes "yup we're good to go" it sends the data down to the Presentation data which basically translates the data... sends it to the Session layer which allows different connections to distinguish between one another I guess which makes no sense to me because I thought that's what TCP multiplexing does with port numbers at the Transport layer... anyways the data gets sent to the Transport layer which puts a "condom" on top of the data making it a segment, breaks the data into little pieces, numbers them, sets the window size(flow control) and starts sending data to the network layer... the network layer looks at the data that's inside the "condom" and puts the destination IP address of computer B that's on the other network... see it already doesn't make sense to me and this is where I get lost and questions start to come up... am i correct until the network portion of this?? what happens after it leaves the transport layer and goes through the network, the data link, and the physical layer??
  • Options
    TehToGTehToG Member Posts: 194
    Lets follow it through. The application is MSN for example.


    Layers 1-4 are networking, Thats what we are concerned about. Layers 5-7 are the programmers problem.

    1. You sent a message "hello" to a friend on msn. The application then sends the message. It passes through the presentation layer/session layer.

    2. The package from the session later gets sent to the transport layer. A TCP header is added (source and destination port etc). We call this collective chunk of data a segment.

    3. The network layer adds the IP header (a source and destination IP address as well as other info such as the protocol) is added and we call this chunk a packet.

    4. The datalink layer adds the MAC header (source and destination MAC address as well as other fields like the etherfield). We call this chunk a frame.

    5. The data is then streamed from location A to location B via the physical layer. This is where the binary exists.




    Now. Switches are layer 2 devices, Routers are layer 3. These devices are aware of their layer and anything below. They use the information in the headers to device where the data should get sent.

    1. The routers look at the layer 3 header, know where the packets need to go and route them there.

    2. Once the recieving computer gets the data is first constructs the frames from the bits, it can then construct the packets from the frames and the segments from the packets etc. The data follows the same process as before except instead of the data being added like encapsulation, with decapsulation the information is stripped off (as it has done it's job).

    3. the segment gets processed up through the layers of the application and the user gets the "hello" message.
  • Options
    DeemeetriDeemeetri Member Posts: 60 ■■□□□□□□□□
    see this is where I get confused in my mind when I try to picture it... ok so say we have a network of a PC - ROUTER - Serial Link - ROUTER - PC... basically there's no switch... does it skip the Data Link Layer all together??? or example 2... PC - SWITCH - ROUTER - Serial Link - ROUTER - SWITCH - PC... what I'm confused about if it leaves the PC and it hits the Network Layer (which are routers who care about getting data to a different network)... with the setup like example 2 the data is going to hit the switch first where the switch will go "hmm this is going to a whoooole different network then this one which is beyond what I can do but I know a dude that can get this done for me, his name is a router which is my default gateway" and sends the data to the router so with this logic is goes Layer 7, 6, 5 , 4, 2, 3, 1... see what I mean... this is why I'm confused because everything that I see doesn't make sense when I try to imagine it hahaha sorry to keep drilling you I just really REALLY want my CCNA and I will do everything to understand the information detail by detail :)
  • Options
    TehToGTehToG Member Posts: 194
    You can't 'skip a layer'. Watch this video, It'll explain it for you.

    [video=youtube_share;P0Dv4ypNW-o]http://youtu.be/P0Dv4ypNW-o[/video]
  • Options
    MrBrianMrBrian Member Posts: 520
    Deemeetri wrote: »
    see this is where I get confused in my mind when I try to picture it... ok so say we have a network of a PC - ROUTER - Serial Link - ROUTER - PC... basically there's no switch... does it skip the Data Link Layer all together??? or example 2... PC - SWITCH - ROUTER - Serial Link - ROUTER - SWITCH - PC... what I'm confused about if it leaves the PC and it hits the Network Layer (which are routers who care about getting data to a different network)...

    It can all be confusing at first, I understand. I think you are getting hung up on: routers > network layer(3).. and Switches > data-link layer(2).
    Those pairings are correct, but they are referring to what layer that device operates, or, "makes decisions" on.

    For example, when routers receive a packet, they'll look inside the Layer 3 IP header to see if it knows how to get to the Destination IP address, which will be in the header.

    And when a switch receives a frame, it will check the Layer 2 Ethernet header, which will have the Destination MAC address. Then, if it has that MAC address associated to a certain port, it will send the frame out that port. So the switch makes decision as Layer 2.

    Now you might be thinking frames and packets, what's the difference.. Well a packet is considered Layer 3 and a frame is considered Layer 2. BUT, the router will actually get frames, but then strip off the Layer 2 header, leaving the Layer 3 packet exposed. Then, it will check the Destination IP address to see if it knows where to send it.

    Let's say it knows how to get to that IP address, and it's out another one of its Ethernet ports. The router will then take that Layer 3 packet, and add a new Layer 2 header, that is appropriate for the outgoing interface.. then send it out that interface.. so, you see what I mean? Switches don't really change things about the frame. They get it, see where it goes, and send it out..

    But routers, who's job is to separate networks (or broadcast domains), receive a Layer 2 frame, will then have to "take off" the Layer 2 header, and add a new Layer 2 header that is suitable for where it needs to send it out.

    I hope that was somewhat understandable, let me know if you need any clarification
    Currently reading: Internet Routing Architectures by Halabi
  • Options
    MosGuyMosGuy Member Posts: 195
    Deemeetri wrote: »
    see this is where I get confused in my mind when I try to picture it... ok so say we have a network of a PC - ROUTER - Serial Link - ROUTER - PC... basically there's no switch... does it skip the Data Link Layer all together??? or example 2... PC - SWITCH - ROUTER - Serial Link - ROUTER - SWITCH - PC... what I'm confused about if it leaves the PC and it hits the Network Layer (which are routers who care about getting data to a different network)... with the setup like example 2 the data is going to hit the switch first where the switch will go "hmm this is going to a whoooole different network then this one which is beyond what I can do but I know a dude that can get this done for me, his name is a router which is my default gateway" and sends the data to the router so with this logic is goes Layer 7, 6, 5 , 4, 2, 3, 1... see what I mean... this is why I'm confused because everything that I see doesn't make sense when I try to imagine it hahaha sorry to keep drilling you I just really REALLY want my CCNA and I will do everything to understand the information detail by detail :)

    Deemeetri,

    PCs can't communicate directly through IP addresses, they "talk" with MAC addresses. In your first example without a switch. After the network layer, the pc still needs to know the MAC address of its default gateway. So it sends out an ARP broadcast i.e "Whoever has IP address X, please tell me your MAC address". Which the router would respond with, then the PC would send the data to the router directly to be sent off.

    In example 2: It's the PC that looks at the IP address & figures out whether the computer is local or not. If so, it sends out an ARP to get the MAC address. After finding out, it would send the data. The switch would examine the MAC and most likely have PC2 in its table and send the data directly to PC2. If its on a different network, as in example one the PC would learn the routers MAC. Then send the data to the router to be forwarded off. The switch would pass it to the router; based on the destination MAC address. It's the PC that realizes when things need to go to the router, not the switch. There are of course exceptions. It's best to understand the basics, before adding in extra pieces.

    Do you understand how two computers communicate directly through a cross over cable ? or through a basic hub ?. I'd start there, then swap the hub with a single switch/router. Once you can understand the logic of how data travels: between two directly connected computers. Working up through a single hub, switch, router. Things will start to make sense as you add in more devices. I'd keep things simple at first, understanding the OSI model is key icon_smile.gif
    ---
    XPS 15: i7-6700HQ, 256 pcie ssd, 32 GB RAM, 2 GB Nvidia GTX 960m, windows 10 Pro

    Cert in progress: CCNA (2016 revision)
  • Options
    Ltat42aLtat42a Member Posts: 587 ■■■□□□□□□□
    Here's another nice video. It explains how packets go across a network.

    Warriors of the Net

    hth
  • Options
    DeemeetriDeemeetri Member Posts: 60 ■■□□□□□□□□
    Thank you sooo much guys, OK i'm starting to understand the process a lot better... the source and destination mac addresses don't change from point A to point B... only the source and destination MAC addresses change as it goes through one interface to the next... quick question though... the PC sends an ARP to find out the mac address of its default gateway in order to send the message to the router but once it gets to that router the MAC addresses get stripped so my question is... how do the routers know each others mac addresses to send the packet from one router to the next router because as far as i understand the ARP is a broadcast that doesn't go beyond the router??
  • Options
    TehToGTehToG Member Posts: 194
    The ARP broadcast goes out on the whole broadcast domain. Routers are designed to separate broadcast domains and therefore the broadcasts do not go any further.

    Routers have routing tables which essentially tell that router about other networks and which router is the next 'hop' to getting to those networks. There are a number of routing protocols (RIP is the only one covered in ICND1) that run on routers which share routes to other networks between routers etc.
  • Options
    DeemeetriDeemeetri Member Posts: 60 ■■□□□□□□□□
    oooh hang on so basically what you're saying is when the data is going between serial interfaces is stays in the physical and network layers where as the Serial link is the physical portion and since it finds the next hop by IP addresses the headers don;t get changed until the router actually sees that that data is meant for a device that's connected to it;s own LAN which is where is begins to unravel the capsule and add it;s owm source mac and the destination mac of the computer/server the data is going to... am I understanding this right???
  • Options
    TehToGTehToG Member Posts: 194
    Routers look a the the raw datastream but they only selectivly look for what THEY want form it. They look for the headers. There's no need for them to see the data and infact all that decapsulation would be awfully slow.

    In order to send data from a PC to the network it sends it to the switch. The destination IP address is the destination computers IP address but the destination MAC address is the mac address for the next hop.

    The pc wants to send packet x to another pc outside its network, so it goes to the default gateway. The IP address for destination and source are set and never adjusted but the MAC address changes with each hop along the way.

    [video=youtube_share;6q4GqoTfJM0]http://youtu.be/6q4GqoTfJM0[/video]
  • Options
    superjerelmansuperjerelman Member Posts: 30 ■■■□□□□□□□
    I'll start you off at layer 4.

    The layer 4 segment gets drop down to layer 3 the network layer, the network layer encapsulates the layer 4 segment in a layer 3 packet which contains the layer 3 source and destination ip address.

    The layer 3 packet gets drop down to layer 2 the data-link layer, the data-link layer encapsulates the ip packet in a layer 2 frame that has the source and destination mac-address, if the pc that's sending the packet doesn't have the layer 2 destination mac-address it sends out a arp broadcast message, that says this is my ip address(source) and this is the ip address i'm looking for (destination) what is the layer 2 mac-address for this ip address.

    Once all this is resolved the two pc's can communicate, this is for the local subnet only. if the ip is not local then the gatway (router) will see this (remember, the arp request is a broadcast so all host on the lan will see the request) if the ip address belongs to a different subnet then the router will respond with it's own mac-address.

    once all is known thru either scenario, the layer 2 frame is drop down to layer 1 the physical layer, where everything that was encapsulated before it, is turn in to bits and put on whatever medium you are using.

    Now I'm just going to refer to the frame, as the frame arrives at each destination (let's say a switch and then a router), when the frame arrives at the switch,the switch checks the layer 2 destination mac-address to see where it needs to be sent next, it looks at the the layer 2 destination mac-address, it says ok your going to the router, so it re-encapsulates the frame with a new source (the switches mac-address) and destination layer 2 mac-address of the router.

    When it arrives at the router, the router sees that the frame has it's mac-address on it and says ok this is for me, it then checks the layer 3 address and sees that it has a source address for pc 1, but the destination is not part of pc 1 subnet, so the router looks in it's routing table to see if it knows a route to the destination, if the router finds one, it drops it back down to layer 2 for re-encapsulation with a new source and destination mac-address until it finally arrives at it's destination.
    BS:IT from WGU.
  • Options
    DeemeetriDeemeetri Member Posts: 60 ■■□□□□□□□□
    Can I just say that I absolutely LOVE this forum, you guys are very willing to help and answer questions and I really really appreciate you guys :)
  • Options
    TehToGTehToG Member Posts: 194
    No problem. You'll hopefully be helping others when you get your CCNA. It's the best way to learn. I'd advise you watch the whole CBT Nuggets series. It's very good at describing fundamentals
  • Options
    DeemeetriDeemeetri Member Posts: 60 ■■□□□□□□□□
    I def will man, I have the Lamme book, I have both books from Wendell, I have the CBT Nuggets series and I have the Train Signal Series, oh and a CCNA quick command guide lol what I'm slightly worried about is the lab portion of the exam... not really sure what to do there but I'll figure it out when I get to that I suppose :)
Sign In or Register to comment.