Azure
Azure
Networking
Physical Network:
We use cables/medium to connect systems.
Virtual Network:
This is software defined network used to connect virtual
machines
Ip address:
A unique number used to identify a system in a network
Network interface connects system to network and gets
an ip address
IP Address
Execute ipconfig
ip address : 192.168.0.11
subnet mask : 255.255.255.0
default gateway : 192.168.0.1
IP Address = Network id + host id
Subnet mask helps in identifying network id and host id from
ip address
References
2 power table Refer Here
Binary to decimal
decimal to binary
Azure Classroomnotes 29/Jan/2023
Networking Basics
Problem Statement – Network Design
Problem 1
private ranges:
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
Size ~= 200
SM = 255.255.255.0
some possibilties
ip: 10.0.0.x
sm: 255.255.255.0
ip: 10.0.1.x
sm: 255.255.255.0
ip: 192.168.0.x
sm: 255.255.255.0
Problem 2
private ranges:
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
Size = 5,00,000
IP: 10.x.x.x
SM: 255.0.0.0
Problem 3
private ranges:
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
Size = 500
IP: 10.0.x.x
SM = 255.255.0.0
IP: 172.16.x.x
SM = 255.255.0.0
IP: 192.168.x.x
SM = 255.255.0.0
IP Addressing options
We have two options
Classful:
We have classes of networks
Classless:
We try looking at subnet mask as binary number
Azure Classroomnotes 30/Jan/2023
CIDR Notation
CIDR (Classless interdomain Routing)
The ip addressing is mentioned as x.x.x.x/n
x.x.x.x => ip
n = fixed bits
Examples
10.10.10.0/24
ip: 10.10.10.x
SM: 11111111.11111111.11111111.00000000
255.255.255.0
2^n - 2
Size: 2^(32-24) - 2 => 254
10.10.10.0/23
SM: 11111111.11111111.11111110.00000000
192.168.0.0/20
192.168.0.x to 192.168.15.x
CIDR: 172.16.0.0/12
172.16.0.0 172.31.255.255
CIDR: 10.128.0.0/22
10.128. 000000xx.xxxxxxxx
SM: 11111111.11111111.11111100.00000000
10.128.0.0 to 10.128.3.255
10.128.0.0/10
IP 10.10xxxxxx.xxxxxxxx.xxxxxxxx
SM: 11111111.11000000.00000000.00000000
10.128.0.0 to 10.191.255.255
192.168.224.0/20
IP: 192.168.1110xxxx.xxxxxxxx
SM: 11111111.11111111.11110000.00000000
192.168.224.0 to 192.168.239.255
CIDR
Expand the CIDR Range
10.224.0.0/11
fixed = 11
variable = 32-11 = 21
IP: 10.111xxxxx.xxxxxxxx.xxxxxxxx
SM: 11111111.11100000.00000000.00000000
Subnet
Subnet is part of network
As a cloud engineer we are expected to create networks and
multiple subnets
Problem-1: We need to design network with two subnets of size approximately 200 devices
private:
192.168.0.0/16
172.16.0.0/12
10.0.0.0/8
Network
2^v ~= 400
variable = 9
Fixed = 32-9 = 23
2^v ~= 400
variable = 9
fixed = 23
ip: 192.168.0.0/23
SM: 11111111.11111111.1111111x.xxxxxxxx
Subnet:
2^v ~=100
variable = 7
fixed = 25
2^v ~= 100
variable = 8
fixed = 24
ip: 192.168.0.0/23
SM: 11111111.11111111.1111111x.xxxxxxxx
Subnet:
2^v ~=50
variable = 6
fixed = 26
Exercises
Create a network with
8 subnets of size 500 each
network
192.168.0.0/20
subnets:
192.168.0.0/23
192.168.2.0/23
192.168.4.0/23
192.168.6.0/23
192.168.8.0/23
192.168.10.0/23
192.168.12.0/23
192.168.14.0/23
6 subnets of size 300 each
network: 10.10.0.0/20
subnets:
10.10.0.0/23
10.10.2.0/23
10.10.4.0/23
10.10.6.0/23
10.10.8.0/23
10.10.10.0/23
4 subnets of size 2 lakh devices each
“`
2 ^ v ~ = 2 lakh
fixed = 14
variable = 18
ip: 10.0.0.0/14
subnet SM: 11111111.11111100.00000000.000000000
network SM: 11111111.1111yy00.00000000.000000000
10.0.0.0/14
10.4.0.0/14
10.8.0.0/14
10.12.0.0/14
“`
* Create a 8 network with size 1000
2^v ~ = 1000
variable = 10
fixed = 22
Subnet SM: 11111111.11111111.11111100.00000000
yyy00
00100
01000
ip: 172.16.0.0/22
ip: 172.16.4.0/22
ip: 172.16.8.0/22
ip: 172.16.12.0/22
ip: 172.16.16.0/22
ip: 172.16.20.0/22
ip: 172.16.24.0/22
ip: 172.16.28.0/22
Router
Router is a device to forward packets from one network to
another
Router has a route table which will have rules depending on
destination address
Note: When we are writing rules to restrict network traffic we
can filter only on network id’s
10.0.1.0/24 => Any packet with network id 10.0.1 (10.0.1.x)
0.0.0.0/0 => any ip address
192.168.0.10/32 => Specific ip address
Azure Vnet
The network which we create in Azure is referred as Azure
virtual network (vnet).
The resources which we create in Azure will be part of subnet
not virtual network
Every Azure Vnet will have a default azure route table which
allows
communication between all the systems in vnet
communication to the internet
Azure VNET is connected to internet by default
Multiple VNets
Lets create the following vnet with vms
Lab Setup
Create a vnet with 3 subnets
web
app
db
Try to use a region where zones are supported
Now create a vm with the image created earlier in atleast 2
zones and have public ips for now
Backend pools
Health probes
To create images
# vm 1
mkdir /var/www/html/images
echo '<h1> Images </h1>' > /var/www/html/images/index.html
To create videos
# vm 2
mkdir /var/www/html/videos
echo '<h1> Videos </h1>' > /var/www/html/videos/index.html
url patterns
Azure DNS
We can Azure DNS to manage
public DNS
private DNS
DNS server stores records which map hostnames to ip
addresses
In your local system we can create dns mappings
Windows (C:\Windows\system32\drivers\etc\hosts)
Linux /etc/hosts
We can maintain DNS in Azure by creating DNS zone, but
we cannot purchase domains in Azure.
Traffic Manager
Create a VNET in Region A and VNET in Region B
Create a ubuntu vm and install apache in Region A
Create a ubuntu vm and install nginx in Region B
Refer Here for traffic manager pricing
Refer Here to create traffic manager profile
Azure front door can be used for http accelaration as edge
locations also come into play Refer Here
Azure Compute
Azure Classroomnotes 14/Feb/2023
Basic Terms
Service: Whatever is offered by Azure to realize some
component
Resource: Using Service what we create is a Resource.
Cloud Services Provider: Any organization who is offering
cloud service (Azure, AWS, GCP)
Pay as you go: Pay for whatever you have used and generally
the billing cycle is per month.
Account
Subscription
Resource Group
Management Group
Azure Classroomnotes 15/Feb/2023
Azure VM Cost
VM Size
Disk Size
Os costs (if any)
Availability Set
Has two options
Fault Domain
Update Domain
Proximity Placement Group
Refer Here for official docs
Refer Here
Create a Proximity Placement Group
Preparation
Click Capture
Now lets try to create a vm with the captured image
Note:
Learn JSON Refer Here
System Setup
Install Azure CLI: Refer Here
Understand json Refer Here
Refer Here for the video which contains all the necessary
software installations to be done.
Azure Classroomnotes 24/Feb/2023
Changing the vm size in Azure is a way to perform vertical scaling, This leads to restart of the
vm
Create a VM with apache
Now resize the VM size
VMSS
Lets create an image in Azure Compute Gallery
Create a VMSS with fixed scaling
Fixed count = 3
Health Probe
GET /info.php should get 200
Failed: when two consecutive health probes have gone
bad
Succed: When atleast 3 consecutive health probes have
good status.
Create a VMSS
Now access http://publicip/info.php here public ip is ip address of
load balancer
Lets create a new http health probe
Serverless
In Serverless, We write business logic as function (code).
This function will be executed when the requests are made
and we will be charged only for this duration.
Managed Serverless providers will process the request and
run the function charge you accordingly.
Azure offers serverless (FaaS) using Azure Functions
There are no standards in this technology and portability from
one provider to other is difficult.
Refer Here for official docs
Create a simple function
Lets create a sample azure function using visual studio code
Ensure Azure Functions Extension is installed
Azure CLI
Azure has three interfaces
Web interface:
Azure portal
Command Line interface
Azure CLI
Azure Powershell
Code interface
Azure SDK
Getting Started
Install azure cli tools extension to vs code
Create a file with extension .azcli
To Create VM
resource group
region
vm image:
publisher: Canonical
offer: 0001-com-ubuntu-server-jammy
sku: 22_04-lts-gen2
instance size: Standard_B1s
ports to be opened: 22, 80
Steps:
Create a resource group Refer Here for changeset
Azure Databases
Migration’s