AWS Networking Fundamentals: IP Address, CIDR, Switch, Router, NAT and Internet Gateway

  • Post author:
  • Post category:aws
  • Post comments:0 Comments

AWS Networking Fundamentals: IP Address, CIDR, Switch, Router, NAT and Internet Gateway

When you launch an EC2 instance in AWS, you will notice that AWS often starts with a default VPC, a default subnet, and security-group configuration. These defaults make it easy to launch an instance, but before working seriously with AWS networking, it is important to understand what is actually happening underneath the network. Your notes specifically recommend understanding networking fundamentals before proceeding with AWS networking because relying only on default network configurations may not be suitable for production environments.

In this article, we will start from the basics and gradually understand:

  • What is a network?
  • What is an IP address?
  • IPv4 and IPv6
  • Private IP addresses
  • CIDR
  • Switches
  • Routers
  • Routing tables
  • NAT
  • Router mesh
  • Load balancing
  • Internet Gateway
  • How a packet travels from a private host to the internet

The goal is simple:

Understand networking so that AWS networking becomes much easier to understand.


1. What Is a Network?

Let’s start with a very simple question:

What is a network?

A network is a group of hosts or computers that can communicate with each other.

For example:

        Computer 1
             |
             |
        ┌──Switch──┐
        |          |
   Computer 2   Computer 3

These computers can communicate with each other through the network.

But what happens when we have two different networks?

Network 1                 Network 2

Computer                  Computer
   |                         |
 Switch                    Switch
   |                         |
 Router  ───────────────  Router

A router is used to connect different networks.

Your notes introduce exactly this idea: hosts within a network can communicate, while different networks communicate through routers. The diagram on page 2 shows hosts connected through a switch and multiple routers connecting networks.


2. What Is an IP Address?

Every device that participates in a network needs an address so that other devices know where to send data.

That address is called an IP address.

Think about your home address.

If someone wants to send you a package, they need your address.

Networking works in a similar way:

Person → Home Address
Computer → IP Address

For example:

192.168.1.1

This is an example of an IPv4 address.

Your notes describe an IP address as the address of a device on a network and then use IPv4 as the example.


3. How Does a Packet Reach Another Network?

Imagine we have:

Network 1

and:

Network 2

A computer in Network 1 wants to send data to a computer in Network 2.

The packet cannot simply magically know where Network 2 is.

Routers need information about where to send the packet next.

This information is stored in a routing table.

A simplified routing table looks like:

Destination Next Hop
192.168.1.0 Router 2
192.168.1.0 Router 3
Direct network Directly connected

Your page 3 diagram illustrates this concept using Destination and Next Hop entries in routing tables.

The important idea is:

A router checks its routing table to decide where the packet should go next.


4. Understanding IPv4

Let’s take this IPv4 address:

192.168.1.1

IPv4 uses 32 bits.

It is divided into four sections called octets:

192 . 168 . 1 . 1

Each section contains:

8 bits

So:

8 + 8 + 8 + 8 = 32 bits

Each octet can contain a value from:

0 to 255

because:

2⁸ = 256

possible values exist, from 0 through 255.

Your notes illustrate 192.168.1.1 in binary as four 8-bit sections.


5. How Many IPv4 Addresses Exist?

Because IPv4 has 32 bits:

2³²

possible combinations exist.

That gives:

4,294,967,296

or approximately:

4.3 billion

IPv4 addresses.

Your notes use this calculation and explain that the number of internet-connected devices eventually exceeded the available IPv4 address space.

This leads us to IPv6.


6. What Is IPv6?

IPv6 uses:

128 bits

instead of IPv4’s 32 bits.

Therefore, the number of possible IPv6 addresses is:

2¹²⁸

which is an enormous address space.

Your notes give approximately:

3.4 × 10²⁶

addresses and also note that AWS supports IPv6.

So conceptually:

IPv4
32 bits
↓
~4.3 billion addresses

IPv6
128 bits
↓
2¹²⁸ addresses

7. If IPv4 Ran Out, How Does the Internet Still Work?

This is an interesting question.

If IPv4 has only around 4.3 billion addresses, how can billions of devices continue communicating?

One important concept is:

Private IP addresses

Your notes introduce private IP addresses as the reason that many devices can use IPv4 addresses internally without requiring a unique public IPv4 address for every device.


8. Private IPv4 Address Ranges

There are three major private IPv4 ranges:

Private Range CIDR
10.0.0.0 /8
172.16.0.0 /12
192.168.0.0 /16

Your notes explain these three ranges and demonstrate how the /8, /12, and /16 prefixes determine how many bits are fixed.

For example:

10.0.0.0/8

means the first 8 bits are fixed.

Similarly:

192.168.0.0/16

means the first 16 bits are fixed.


9. Why Are Private IP Addresses Called Private?

There are two important reasons highlighted in your notes.

Reason 1: Public Internet routers don’t forward them

Private IP addresses aren’t directly routable across the public internet.

Reason 2: They can be reused

Two different networks can use the same private IP range.

For example:

Home A
192.168.1.0

and:

Home B
192.168.1.0

There is no problem because these are separate private networks.

Your page 6 diagram demonstrates two different homes using the same private IP range.

This is one of the reasons private IP addressing is so useful.


10. Then How Does a Private IP Access the Internet?

Now we have a problem.

Suppose your computer has:

Private IP:
10.0.1.10

It wants to communicate with:

8.8.8.8:443

But the public internet cannot directly route a packet using:

10.0.1.10

So something needs to translate the private address into a public address.

This is where NAT comes in.


11. What Is NAT?

NAT stands for:

Network Address Translation

Your notes describe NAT as software running on a router that modifies the IP address of packets.

For example:

Private IP
10.0.1.10
       |
       ↓
     NAT
       |
       ↓
Public IP
52.10.20.30
       |
       ↓
   Internet

The packet initially looks conceptually like:

Source:
10.0.1.10:54321

Destination:
8.8.8.8:443

The NAT device changes the source address before sending it to the internet.

It can become conceptually:

Source:
52.10.20.30:<translated-port>

Destination:
8.8.8.8:443

The diagram on page 7 illustrates this private-to-public translation.


12. How Does the Response Come Back?

Now suppose Google sends a response.

The response needs to reach the original computer:

10.0.1.10

But Google doesn’t directly know that private IP.

The NAT device maintains a translation table.

Conceptually:

Private Connection
10.0.1.10:54321
        ↕
Public Connection
52.10.20.30:<translated-port>

When the response comes back, NAT checks its translation information and forwards the response to the original private host.

Your page 8 diagram specifically illustrates the NAT device looking up its translation table and updating the destination IP and port.


13. Now Let’s Connect Everything

At this point, we have several networking concepts:

Network
   ↓
Private IP
   ↓
Switch
   ↓
Router
   ↓
Routing Table
   ↓
NAT
   ↓
Internet Gateway

Your notes explicitly bring these concepts together before building the complete flow.

Now let’s build the network step by step.


14. Designing a Network with CIDR

Suppose we need a network that can contain around:

500 devices

One option would be:

192.168.0.0/16

How many addresses does /16 provide?

IPv4 contains 32 bits.

So:

32 - 16 = 16

host bits remain.

Therefore:

2¹⁶ = 65,536

addresses.

Your notes use exactly this example and then point out that 65,536 addresses are much more than the requirement of 500 devices.


15. Choosing a Smaller CIDR

Instead, the notes use:

192.168.0.0/23

Now:

32 - 23 = 9

host bits remain.

Therefore:

2⁹ = 512

addresses.

So:

192.168.0.0/23

provides approximately 512 addresses, which is much closer to the requirement of 500 devices.

Your notes calculate this on pages 9–10.


16. What Does /23 Actually Mean?

CIDR notation looks like:

192.168.0.0/23

The /23 means:

The first 23 bits are the network portion.

The remaining:

32 - 23 = 9

bits are available for hosts.

So:

Network bits = 23
Host bits = 9

And:

2⁹ = 512

possible addresses.

The notes then use addresses such as:

192.168.0.1
192.168.0.2
192.168.0.3

for hosts within the network.


17. Hosts and the Switch

Now we have several hosts:

192.168.0.1
192.168.0.2
192.168.0.3

They need to communicate.

We connect them using a switch.

192.168.0.1 ──┐
              │
192.168.0.2 ──┼── Switch
              │
192.168.0.3 ──┘

But here comes an important point:

A switch works with MAC addresses at the local-network forwarding level, not by using IP addresses to make the final forwarding decision.

Your notes explicitly highlight this point on page 12.


18. IP Address vs MAC Address

This is a common source of confusion.

An IP address identifies a device at the network layer.

A MAC address identifies a network interface at the data-link layer.

For example:

Source IP:
192.168.0.1

Destination IP:
192.168.0.3

The packet can also contain:

Source MAC:
00:11:22:AA:BB:CC

Destination MAC:
AA:BB:CC:11:11:11

The example in your notes shows exactly this packet structure.


19. How Does a Host Decide Where to Send the Packet?

Suppose:

Host A:
192.168.0.1

wants to communicate with:

Host B:
192.168.0.3

The sender first needs to determine:

Is 192.168.0.3 inside my network or outside my network?

If it is inside the same network, the packet can be delivered through the local network using the switch.

Conceptually:

Host A
192.168.0.1
   |
   ↓
 Switch
   |
   ↓
Host B
192.168.0.3

The diagram on page 12 demonstrates this local-network flow.


20. What If the Destination Is Outside the Network?

Now consider:

Source:
192.168.0.1

and:

Destination:
8.8.8.8

8.8.8.8 isn’t inside our private network.

So the packet needs to leave the local network.

The host sends the packet toward a router.

Conceptually:

Host
192.168.0.1
   |
   ↓
 Switch
   |
   ↓
 Router
   |
   ↓
 Internet

The notes use this example on page 14, where the destination IP is 8.8.8.8.


21. Why Do We Need Multiple Routers?

You might ask:

Why not use just one router?

For a small network, one router may be enough.

But large networks can require multiple routers.

Your notes introduce a router mesh:

             Router A
            /        \
           /          \
      Router D ------ Router B
           \          /
            \        /
             Router C

Each router can have routing information that tells it where the next hop should be.

The diagram on page 13 illustrates the router mesh and routing tables.


22. Router Mesh and Fault Tolerance

One reason for having multiple routers is fault tolerance.

Imagine:

Router A
   |
Router B

If Router A fails, the network path may be interrupted.

But with multiple paths:

       Router A
      /        \
Router D      Router B
      \        /
       Router C

traffic can potentially use another available path.

Your notes specifically describe fault tolerance as one reason for a router mesh: if one router fails, packet flow can continue through another path.


23. Router Mesh and Load Balancing

Another reason mentioned in the notes is load balancing.

Suppose Router D has a large amount of traffic that needs to reach Router B.

Instead of sending everything through a single path, traffic can be distributed across available paths.

The example in the notes illustrates:

50% → Router A
50% → Router B

This can help distribute traffic across multiple paths.


24. Router Mesh and Long-Distance Communication

Another reason is handling destinations that are far away.

A packet may need to travel through multiple routers before reaching its destination.

Conceptually:

Network A
   ↓
Router 1
   ↓
Router 2
   ↓
Router 3
   ↓
Router 4
   ↓
Network B

Your notes explain that a destination in a distant network may require multiple routers because a single router may not be sufficient to reach the destination.


25. NAT With a Router Mesh

Now let’s combine our concepts.

We have:

Private Network
192.168.0.0/23

Hosts:

192.168.0.1
192.168.0.2
192.168.0.3

Then:

Switch
   ↓
Router Mesh
   ↓
NAT
   ↓
Internet Gateway
   ↓
Internet

Your notes describe a scenario where the router mesh exists between the private network and NAT. The NAT replaces the sender’s private IP with a public IP before the packet goes toward the internet.


26. Another Network Design: No Router Mesh

The notes also describe another possible design.

For a:

  • Small setup
  • Lower traffic
  • Shorter physical distance

you may have:

Hosts
  |
Switch
  |
NAT Router
  |
Internet

instead of:

Hosts
  |
Switch
  |
Router Mesh
  |
NAT
  |
Internet

This second scenario is shown on page 17.

The important lesson is that network architecture depends on the requirements.


27. Complete Packet Flow

Now let’s follow one packet from beginning to end.

Suppose:

Source:
192.168.0.1

wants to access:

8.8.8.8

Step 1 — Host Creates Packet

Source IP:
192.168.0.1

Destination IP:
8.8.8.8

The host determines that 8.8.8.8 is outside its local network.


Step 2 — Packet Goes to the Switch

The local network uses the switch to forward the frame toward the appropriate next device.

The notes illustrate source and destination MAC addresses during this process.


Step 3 — Packet Reaches the Router/NAT

The NAT device receives the packet.

It sees:

Private Source:
192.168.0.1

and translates it to a public address.

For example:

Public IP:
203.0.113.5

The source notes show this type of private-to-public mapping in the final network diagrams.


Step 4 — Internet Gateway

The packet can now leave the private network toward the internet through the Internet Gateway.

Your notes identify the Internet Gateway as the next component in the overall network flow.


Step 5 — Internet

The packet travels through the internet toward:

8.8.8.8

Step 6 — Response

The destination sends a response.

The NAT device receives the response and uses its translation information to determine which internal host originally initiated the connection.

Then it forwards the response back to:

192.168.0.1

This completes the communication flow described throughout the notes.


28. The Entire Architecture in One Diagram

You can visualize the complete concept like this:

                 PRIVATE NETWORK
               192.168.0.0/23
                       |
        ┌──────────────┼──────────────┐
        |              |              |
   192.168.0.1   192.168.0.2   192.168.0.3
        |              |              |
        └──────────────┼──────────────┘
                       |
                    Switch
                       |
                       ↓
                 Router Mesh
               /      |      \
          Router A  Router B  Router C
               \      |      /
                    Router D
                       |
                       ↓
                      NAT
                       |
             Private → Public IP
                       |
                       ↓
               Internet Gateway
                       |
                       ↓
                   Internet
                       |
                       ↓
                    8.8.8.8

This combines the main networking concepts presented across your notes.


29. How This Relates to AWS

Now we can connect these fundamentals back to AWS.

When you launch an EC2 instance, AWS asks you to configure networking such as:

VPC
Subnet
Security Group
IP Address

Your uploaded notes begin with an EC2 launch screen showing a default VPC, a default subnet, and security-group configuration.

The important lesson is:

Don’t treat the default configuration as something you need to understand only after deploying applications.

First understand the underlying concepts:

IP
 ↓
CIDR
 ↓
Network
 ↓
Switch
 ↓
Router
 ↓
Routing
 ↓
NAT
 ↓
Internet Gateway

Then AWS networking concepts such as:

VPC
Subnet
Route Table
NAT Gateway
Internet Gateway
Security Group

become much easier to understand.


30. Quick Revision

Let’s make everything extremely simple.

Network

A group of computers/hosts that can communicate.

Host ↔ Host

IP Address

An address used to identify a device on a network.

192.168.0.1

IPv4

Uses:

32 bits

IPv6

Uses:

128 bits

Private IP

Used inside private networks.

Examples:

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16

CIDR

Defines the network and host portions of an IP range.

Example:

192.168.0.0/23

Switch

Used to connect hosts within a local network and forwards using MAC-address information.

Router

Connects networks and uses routing information to determine the next hop.

Routing Table

Contains information about:

Destination → Next Hop

NAT

Translates private addressing to public addressing for internet communication.

Router Mesh

Multiple interconnected routers can provide:

  • Fault tolerance
  • Traffic distribution
  • Paths for long-distance communication

Internet Gateway

Provides the path between the private network architecture and the internet in the conceptual flow described in the notes.


Conclusion

AWS networking becomes much easier when you stop thinking about it as a collection of AWS services and first understand the networking fundamentals underneath.

The basic flow is:

                 NETWORK
                    ↓
               IP ADDRESS
                    ↓
                  CIDR
                    ↓
                 HOSTS
                    ↓
                 SWITCH
                    ↓
                 ROUTER
                    ↓
              ROUTING TABLE
                    ↓
                  NAT
                    ↓
             INTERNET GATEWAY
                    ↓
                INTERNET

The most important thing to remember is that every component has a specific job.

A host has an IP address.

A switch handles communication within the local network using MAC-address information.

A router connects networks and chooses the next hop.

A routing table tells the router where to send traffic.

NAT translates private addressing for communication with the public internet.

And the Internet Gateway provides the connection from the network toward the internet in the architecture discussed in these notes.

Once these fundamentals are clear, concepts such as AWS VPC, Subnets, Route Tables, NAT Gateway, Internet Gateway and EC2 networking become much easier to understand.

The diagrams on pages 2–19 of your notes are particularly useful because they gradually build the architecture—from a few hosts and a switch, through routing and NAT, to the complete network flow.

Source: Based on the uploaded AWS Networking – Part 1 notes and their accompanying networking diagrams.

Leave a Reply