NETWORK Flashcards
Explain subnets, subnet mask and the gateway works to transfer a package between 2 destinations
The subnets is like a subnetwork of machines/nodes in a network.
When node A want to communicate with node B, it makes a calculation where it makes [MyIPAddress] && [SubnetMask] and the same with the IP address of the node B. For example:
192.168.3.2 && 255.255.255.0 = 192.168.3.0.
If the 2 operations give the same result, that means that nodes A and B are in the same subnet and do not need the Gateway to talk. On the contrary, if it is not the same, they would need the gateway node to talk to each other.
The gateway node is the node that can talk with other subnets (the router).
explain the OSI MODEL
https://docs.google.com/document/d/1aq9x_Q7cxVStOEl4eLJNAGE-TvxPX-89ZblGcWRQ-Fw/edit
Diferencia entre HTTP 1.0 y 1.1?
PERSISTENT CONNECTIONS
HTTP 1.1 also allows you to have persistent connections which means that you can have more than one request/response on the same HTTP connection.
In HTTP 1.0 you had to open a new connection for each request/response pair. And after each response the connection would be closed. This lead to some big efficiency problems because of TCP Slow Start.
HOST HEADER
HTTP 1.1 has a required Host header by spec.
HTTP 1.0 does not officially require a Host header, but it doesn’t hurt to add one, and many applications (proxies) expect to see the Host header regardless of the protocol version.
OPTIONS METHOD
Browsers send an HTTP OPTIONS request to find out the supported HTTP methods and other options supported for the target resource before sending the actual request. It is mostly used for CORS.
Example https://reqbin.com/Article/HttpOptions#:~:text=The%20HTTP%20OPTIONS%20method%20is,before%20sending%20the%20actual%20request.
HTTP 1.1 vs 2.0
- Multiplexación: HTTP/1.1 carga los recursos uno después del otro, así que si un recurso no puede cargarse, bloquea el resto de recursos que hay detrás. En cambio, HTTP/2 es capaz de utilizar una única conexión TCP para enviar varios flujos de datos a la vez, de modo que ningún recurso bloquee a otro
- Push API: To be able to use it, you need 2.0
- 2.0 is faster because of the compression mechanism.
Explain gRPC
RPC
Allows one program or process to request a service or function from another program or process on a remote system.
RPC simplifies remote communication by enabling programs to call functions on remote systems and receive the results, making distributed computing more accessible and seamless.
====================================
- Works over HTTP 2.0 (hidden implementation) (that is why it is not widely used today with browser clients)
- It is language agnostic, you can use several languages
gRPC modes:
- Unary RPC (request, response)
- Server streaming RPC
- CLient streaming RPC
- Bidirectional streaming RPC
PROs
Fast
One client library
Cancel request (H2)
CONs
Schema (sometimes slows you down)
Proxies are tricky
NO native browser support (HTTP 2)
Timeouts: you can have problems with long processing
What is a Proxy and a Reverse Proxy? Give examples
PROXY:
- The client knows the destination server, but the server doesn’t know the client. There is a node like a middleman, that communicates with the actual destination server.
For what is used:
- Web Proxy: A web proxy server sits between a client device (e.g., a computer or smartphone) and the internet. It acts as an intermediary for web requests. For example, a user in a corporate network might use a web proxy to access external websites. The web proxy can cache frequently accessed web pages, provide security by filtering content, and offer anonymity by masking the user’s IP address.
- Forward Proxy: In a forward proxy scenario, a client sends requests to a forward proxy server, which then forwards those requests to the internet on behalf of the client. This is commonly used in corporate networks to control and monitor internet access for employees.
- Anonymous Proxy: Anonymous proxy servers are designed to conceal the user’s IP address and identity. Users might use these proxies to access websites while maintaining their anonymity.
The proxy works on Layer 4 level, which is why for anonymity, a VPN is better because it works at IP level.
============================================
Reverse Proxy: - The client doesn’t know the true final destination server, but the destination server knows about the client. Again there is a node like a middleman that redirects the request to one specific server that the clients don’t know about.
Concrete example: I go to google.com but actually the load balancer connects me to the server google-123.com.
Use cases:
- Load balancer,
- CDN,
- Caching
- API Gateway
- microservices