IP Addressing and Subnetting
IP Addressing and Subnetting
Network Service
2
IP Addressing and Subnetting
Let’ s Talk About Addressing!
Types of Addressing:
- Layer 2 – MAC Addresses (Media Access
Control)
0134.2345.1 A MAC
2AB Address
0134.23 Vendor
45.12AB Code Serial
- Layer 3 – Logical Addresses (IPv4 or IPX)
Number
Assignment of IP Addresses:
- Static Addresses – assigned by an
Administrator
- Dynamic Addresses – DHCP
- “Hierarchical” vs. “Flat” Addressing
Schemes
Basics of An IPv4 Address
176.223.14.127
The Binary form looks like:
128 64 32 16 8 4 2 1
10110000.11011111.00001110.0
1111111
Basics of An IPv4 Address
32
Dotte bits Host
Network
d
Deci 255 255 255 255
mal
Maxim
um
1 8 24 3
11111111 11111111 16 11111111
2511111111 2
Binary 9
17
Examp
le
Decim 172 16 122 204
al
Examp 10101100 00010000 01111010 11001100
le
Binary
128
64
32
16
8
IPv4 Address Classes
8 8 8 8
bit
Network Hostbit Host bit Host bit
Class s s s s
A: Network Network Host Host
Bit 1 8 9 16 24 25 32
s: 0NNNNNNN Host 17 Host Host
Class
Range (1-127) –
A: 16,777,214 hosts
Bit1 8 9 16 24 25 32
s:10NNNNN Network 17Host Host
Class N
Range (128-191) –
B: 65,534 1hosts
8 9 16 24 25 32
Bit
17
s: 110NNNNN Network Network Host
Class
Range (192-223) – 254
C: hosts 1 8 9 16 2425 32
Bits:
17Multicast Multicast
1110MMM Multicast
Class M Group
Group Group
Range (224-
D: 239)
Host Addresses
172.16 10.1.
.2.1 10.6.2 1.1
4.2
172.16. E0 E1 10.250.
3.10 172.16 8.11
.2.1
172.16.1 10.180.30
2.12 .118
Routing Table
172.16 . 12 . Network Interface
12 172.16 E
Network Host .0.0
0
10.0.0.
0
E
1
Determining Available
Host Addresses
Network Ho
172 16 00 st
10101100 00010000 00000000 N
00000000 1
00000000 2
00000001 3
Remember 00000000
11111111
00000011 655
2N-2 (where . .
16
N is the15 11111101 34.
14 . . .
655
number13 11111111
. . .
12
of host bits)
11 11111110 35
- 2
10
9 211111111
N
-2 = 216-2 = 655
655
8 11111111 36
7 65534 34
6
5
4
3
2
1
Addressing without Subnets
• Network
172.16.0.0
Addressing with Subnets
172.16.3.0
172.16.4.0
172.16 172.16
.1.0 .2.0
• Network
172.16.0.0
Subnet Mask
Netw Ho
172 ork16 0 st0
IP
Addr
ess
Netw Ho
ork st
Defa
ult 255 255 0 0
Sub 11111111 11111111 00000000 00000000
net
Mas
k
Also written
255 as “/16” where
255 16 represents
255 the number
0 of
1s in the mask.
Network Subnet Host
8-
bit
Sub
net
Mas
k
Also written as “/24” where 24 represents the number of
1s
in the mask.
Subnet Mask with Subnets
Netw
ork 172 16 2 0 128192
224
Numb 240
Network number extended by eight
248 bits
er 252
Without a subnet mask you cannot
254 tell the host address nor
the network it resides on! 255
Subnet Mask with Subnets (cont.)
Netw Subn Ho
ork et st
172.16.2. 10101100 00010000 00000010
160 10100000
255.255.25
5.192
11111111
10101100 11111111 11111111
00000010
11000000
00010000 10000000
Netw
ork 172 16 2 128
Numb
128
er Network number
192
224 extended by
240
ten bits 248
252
254
255
128
192
224
240
248
252
254
255
Broadcast Addresses
172.16.3.0
172.16.4.0
172.16
.1.0
172.16.3.255 172.16
(Directed .2.0
broadcast)
255.255.255.255
(Local network
X
broadcast)
172.16.255.255
(All subnets
broadcast)
AWS VPC (Virtual Private Cloud)
o ………
o Subnet 255: 10.0.255.0/24 (10.0.1.0 to
Routing in VPC
(Optional)
We have an option to
use Launch VPC
Wizard to create a
VPC, how ever that is
too easy and you
might not understand
what’s happening
behind the scene.
Go to Your VPCs, you can see the default VPC
created by AWS here. Every region will have default
VPCs created.
We can also see the IP CIDR block as well
Go ahead and hit Create VPC button
Go to Your VPCs, you can see the
default VPC created by AWS
here. Every region will have
default VPCs created.
We can also see the IP CIDR block
as well
Go ahead and hit Create VPC
button
2. ap-south-1-public-subnet-1b
3. ap-south-1-private-subnet-1a
4. ap-south-1-private-subnet-1b
I have configured below
subnets,
SUBNET CIDR
ap-south-1-public-subnet-1a 172.16.11.0/24
ap-south-1-public-subnet-1b 172.16.12.0/24
ap-south-1-private-subnet-1a 172.16.21.0/24
ap-south-1-private-subnet-1b 172.16.22.0/24
We can apply a filter in the Subnets and see all the
Subnets that we created.
Step 4: Enable Auto Assign Public IP for Public Subnet
Now we have Public and Private Subnets, lets enable Auto
Assign Public IP settings on the two Public subnets.
Select the Public Subnet >> Actions >> Modify auto-assign
IP settings >> Enable auto-assign public IPv4 address.
EC2 instances on the Public subnet will be automatically
assigned with Public IP.
Step 5: Add Internet Gateway and Associate to Public Subnet
Go to Internet Gateways >> Create internet gateway
Note: You can see the default Internet Gateway here.
This will provide connectivity to internet from VPC
Destination Target