Router vs Switch (Network Address Translation)

Vishnu Vivek picture Vishnu Vivek · Jul 23, 2013 · Viewed 7.2k times · Source

I understand that a router uses NAT to translate the public IP we get from the ISP to say 300 local IPs. Does a switch perform the same function? If not, how's it different?

Answer

user2608557 picture user2608557 · Jul 23, 2013

No, a switch cannot perform NAT and translate public(s) IP addresses into private addresses.

A switch is a network device that filters and forwards packets between LAN segments. Switches operate at the data link layer (layer 2). So, they are not aware of IP addresses which are network layer (layer 3). A switch keeps a record of the MAC addresses of all the devices connected to it. With this information, a switch can identify which system is sitting on which port. So when a frame is received, it knows exactly which port to send it to, without significantly increasing network response times.

Routers are network devices used to interconnect two different networks (with different IP addressing schemes).