How a router decides that this packet is of a particular protocol?

54 views Asked by At

So as per my knowledge the port number is responsible for understanding the protocol type but I am still confused as it is not mentioned in the packet. I might sound dumb but I just want to know how the received packet is determined for a particular protocol like ospf.

2

There are 2 answers

2
José D. On

When you configure a router, you choose the routing protocol it will use for routing packets. Dynamic routing protocols, as OSPF or RIP, are not a property of the packet, but of the router.

Routing packets occurs in level 3 (network layer) in OSI Model, but protocols as HTTP, FTP and IMAP, for example, are in level 7 (application layer), and uses ports for organizing and filtering network traffic.

0
Ron Maupin On

Port numbers are layer-4 addresses for some transport protocols, but routing only happens with layer-3 (IP) addresses. Routers no nothing about port numbers. Routers do not look at the packet payload, only the IP header.

OSPF does not use port numbers (it has its own transport protocol). The Protocol field in the IPv4 header (Next Header filed in the IPv6 header) tells the destination IP process to which process it should send the packet payload.

If the router itself is the destination, its IP process will send the packet payload to the process of the Protocol (Next Header) field. Routing protocols are applications running on a router to exchange routing information between routers, but routing protocols don not route. Routing happens based on the routing table, and routing protocols are one of the ways a routing table may get populated, but routing protocols are not involved in the routing.