2

I have studied from various sources that router is a layer 3 device. It does routing based on Network layer (layer 3) header, but I have a doubt.

Network address translation (NAT) is a feature of Router which is required for routing traffic. It does processing based on both Network layer and Transport layer (layer 4) headers. So why cant we say that router is a layer 3 & layer 4 device when it is processing layer 4 header also?

8

Network address translation (NAT) is a feature of Router which is required for routing traffic.

That is completely incorrect. NAT is a kludge designed to extend the life of IPv4 addressing until IPv6 is ubiquitous. NAT breaks the IP paradigm of end-to-end connectivity, and many things have problems with NAT. Routing works quite well without NAT. You should only use NAT were you absolutely must use it, e.g. private to public addressing, or for joining two networks with overlapping addresses.

It does processing based on both Network layer and Transport layer (layer 4) headers.

Again, no. Routing does not involve the layer-4 header. One form of NAT, NAPT (Network Address Port Translation), will use the TCP or UDP ports, or ICMP query IDs, but it only works for those three protocols, and it breaks other transport protocols and many applications. A routing table (what routers use to determine the path of packets) has nothing about layer-4 protocols in it.

RFC 2663, IP Network Address Translator (NAT) Terminology and Considerations explains NAPT:

4.1.2. Network Address Port Translation (NAPT)

NAPT extends the notion of translation one step further by also translating transport identifier (e.g., TCP and UDP port numbers, ICMP query identifiers). This allows the transport identifiers of a number of private hosts to be multiplexed into the transport identifiers of a single external address. NAPT allows a set of hosts to share a single external address. Note that NAPT can be combined with Basic NAT so that a pool of external addresses are used in conjunction with port translation.

For packets outbound from the private network, NAPT would translate the source IP address, source transport identifier and related fields such as IP, TCP, UDP and ICMP header checksums. Transport identifier can be one of TCP/UDP port or ICMP query ID. For inbound packets, the destination IP address, destination transport identifier and the IP and transport header checksums are translated.

2

I have studied from various sources that router is a layer 3 device

There is a difference between the functionality of a router as-invisaged by those who write the standards, and the functionality of a commercial device that says "router" on the box.

The former is a layer 3 device, the latter will often have functionality at other layers too. Exactly what functionality will depend on the target market. A device designed as a gateway for a home or small buisness will have very different specifications and funcationality from a device designed to act as the core of a large network.

Network address translation (NAT) is a feature of Router which is required for routing traffic.

No.

The way the internet was originally invisaged, every node would have a public address. If you had your own network then you would be allocated a block for it (initially centrally, later by your ISP) and traffic for your network would be routed to your gateway router.

NAPT (the most common form of NAT) is a feature that allows a network to be hidden behind a single address. Nearly all home and small buisness "routers" will support it, but that doesn't mean it is part of the core functionality of a router.

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.