JuniorNetworking

What is the difference between a public and a private IP address, and what does NAT do?

What they are really testing: Whether you understand why private ranges exist and how NAT lets private hosts reach the internet. This underpins every VPC design.

A real interview question

What is the difference between a public and a private IP address, and what does NAT do?

What most people say

drag me

Private IPs are internal and public IPs are external; NAT connects them.

Directionally right but vague. It misses that private ranges are non-routable and reusable, and it does not explain that outbound NAT keeps hosts unreachable from outside, which is the security point.

The follow-ups they ask next

  • Why can a private instance download updates but not receive inbound connections through a NAT gateway?

    NAT only has a return mapping for connections the instance initiated. Unsolicited inbound has no mapping, so it is dropped, which is exactly the security benefit.

  • How does IPv6 change the NAT story?

    IPv6 has enough addresses that every host can have a public one, so NAT is not needed for address scarcity; you rely on firewalls/security groups for the isolation NAT used to provide as a side effect.

What the interviewer is listening for

  • Names the RFC 1918 ranges
  • Knows private = non-routable/reusable
  • Explains outbound NAT keeps hosts unreachable inbound

What sinks the answer

  • Cannot name a private range
  • Thinks private IPs route on the internet
  • No grasp of NAT direction

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

Private IPs are [the RFC 1918 ranges, non-routable and reusable inside any network]; public IPs are [globally unique and internet-routable]. NAT [rewrites private source IPs to a public one for outbound]. A NAT gateway gives [outbound access without inbound reachability], so [inbound needs an explicit public IP or load balancer].

Keep going with networking

All 336 cloud engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free