# communication

name Description
HTTP
HTTPS

TCP/IP

A number to identify devices on the network. In IPv4, it is represented by 32 bits, and it is common to divide it into 8 bits and represent it in 4 fields for human readability. It is divided into a network part (which network it belongs to) and a host part (which computer terminal), and by looking at the first pattern, you can see how far the network part is.

Class A 0.0.0.0〜127.255.255.255 The network part has only the first 8 bits. The host can be represented using the last 24 bits.
Class B 128.0.0.0.～191.255.255.255 The network part is the first 16 bits.
Class C 192.0.0.0.～223.255.255.255 The network part is the first 24 bits.
Class D 224.0.0.0〜239.255.255.255 The network part is the first 24 bits.

With conventional classful addresses, it was necessary to provide some bits of the IP address (24 bits for class C) as the network part. As it became clear that IP addresses were exhausted as the network deepened, a method using numbers called subnet masks was adopted. The subnet mask is a numerical value that distinguishes between the network part and the host part.

## Actual operation

There are two types of IP addresses, global and local. Devices connected to www (eg routers) do not know where in the world they send or receive data, so they need to have the only IP address in the world. By doing this, you can communicate in a fixed manner from within www. However, a PC hanging below a router only needs to have a number that can be identified within the local network, which is a private address.

It can be further divided into two types of IP addresses

--Dynamic IP address --The ISP automatically assigns a global address. It changes to a different IP address for each connection and each time limit. --Static IP address --A fixed IP address. Used for homepage public servers, mail servers, etc.

Private addresses are automatically assigned by the DHCP server in the home. Since it is built into a broadband router, it does not need to be prepared by the user.

## port number

The receiving side opens the port and waits. By doing this, when the destination delivers the packet to the server (or personal computer) by relying on the IP address, it is clearly indicated to which application it should be passed. Port numbers are roughly divided into three types: well-known ports, registered ports, and dynamic ports. Even during socket communication, it is necessary to clearly indicate what port number is open and waiting.

name Description
Network switch
Hub
router

## Multicast

Communication that sends the same data from one source to multiple destinations. A class D destination IP address is used. It is used for real-time video distribution and OS image distribution to PCs. Instead of sending 100 packets to 100 destinations, one multicast packet is sent to improve efficiency.

# server

## type

type Formal name Japan name Description
DNS Domain Name System Domain name system Convert website names to IP addresses and vice versa
DHCP Dynamic Host Configuration Protocol Dynamic host configuration protocol A protocol that helps you assign IP addresses and associated IP information to computers in your network
Proxy server Relay server

## Proxy server

A server that operates on the border between the internal network and the Internet and assists in access. By connecting the personal computer to the network via a proxy server instead of directly connecting to the Internet, it is possible to prevent unauthorized access and intrusion and improve security. In addition, since the proxy server has a cache function, it is possible to temporarily save the browsing history of the Web.

A device for evenly distributing the load on the server. A device that is also necessary to distribute the load for the operation of websites that are frequently accessed.

### DNS round robin

A method that does not use a load balancer, which is one of load balancing. It can be configured by writing the setting information in advance to the setting file of the DNS server. The DSN has a function to associate the domain name (name of the Web page) with the IP address assigned to the server, and it is possible to record which server the user is using. We will use this to allocate users. However, there are some disadvantages and the flexibility is low.

## System configuration

name Description
Horizontal function distribution All PCs on the network are connected equally
Vertical function distribution There is a master-slave relationship between PCs on the network

## Occupancy rate

### Direct connection

When Server A and Server B are connected in series. In the first place, all two PCs need to be running,

\epsilon_A \times \epsilon_B


It is expressed in the form of a product.

### Parallel connection

When Server A and Server B are connected in parallel. The probability that server A will not run is $1- \ epsilon_A$, and the probability that server B will not run is $1- \ epsilon_B$. Therefore, subtracting the probability that the system will not function at all from the overall probability represents the system utilization rate, so in the case of parallel

1-(1-\epsilon_A) \times (1-\epsilon_B)


It is expressed in the form of.

## Reliability design

name Description
Fail soft Continue operation by reducing the processing capacity of performance and functions
Fallback Detach the location of the failure and reduce the capacity to drive
fail safe Move safely in the event of a failure
Fault tolerant Always keep the system running normally
Foolproof Pre-designed measures against typos and erroneous operations

## Redundant disk configuration

RAID (Redundant Arrays of Inexpensive Disks) systems are commonly used. Technology for connecting multiple hard disks to provide redundancy and protect important data from physical failures.

name Description
RAID0 (striping) Data is distributed and written to multiple disks. Redundancy like RAID5 is not planned.
RAID1(Mirroring) Two disks are connected to one disk controller, and the data written on one disk is automatically reflected on the other disk.
RAID2〜４ Since the RAID5 method is generally used, it is not used in a realistic system.
RAID5 Data and parity information are distributed and written to multiple disks. If one disk fails, it can be restored from the rest of the data and parity information.
RAID10 It is composed of RAID0 and RAID1. Further redundancy can be ensured, but the number of HDDs that must be used increases, which is costly.

RAID0 Distribute one data (for example, half each) and write it to two (or multiple) HDDs. The RAID controller automatically divides the data and writes it to each drive. Therefore, it is possible to increase the write processing speed, but be aware that if a problem occurs with one HDD, all data cannot be read.

RAID1 Write exactly the same data to two (or multiple) HDDs. In the case of data deletion, it will be deleted from the two HDDs, so it is necessary to keep a backup separately. However, in normal operation, even if one of the HDDs fails, it can be read from the other, so backup is taken in that sense.

RAID5 While dividing the data like RAID0, writing is performed while generating a code (parity) that corrects an error for data recovery. Therefore, data can be read even if one HDD fails, but if two or more HDDs are damaged, the data will be lost. Therefore, it is necessary to promptly repair one HDD when a failure occurs. RAID6 can withstand problems with two HDDs, but the usable disk space is reduced accordingly.

# File system

## Journaling file system

A system that has a function to keep a journal (update history) and prevent damage to the management area when changing the management area.

NAS Storage that can be connected to a network (Network attached strage). It's like a cloud server, so you can easily share files and browse files when you're at home.

Linux

name Description
/
/bin
/etc
/home
/dev
/proc
/sbn

## Swap area

When the memory usage exceeds the actual amount of physical memory, it is temporarily written to the unused HDD area. This is called a swap, and that area is called a swap area. When swap occurs, it leads to an increase in writing to the HDD, which causes a decrease in operating speed. It can be displayed with the free command.

\$ free
total        used        free      shared  buff/cache   available
Mem:       29987936     7728424     8926592     1425036    13332920    20442572
Swap:      10485756     7895908     2589848


Swap areas can be created and activated with the mkswap and swapon commands.

# Security

Firewall A system that detects unauthorized access and notifies the administrator.

--Packet filtering --Analyze the header to determine whether to pass (communicate) --Powerful and flexible, but difficult to set up and likely to create security holes --Application level gateway --Connect via proxy server and authenticate for each service --It is relatively easy to set up, but you cannot control it in detail.

WAF（Web Application Firewall）

Reference