Chapter 1: Networking Fundamentals
Interview Questions
- Q1. What is the difference between a public and a private IP address?
- A public IP is globally unique and routable on the internet. A private IP (RFC 1918: 10/8, 172.16/12, 192.168/16) is used inside local networks/VPCs and is not routable on the internet; it reaches the internet through NAT.
- Q2. How many usable hosts are there in a /26 subnet? And in an AWS /26 subnet?
- 2^(32−26) = 64 addresses; 62 usable traditionally (minus network and broadcast). AWS reserves 5, so 59 usable.
- Q3. What is CIDR and why was it introduced?
- Classless Inter-Domain Routing writes a prefix length (/n) instead of fixed classes, allowing networks of any size and reducing address wastage and routing-table size.
- Q4. Why do we need IPv6?
- IPv4 has only ~4.3 billion addresses and is exhausted. IPv6 has 2^128 addresses, removes the need for NAT, and supports auto-configuration. On AWS, public IPv4 is also charged, while IPv6 is not.
- Q5. What is the difference between an Elastic IP and an auto-assigned public IP on EC2?
- The auto-assigned public IP is released when the instance stops and a new one is given on start. An Elastic IP is a static public IPv4 owned by your account until you release it and can be re-mapped between instances.
- Q6. What is NAT? Where is it used in AWS?
- NAT translates private source addresses to a public address (and back for replies). AWS uses 1:1 NAT at the Internet Gateway for public/Elastic IPs and many-to-one NAT in a NAT Gateway for private subnets.
- Q7. Which ports are used by SSH, HTTP, HTTPS, MySQL and MongoDB?
- 22, 80, 443, 3306 and 27017 respectively.