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?
Asked
Active
Viewed 8,636 times
8
-
1This has nothing to do with programming, and is off-topic. I'd suggest SuperUser. – Jonathon Reinhart Jul 22 '13 at 23:07
-
2By the way, not all routers perform NAT - only NAT routers perform NAT. – Jonathon Reinhart Jul 22 '13 at 23:08
1 Answers
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
-
1Many 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
-
3A noob question: why trusted is public and untrusted is private? – Marian Paździoch Jan 05 '16 at 10:37