2

According to OSI reference model layers communicate with lower layer to transmit information on to other network. So they add header and tail for data and pass it on to lower layer and finally passed to other computer over wire or wireless. Switch is for communication between link layers and router for network layer. What is the use of them when 2 networking layers can't communicate directly and need to pass to lower layer.

  • 1
    I'm tempted to close this, as this could be considered common knowledge and it's a theoretical question about a model, not about engineering. – Teun Vink Sep 7 '16 at 18:33
  • I would vote against closing. Albeit basic, this is absolutely the right stack exchange for network theory questions. – Eddie Sep 7 '16 at 23:58
1

Each layer of the OSI model serves a unique purpose with the end goal of host to host communication.

Layer 1 is responsible for moving bits (1s and 0s) across a network.

Layer 2 is responsible for communication within networks. L2 uses addressing known as MAC addresses for this purpose. A MAC address is essentially the address of a particular NIC.

Layer 3 is responsible for communication between networks. L3 uses addressing known as IP addresses for this purpose.

Fundamentally, your question is not "what is the purpose of Routers", but "what is the purpose of networks", if you understand why the Internet is divided up into multiple networks, then you will understand why you need a device that facilitates communication between those networks (aka, the router).

Consider your mailing address. It will look something like this:

432 Park Avenue

Imagine a postal employee having to deliver a letter to your address. It would be impossible for the local postal employee to know every residential unit in the city. BUT, its far more feasible for the postal employee to know every street in the city. The postal employee will find the street you live on, and from there count out the residences until they get to 432. That is how they will find your specific house.

In this analogy, the street is like a network (Park Avenue), it is a grouping of houses that a single postal employee can know the location of. One street can exist next to many other streets, and as long as each street is uniquely named, they can be found by your postal employee.

The building number (432) is like a MAC address, it is the specific house/building within a street. Other streets may have the same building number, but within a particular street there can only be unique house numbers.

Your mailman doesn't need to know every house on every street, they just need to know every street. Once the street is found, they can track down the exact location based upon the house number.

The internet is the same way. Instead of forcing a Router to know every location of every host in the whole world, Router's are only concerned with knowing the location of every network. Once the packet is routed to the proper Router (aka, the proper street), the packet delivery process can look up the appropriate MAC address (aka, the proper house) to deliver the packet to.

So in the end, a Router exists to know the location of every network, and to move packets from Router to Router until the final Router in the path is found. When that happens, that Router will look up the specific MAC address to get the packet to its intended destination.

For more information on how a Router does its job (and therefore, the job the router serves) check out this article that discusses how a Router moves packets through a network.


The OP asked this question in comments:

only bits come out of the physical layer for transmission. So does Router convert them back to packets upon receiving bits as input?

The answer is "eventually yes". Each layer adds to the original data what it needs to add in order to accomplish its purpose:

  • Layer 3 (the Router) will add an IP header which would include a Source and Destination IP address
  • Layer 2 (the NIC on the Router) would add an Ethernet header which would include a Source and Destination MAC address

Layer 2 would then convert the resulting frame into 1s and 0s and send them to Layer 1 to be sent across the wire.

The process can be seen in this animation:

enter image description here

  • My doubt is router is for routing packets where as only bits come out of the physical layer for transmission. So does Router convert them back to packets upon receiving bits as input? – amruth polavarapu Sep 8 '16 at 3:09
  • @amruthvenkat Eventually, yes. The router deals with packets, then passes the packet to L2, which deals with the frame, which then converts the frame into 1s and 0s to pass it across the wire. Take a look at the encapsulation and de-encapsulation process... in fact, I'll edit the animation into my answer because its relevant, and I'm really proud of it. – Eddie Sep 8 '16 at 6:24
0

Traffic in different IP networks/VLAN's (Layer 2 - MAC) cannot communicate with each other. For communication between IP networks/VLAN's you need a Router (Layer 3 - IP).

  • My doubt is router is for routing packets where as only bits come out of the physical layer for transmission. So does Router convert them back to packets upon receiving bits as input? – amruth polavarapu Sep 8 '16 at 3:10
0

Layers communicate with their corresponding layer logically. That means the transport layer adds information that the receiver's transport layer understands.

Your statement "Switch is for communication between link layers and router for network layer." is a mischaracterization of their functions. See if this question helps you.

  • 1
    Can you explain more clearly what is purpose of router and if my question is correct? – amruth polavarapu Sep 7 '16 at 18:38
  • 1
    This really isn't the forum to teach basic networking fundamentals. There are lots of websites and videos that you can learn from. A quick Google search will give you lots of information. – Ron Trunk Sep 7 '16 at 18:40
  • My doubt is router is for routing packets where as only bits come out of the physical layer for transmission. So does Router convert them back to packets upon receiving bits as input? – amruth polavarapu Sep 8 '16 at 3:10
0

Encapsulation is a term often associated with the layers - a datagram is encapsulated then handed to the lower layer. A routers function is to route packets. A switches function is to switch frames.

  • My doubt is router is for routing packets where as only bits come out of the physical layer for transmission. So does Router convert them back to packets upon receiving bits as input? – amruth polavarapu Sep 8 '16 at 3:02
  • Packets come out of a router. Frames are made up of bits grouped together. Packets encapsulate frames. – Ronnie Royston Sep 8 '16 at 14:43
  • "...a datagram is encapsulated then handed to the higher layer." I think you meant that a datagram is encapsulated, then passed to a lower layer. An application datagram is encapsulated by layer-4 (TCP, etc.), then the encapsulated layer-4 datagram is passed to layer-3 (IP, etc.), the encapsulated layer-3 datagram is passed to layer-2 (ethernet, etc.). When passing to an upper layer, the datagrams are decapsulated. – Ron Maupin Sep 10 '16 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.