asp
asp

Reputation: 11

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

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.

Upvotes: 1

Views: 84

Answers (3)

user11844224
user11844224

Reputation:

You seem to be confusing the port # with the protocol # ("the port number is responsible for understanding the protocol type"). Port #s are used in UDP (protocol # 17) and TCP (protocol # 6) to specify the associated process. OSPF uses protocol # 89, and does not use port #s. The protocol # is in the IP header, whereas the port #s are in the UDP and TCP headers.

Upvotes: 2

Ron Maupin
Ron Maupin

Reputation: 6472

Port numbers are layer-4 addresses for some transport protocols, but routing only happens with layer-3 (IP) addresses. Routers know 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 field 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 do 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.

Upvotes: 2

José D.
José D.

Reputation: 21

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.

Upvotes: 2

Related Questions