8

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?

Vishnu Vivek
  • 1,819
  • 1
  • 20
  • 30

1 Answers1

16

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).

user2608557
  • 176
  • 1
  • 2
  • 1
    Many routers have built-in switches, so some people tend to confuse the two. A true router will have only two ports: trusted and untrusted (or public and private). – mti2935 Jul 22 '13 at 23:20
  • 3
    A noob question: why trusted is public and untrusted is private? – Marian Paździoch Jan 05 '16 at 10:37