Lec 7: Networking Flashcards

1
Q

What is a network?

A

-A network can be defined as a group of devices connected for data exchange.
-Each of the devices on the network is a node and each node has at least one unique address.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an IP Address?

A

-IP: Internet Protocol
-It is an Internet Protocol address, which is a numerical label assigned to each device connected to a network that uses the Internet Protocol for communication.
-IP address is decided by its network portion and host portion.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

IPv4: How many bytes?

A

An IPv4 (Internet Protocol version 4) address has 4 bytes (32 bits) separated by periods.
e.g., 192.168.1.10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

IPv4 address parts

A

Network portion: first R bits
Host portion: remaining H bits (32 - R)
Subnet mask: determines the values for R and H

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the network portion and host portion for this IP address?

IPv4 address “192.168.1.10” with a subnet mask of “255.255.255.0”.

A

A notation: 192.168.1.10/24
CIDR (Classless Inter-Domain Routing) notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How many possible IP addresses does this subnet have?
e.g., 130.95.141.192 with a subnet mask of 255.255.255.192

A

CIDR notation: 130.95.141.192/26
IP address number: 64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how many possible hosts does this subnet have?
130.95.141.192 with a subnet mask of 255.255.255.192

A

-CIDR notation: 130.95.141.192/26
-Host number: 62 (Network address and broadcast address cannot be assigned to hosts).
-Network address: 130.95.141.192
-Broadcast address: 130.95.141.255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a subnet mask?

A

Subnet mask is used for IP address management.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is CIDR?

A

CIDR (Classless Inter-Domain Routing)
-CIDR is a notation to represent IP addresses and their associated subnet masks.
-In CIDR notation, an IP address (e.g., 130.95.141.192/26) is followed by a slash (“/”) and a number. This number represents the bit length of the network portion.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Is B in the same subnet with A? Justify your answer.
A: 172.16.17.30/20
B: 172.16.28.15/20

A

For A:
IP address: 172.16.17.30: 10101100.00010000.00010001.00011110

Subnet mask: 255.255.240.0: 11111111.11111111.11110000.00000000

Network portion for this subnet can be done via a bitwise AND on the IP address and subnet mask
172.16.17.30: 10101100.00010000.00010001.00011110
255.255.240.0: 11111111.11111111.11110000.00000000
=
172.16.16.0: 10101100.00010000.00010000.00000000

For B:
IP address: 172.16.28.15: 10101100.00010000.00011100.00001111

Subnet mask: 255.255.240.0: 11111111.11111111.11110000.00000000

Network portion for this subnet can be done via a bitwise AND on the IP address and subnet mask
172.16.28.15: 10101100.00010000.00011100.00001111
255.255.240.0: 11111111.11111111.11110000.00000000
=
172.16.16.0: 10101100.00010000.00010000.00000000

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Suppose the public IPv4 address has a CIDR notation of 212.114.20.0/24, this specifies the subnet where the IPv4 address resides. How many IPv4 addresses does this subnet have?

A

“/24” indicates the network portion of 24 bits, leaving 8 (32-24) bits for the host portion of the IP address. Therefore, the total number of IPv4 addresses is: 2^8 = 256 addresses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If the Internet service provider divides the original /24 subnet using /27, how many small subnets will be created?

A

When dividing a /24 subnet into multiple /27 subnets, the ISP uses additional (27-24) bits to create small subnets. The number of small subnets created: 2^(27 - 24) = 8.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

For each created subnet, how many IPv4 addresses does it have? Justify your answers.

A

Within each of the small /27 subnets, (32 - 27) bits are available for the host portion. The total number of IPv4 Addresses is: 2^5 = 32.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a domain name?

A

It uses alphanumeric characters and symbols separated by periods to create a hierarchical naming structure. This structure is organized from right to left.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the parts of a domain name?

A

For www.javasoft.com
“com” is the top-level domain (TLD).
“ javasoft” is the second-level domain (SLD).
“www” is a subdomain of “ javasoft.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is DNS?

A

-Domain Name System
-Domain names are also known as mnemonic textual Internet addresses.
-DNS servers are responsible for translating mnemonic textual Internet addresses into the numeric addresses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the difference between a domain name and a URL?

A

-Domain name: a human-readable hierarchical structure, which consists of alphanumeric characters and symbols separated by periods.

-URL (Uniform Resource Locator): a complete address to locate a specific resource on a given website. It consists of:
–a network protocol,
–a domain name,
–an additional path and/or query parameters.
e.g., https://www.example.com/products/category?id=123&sort=asc
—the protocol is “https”, the domain name is “www.example.com”, the path is “/products/category”,
—the query parameters are “?id=123&sort=asc”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a port?

A

-An IP address identifies a device on the Internet.
-An IP port identifies a specific application protocol running on an Internet device.
-A port is identified by a number, the port number.
-There are some port numbers which are allocated for specific application protocols.
HTTP: 80
HTTPS: 443
SSH: 22

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is a protocol?

A

A set of rules that govern how data is transmitted over a network.

Examples:
-HTTP (Hypertext Transfer Protocol),
-TCP (Transmission Control Protocol),
-IP (Internet Protocol)

-Each protocol is designed based on a layered model.
–A real-world model : TCP/IP.
–A conceptual model : OSI (Open Systems Interconnection)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

OSI Model vs TCP/IP Original vs TCP/IP Updated

A

OSI Model:
App > Presentation> Session
Transport
Network
Data Link > Physical

TCP/IP Original
App
Transport
Internet
Link

TCP/IP Updated
App
Transport
Network
Data Link > Physical

21
Q

5-Layer TCP/IP Model: Application Layer

A

-Application Layer provides network services directly to applications. It hosts various application-specific protocols.

-Examples of protocols for different applications:
–HTTP and HTTPS for web browsing, and
–SSH (Secure Shell) for secure remote access.

22
Q

5-Layer TCP/IP Model: Transport Layer

A

-Transport Layer establishes and manages the end-to-end data transfer between applications running on different devices.

-Examples of protocols for network connection:
–TCP (Transmission Control Protocol) for reliable connections,
–UDP (User Datagram Protocol) for fast communication.

23
Q

5-Layer TCP/IP Model: Network Layer

A

-Network Layer routes packets of data to reach their destination.

-Examples of protocols for packet routing:
–IP (Internet Protocol),
–ICMP (Internet Control Message Protocol)

24
Q

5-Layer TCP/IP Model: Data Link Layer

A

-Data Link Layer provides node-to-node data transfer.

-Particularly, it uses MAC (Media Access Control) addresses to identify Network Interface Cards (NICs).

-Examples of protocols for node addressing:
–Ethernet,
–Wi-Fi

25
Q

5-Layer TCP/IP Model: Physical Layer

A

-Physical Layer deals with data transmission over a physical medium.

-Examples of medium:
–Optical fibers,
–Wireless radio waves

26
Q

Transmit Data with TCP/IP Model Diagram

A

5 App Layer Msg

4 Transport Layer TCP/UDP Segment/Datagram
-Source/Destination Port
-(Segment header)

3 Network Layer IP
-Source/Destination IP Address
-(Packet header)

2 Data Link Layer MAC
-Source/Dest MAC Address
-(Frame header)

1 Physical Layer

27
Q

What is data encapsulation?

A

From Sending computer > App > Transport > Network > Data Link > Physical

28
Q

What is de-encapsulation?

A

Opposite; from Physical to Receiving Computer

29
Q

What is ELB?

A

-Elastic Load Balancing

-ELB serves as the single point of contact for clients, distributing incoming requests across multiple target groups of multiple targets (e.g., EC2 instances and containers).

-Listenerchecks for incoming network requests from clients using pre-configured protocol and port.

30
Q

Path-based routing: Rule 1

A

If the URL is https://example.com/public/home, the listener routes the request to the PublicWebServer target group.

[ {
“Field”: “path-pattern”,
“PathPatternConfig”: {
“Values”: [“/public/*”]
}
} ]

31
Q

Path-based routing: Rule 2

A

If the URL is https://example.com/admin/settings, the listener routes the request to the AdminConsole target group.

[ {
“Field”: “path-pattern”,
“PathPatternConfig”: {
“Values”: [“/admin/*”]
}
} ]

32
Q

What are the benefits of ELB?

A

-Increases the availability and fault tolerance of web applications.
-More compute resources can be added (horizontal scaling)
-Enables health check of compute resources.
–Healthy: a compute resource is responsive and functioning as expected.

33
Q

What are horizonal scaling and vertical scaling?

A

Horizontal:
Vertical: add more resources

34
Q

Set up an ALB

A
  1. Navigate to EC2 Dashboard, click Load balancers
  2. Configure: scheme (internal facing, internal), IP address type (IPv4, Dualstack)
35
Q

Internet facing vs internal scheme

A

-Internet-facing indicates the ALB has a public IP address.
Internal means the ALB has a private IP address.

-Both schemes route the client’s requests to targets’ private IP addresses.

-Targets do NOT need public IP addresses to receive requests from the ALB.

36
Q

IPv4 vs Dualstack

A

IPv4 (Internet Protocol version 4)
Dualstack includes IPv4 and IPv6 (Internet Protocol version 6)

IPv4: it is widely used in real-world.

37
Q

What is the main reason why IPv6 is needed?

A

IPv4 uses an address format with 4 bytes (32 bits)
IPv4 allows for about 4.3 billion addresses: 2^32= 2^32
The number of internet-connected devices has been increasing all the time.

IPv6 uses an address format with 16 bytes (128 bits)
IPv4 allows for a much larger of number of addresses: 2^128

38
Q

How to address the IPv4 exhaustion problem?

A

Fundamental solution: IPv6.
Mitigation: network address translation (NAT) and private IPv4 address ranges

39
Q

What is NAT?

A

NAT: it is a way to map multiple private IPv4 addresses inside an internal network to a public IPv4 address before transmitting data to the internet.

All the devices in an internal network use a single public IPv4 address.

40
Q

What is a private IPv4 address range?

A

private IPv4 address range: it is a reserved IP address block that is not routable on the internet.

It is used for internal communication among devices within the same internal/private network.

Three address ranges:
Range | CIDR | Total Addresses
10.0.0.0 to 10.255.255.255 | 10.0.0.0/8 | 2^24 (24 = 32-8)
172.16.0.0 to 172.31.255.255 | 172.16.0.0/12 | 2^20 (20 = 32-12)
192.168.0.0 to 192.168.255.255 | 192.168.0.0/16 | 2^16 (16 = 32-16)

41
Q

How NAT works

A

LAN local area network with 4 hosts with local IP address selected from a specific IP add range (single public IPv4 add)
-All hosts have a translation table, all mapped to the same single public IP address but with different source ports
-Host C sends a packet to the internet
-Packet goes through router
-Router will maintain the translation table, it will translate the source IP address and the source port based on the source IP add and source port number
-When Host C receives a package from the internet, it will use the same translation table

42
Q

Set up an ALB

A

Basic Configuration
Load Balancer Name
Scheme: Internal
IP Address Type: IPv4

Network Configuration
Network Mapping
VPC: VPC ID
Mappings: at least two availability zones

Security Group
-select up to 5
-inbound rules
-outbound rules

Listeners and Routing
-Protocol and Port (HTTP, 80)
-Default action: Forward to <target>
-Listener tag</target>

43
Q

Virtual Private Cloud VPC

A

VPC(virtual private cloud): it is a virtual network dedicated to an AWS account.

It is logically isolated from other virtual networks in the AWS Cloud.

44
Q

VPC Internet Gateway

A

-Provides VPC with internet access
-Manage outbound traffic to the internet and inbound traffic to the AWS resources.

45
Q

VPC Subnet

A

Subnet: it is a range of IP addresses in a VPC.
-It is used to divide a VPC into multiple logical sub-networks.
-It can be either public or private sub-network.
-It must reside entirely within one Availability Zone.

46
Q

What is a listener?

A

Listener: it is a process that checks for network requests using the protocol and port we configure.

A Listener in ALB supports protocols and ports:
Protocols: HTTP, HTTPS with Ports: 1-65535

47
Q

Create target group

A

Basic Configuration
-Choose a target type:
–Instances: specify targets via EC2 instance IDs
–IP add: specify targets via IP addresses or IP address ranges

48
Q

Discuss 3 reasons why you would use Application Load Balancing to load balance a Python Django application.

A

High fault-tolerance: the ALB can distribute traffic to multiple targets in multiple groups, making the Django application healthy and improving its fault-tolerance.

High scalability: As the ALB can distribute traffic evenly, the Django application can be scaled horizontally. For example, when traffic increases, more targets can be added, and the ALB can distribute traffic to them.

Good match: Django is a web framework accepting http and https requests. The main responsibility of ALB is to optimize http and https traffic.