Wednesday, June 11, 2025

VPC part2

 VPC part2

Class 42nd AWS VPC June 11th

IP Address division Task

Create a vpc with 512 IPs CIDR range 

1.Divide the VPC CIDR to 4 subnets with 128 IPs.

2.Divide the VPC CIDR to 4 subnets with 64,64,128,256 IPs

 Second task completed successfully.

Task2

Subnets

CDIR Block

Subnet range

Subnet range

 

Subnet1

10.0.2.0/23

10.0.2.0/26

10.0.2.63

 

Subnet2

 

10.0.2.64/26

10.0.2.127

 

Subnet3

 

10.0.2.128/25

10.0.2.255

 

Subnet4

 

10.0.3.0/24

10.0.3.255



VCP Component

 Create internet gateway 

After create cci-igw, attached to our vpc 

Route tables 
While created vpc automatically one route table created default ,if you are not specified any route table condition by  default all our network operation will perform with that default route table.

Create our own public route table
Step1:
Step2:
After created ,need specify some rule to the route table 
Which is we have created subnet -->through route table -->access internet gate called as public subnet 
                                          subnet --> called as private subnet

 
Step3:

Create one more Route table for private
Step1:Not give any rules to internet gate way for private route table that means no internet access for this route table

Security Group Setup

Step1:

When every you create vpc automatically one security group created, you select your security group using your VPC ID ,edit give any name 

Edit the inbound rules, delete the existing security group ,add one rule with all traffic click save rules


Practical with Server Behavior, attached VPC subnet
Step1: Created one window machine ,select existing vpc and public subnet
 

After created ,Window machine need to get the password connect >Action >security >get password 

upload downloaded .pem key file save the password 



Step2: Using public  ip 54.246.26.83 RDP connected and also able access internet .




 Private subnet instance creation steps 
Step1:  Create one instance ccit-private 


Step2: try to connect instance local RDP ,getting error 

ccitprivate subnet edit check enable auto-assign public IPV4 address click save 

Step3:
This Private Subnet Route table internet gateway not enabled to subnet ,so using private ip with in AWS environment i.e with in ec2 instance( for ccitpublic), try to connect using  private ip
with private connected , but internet unable to acces as you see below screen shot


Step4: If you want internet for the private subnet ,simple attach the internet way to the private subnet 

See now internet coming in private instance also 


--Done 

What are the IPV4 & IPV6 addresses ?
0      0    0    0 
8bit 8bit8bit8bit

What is IPV4?

An IPV4 (internet protocol version 4) address is a number label assigned to each device connected to a computer network that uses the internet protocol for communication

It is a 32 bit ip address, and we can generate a maximum 4 billion+ addresses with this IPv4.

Each block in this IP address called Octets and each Octet can hold maximum 8 bit memory. 4(Octets)*8(bits)=32. That’s why it called 32 bit ip address.

The Aws Free Tier for Ec2 will include 750 hours of public IPV4 address usage per month for the first 12 months,effective 01-Feb-24

0.0.0.0 ip 255*255*255*255 =   4,228,250,625 400cores (it is very less)

For instance as you see we have Public  54. 246.26.83,3.253.84.108  charged and private are free

What is IPV6 ?

0      0    0    0 

16bit 16bit16bit16bit

.An IPV6(inter protocol version 6) address I alpha numerical label assigned to each device connected to a computer network that uses the internet protocol for communication

It is  a128 but ip address,and we can generate a maximum 3 trillion+ addresses with this IPV6

Each block in this IP address can hold maximum 16 bits memory.8(blocks)*16(bits)=128.That’s why it is called 128 bit ip address.

The cost of the public IPV6 addresses in AWS is currenly free,due to their huge availability 

VPC (Elastic Ips,NAT Gateways,VPC Peering ,Security groups)

Elastic Ip: It fixed IP giving to you instead of floating ip.

An Elastic IP address is a static public IPv4 address associated with you AWS account in a specific region.

Unlike an auto-assigned public IP address, an Elastic IP address is preserved after you stop and start you instance in a virtual private cloud(VPC).

It is associated with you AWS account,not a specific instance.you can reassign an Elastic IP address from one instance to another

Useful for maintaining a consistent IP address for external resources to reach your instances.

An Elastic IP address is for use in a specific region only, and canot be moved to a different region

The default quota of Elastic IPs per region is 5 and it is adjustable

 AWS charges $0.005 per/hour/elastic or public IP.

this Elastic IP to create >allocate IP Address click allote.


Nat Gateway: (using nat gateway able to connect internet in private instance, with that 

A Nat gateway is a network Address translation (NAT)service.

You can user a NAT gateway so that instance in a private subnet can connect to services outside you VPC but external service cannot initiate a connection with those instances


Step5: Create one NAT GATE it is chargeable click Allocate elastic IP after allocated created NAT gateway

Step6: Your private route table  attach the nat gateway ip click save
Step7:After attached Private instance also internet will coming .




--Thanks 







No comments:

Post a Comment