I successfully:
As a cloud support engineer at AWS, I received a support ticket from Jess, a cloud admin at a Fortune 500 company. Her email stated:
Hello, Cloud Support!
We currently have one virtual private cloud (VPC) with a CIDR range of 10.0.0.0/16. In this VPC, we have two Amazon Elastic Compute Cloud (Amazon EC2) instances: instance A and instance B. Even though both are in the same subnet and have the same configurations with AWS resources, instance A cannot reach the internet, and instance B can reach the internet. I think it has something to do with the EC2 instances, but I'm not sure. I also had a question about using a public range of IP address such as 12.0.0.0/16 for a VPC that I would like to launch. Would that cause any issues? Attached is our architecture for reference.
Thanks!
Jess
Cloud Admin
Before diving into the practical aspects, I recalled my knowledge of public and private IP addresses and CIDRs. When addressing task 1, I considered the differences between public and private IP addresses. For task 2, I focused on the importance of using private IP ranges rather than public IP ranges.
The AWS architecture had already been checked, and everything was routed and attached correctly. The customer's AWS architecture seemed sound because one of their instances worked properly. Jess suspected that the instance configuration might be the issue.
When troubleshooting networking issues in AWS, I applied a method of starting from the bottom and working my way up through the layers, similar to the OSI model approach. At the very bottom of this architecture is the EC2 instance. I kept in mind the relationships between the OSI model and AWS infrastructure:
| OSI Model | AWS Infrastructure |
|---|---|
| Layer 7: Application (how the end user sees it) | Application |
| Layer 6: Presentation (translator between layers) | Web Servers, application servers |
| Layer 5: Session (session establishment, security) | EC2 instances |
| Layer 4: Transport (TCP, flow control) | Security group, NACL |
| Layer 3: Network (Packets which contain IP addresses) | Route Tables, IGW, Subnets |
| Layer 2: Data Link (Frames which contain physical MAC addresses) | Route Tables, IGW, Subnets |
| Layer 1: Physical (cables, physical transmission bits and volts) | Regions, Availability Zones |
I began by accessing the AWS Management Console. Once there, I searched for EC2 in the search bar at the top-left corner and selected EC2 from the list of services.
In the EC2 dashboard, I navigated to the "Instances" section via the left navigation menu. This took me to the current EC2 instances, where I could see two instances running:
Both were t3.micro instances and showed a "Running" state with 3/3 status checks passing.
To understand the differences between the instances, I selected the checkbox next to instance A. At the bottom of the page, I chose the Networking tab and examined its networking configurations:
I recorded these details in a text editor for future reference. Then I deselected instance A and selected instance B to examine its networking configurations:
This was my first significant finding: Instance A lacked a public IP address, while instance B had one. This difference likely explained why instance A couldn't reach the internet while instance B could, despite being in the same subnet with identical AWS resource configurations.
Using the key pair provided in the environment (labsuser.pem), I connected to instance B via SSH using its public IP address:
Once connected, I tested the internet connectivity:
The ping was successful, confirming that instance B could reach the internet as expected.
Next, I connected to instance A. Initially, I tried to use the instance's private IP but ultimately used the connection options provided in the environment:
Once connected, I ran several diagnostic commands to thoroughly assess its network configuration:
This confirmed that instance A only had a private IP address (10.0.10.236) configured on its network interface, with no public IP visible at the OS level.
Next, I checked the routing table:
The routing configuration looked correct, with a default route through the VPC gateway (10.0.10.1).
I also examined the DNS configuration:
The DNS configuration also appeared correct, using the AWS-provided DNS server (10.0.0.2).
Finally, I tested internet connectivity from instance A:
This confirmed my hypothesis - instance A could not reach the internet, despite having proper internal network configuration.
Looking at the EC2 console, I noticed that a public IP address (50.112.167.55) had actually been assigned to instance A, but it wasn't functioning properly for internet connectivity. This was puzzling because the ip addr show command didn't display this public IP on the instance.
After further investigation, I realized that in AWS, public IP addresses aren't directly visible within the instance's networking configuration. Instead, AWS performs 1:1 NAT at the hypervisor level, translating traffic between the public IP and the instance's private IP without the instance being aware of it.
This explained why the ip addr show command didn't show the public IP despite it being assigned in the EC2 console.
To solve the connectivity issue, I allocated and associated an Elastic IP to instance A:
After confirming the proper association of the Elastic IP, I tested internet connectivity again from instance A:
Success! Instance A could now reach the internet. This confirmed that the Elastic IP was working correctly, even though it wasn't visible in the instance's network configuration.
Regarding Jess's question about using a public IP range like 12.0.0.0/16 for a new VPC, I would advise against it for several important reasons:
Throughout, I learned valuable lessons about networking in AWS:
ip addr show, ip route show, and ping are invaluable for network diagnosticsThe solution to Jess's primary issue was to ensure the Elastic IP was properly associated with instance A, allowing it to communicate with the internet. For her second question, I would recommend sticking with private IP ranges (10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16) for any new VPCs to prevent routing conflicts and follow AWS best practices.
This provided practical experience in diagnosing and resolving network connectivity issues in AWS, highlighting the importance of understanding how public and private IP addressing works in cloud environments.