The concept
IPv4 is a 32-bit address written as four decimal octets, each from 0 to 255. An address identifies a network interface in a particular network context, not a permanent person or device. A subnet mask separates network bits from host bits. 192.168.10.25/24 means the first 24 bits identify the network; the mask is 255.255.255.0. For a conventional /24 subnet, there are 256 total addresses, normally 254 host addresses. AWS reserves five addresses in each standard IPv4 subnet, leaving 251 usable addresses for a /24. The /31 and /32 cases do not follow the conventional network/broadcast host-count rule.
Two independent classifications
| Question | Option A | Option B |
|---|---|---|
| Can it be routed on the public internet? | Public address | Private address |
| How does its assignment change? | Static or reserved | Dynamically assigned |
A public IP can be static or dynamic; a private IP can also be static or dynamic. DHCP can deliver a reserved address, so DHCP does not automatically mean the number changes every time. RFC1918 private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Not every address outside these ranges is publicly routable: loopback, link-local and documentation ranges are examples.
Worked example
A laptop has 192.168.1.20/24, a router has 192.168.1.1, and an EC2 instance has private address 10.0.1.10. The laptop sends off-subnet traffic to its default gateway. Home NAT translates the source address to the router's public address. AWS maps the destination public IPv4 to the instance's private address. Neither private address alone can be reached from the public internet.
Lab: inspect and calculate
- On Linux run the commands below; identify interface, prefix and gateway.
- Split
10.20.0.0/24into two /25 networks:10.20.0.0/25and10.20.0.128/25. - Explain why
10.20.0.10and10.20.0.130now require routing between these /25 subnets.
ip -4 addr show
ip route show
ip route get 1.1.1.1Verify and troubleshoot
The default route begins with default via. No route means the kernel cannot choose a path; a route alone does not prove firewall permission or internet connectivity. Ping failure may mean ICMP is blocked, not that all traffic is broken.
Check yourself
Why can a server have a static private IP and a changing public IP? Because allocation persistence and internet routability are separate properties. An EC2 primary private IPv4 normally persists across stop/start; an automatically assigned public IPv4 can change. An Elastic IP is a separately allocated persistent public IPv4 resource.
Official reference
Ravindra’s Tip
IP को address समझो और subnet को locality। Public/private बताता है address कहाँ route होगा; static/dynamic बताता है assignment कैसे बदलता है—दोनों को mix मत करो।
Interview and revision check
Does a static address have to be public?
No. Static describes assignment persistence; public describes internet routability. A private address can remain fixed.
Ravindra Bagale · Cloud & DevOps Academy · Handbook and project downloads