Sunday, July 28, 2019

Networks and Subnetting

Networks:
switch : layer 2 device - MAC to MAC communication(inside single network)- in aws, l2 devices are internal, so we can't see them.
router: layer 3 device - ip to ip communication(between different networks)-using Router - in AWS, when creating VPC,  Internet Gateway is created and it is a l3 device.

OSI Layer:(Andhra Pradesh State Tamil Nadu DIstrict Police: shotcut to remember)
Application - L7
Presentation- L6
Session -L5
Transport -L4
Network - L3 - Devices in different networks.
Datalink - L2 - MAC Traffic falls under datalink layer
Physical - L1


if 2 devices are in same network, it uses mac to mac communication, not with IPAddress.

So, they will fall under datalink layer.

192.168.1.10
192.168.1.11
255.255.255.0 : subnet

if different networks., ip to ip communication happens and it requires a router.
192.168.1.10
255.255.255.0

192.168.10.10 : ip address
255.255.255.0 : subnet

in aws, the devices connect to outside world using Internet Gateway.
see aws vpc architecture(google) for overview.

IP Addressing:
---------------
tracert www.google.com
will show the route to google server.

IPv4 and v6.
v4-32 bit address.Created by DoD first.
v6-128 bit..as higher range, no private ip, all are public in it.
1.0.0.0 to 255.255.255.255

IP Address classes(google image).
AtoE classes, only A,B,C are usable by us and D,E are reserved.

And there is one more range: 127.x.x.x --loop back addresses.
class A:1.0.0.1 to 126.255.255.254
class B:128.1.0.1 to 191.255.255.254
class C:192.0.1.1 to 223.255.254.254

All the websites will come under these classes only(A,B,C)

if all the devices in world, given these ip addresses, these list won't be sufficient.
So, for an office, internally they use some set of IP Addresses(say 1000 devices) called as Private IP(or non-routable) Addresses(some range in the A,B,C classes-192 by small and home and 10 series by many orgs)

These private IP range won't be used by any website/public address.
THe private IP range is subset of classA,B,C.

Class Private IP Address Range Subnet Mask
A 10.0.0.0 to 10.255.255.255 255.0.0.0
B 172.16.0.0 to 172.31.255.255 255.240.0.0
C 192.168.0.0 to 192.168.255.255 255.255.0.0
url: https://www.sqa.org.uk/e-learning/WebTech01CD/page_12.htm

The main router connected to the office, will contain a public IP.which do NATing from its public ip to all the devices with private ip in the network.

Dividing a network into smaller bits is called as subnetting.
the number of ipaddresses in a network will be defined by subnet mask.

10.0.0.0
subnet mask: 255.0.0.0
Here, first 255 means, value 10 is fixed.And 0 means, 0 - 255.
So, 10.0-255.0-255.0-255, total: 16 million approx.
10.1.0.0
255.255.0.0 : 10.1.0-255.0-255

255 because, it is 8 bits(2^8:256 values: 0-255)

10.0.0.0/8 -- 255.0.0.0 --means first 8 bits are fixed
10.0.0.0/16 -- 255.255.0.0 -- means first 16 bits are fixed
you can keep /9,etc also not only of 8 multiples, it uses bits of other octets.
/9 -- 255.128.0.0

000-1
001-2
010-4
011-8
100-16
101-32
110-64
111-128

subnet-calculator.com

More Info:







No comments:

Post a Comment