Full disclosure! Linux system directory and network connection for the perfect landing of big data from 0 to 1

Introduction to Linux Directory

image-20210325143832656

Directory Description

Table of Contents Description, Description
/ The root directory of Linux
/bin binaries, the directory for storing system commands, all users can execute
/sbin super user binaries, save commands related to system environment settings, only super users can use these commands, some commands can allow ordinary users to view
/usr/bin The directory where system commands are stored, all users can execute them. These commands have nothing to do with system startup, and cannot be executed in single-user mode
/usr/sbin Store unnecessary system management commands in the root file system, super The user can execute
/root to store the relevant files of the root user and the home directory of the root user. Super user home directory
/home The folder of the current ordinary user, the default name is the current user, for example: /home/qianfeng
/cd User default home directory, for example: /home/qianfeng
/tmp temporary, store temporary files
/etc etcetera, store system configuration files
/usr unix software resource, system software shared resource directory, storing all commands, libraries, man pages, etc.
/proc Virtual file system, the data is stored in memory, and the current process information is stored
/boot System startup directory
/dev devices, store device files
/sys virtual file system, data Stored in memory, mainly to store memory-related information
/lib Store the shared library required for system program operation
/lost + found Store some system error checking results
/var variavle, Dynamic data storage location, including frequently changing files, such as mail, log files, scheduled tasks, etc.
/mnt mount, mount directory, The installation point of the temporary file system, the directory where the CD-ROM and the floppy drive are mounted by default CD
/misc Mount directory, mount NFS service
/opt The storage location of the software installed by the third party is usually placed in the /usr/local directory
/src Service Data Directory

Three network connection methods

Related concepts of the network environment

1 External network: IP is unique and cannot be repeated. Range: 0.0.0.0~255.255.255.255

2 Intranet: Reset the IP address through a router or switch device.
  The ip of different intranets can be the same. A certain host in intranet A communicates with its own router A through its own network card, and then router A communicates with its own router A through the network center
  Communicate with router B, and router B communicates with the network card of a certain machine in the intranet.

3 IP: The ip address is a unique identifier to determine a machine

4 NETMASK (subnet mask): used in conjunction with ip to determine the network segment
  192.168.1.x Range: 1-254
  255.255.255.0
  The part of the subnet mask with 1 corresponding to the ip is the network segment. The location corresponding to 0 is the location of the host in the intranet.
  Subnet mask function: used to specify which ip number segment the current machine belongs to
  Judgment method: compare the binary bit of the current ip with the binary of the subnet mask equal to the address of the network segment
  Such as: 192.168.1.2 & 255.255.255.0 = 192.168.1.0
  
5 GATEWAY: Gateway, used to communicate with machines and devices connected to the external network (router) In other words, the gateway is the IP of the router

6 DNS: domain name resolution server
  119.75.217.109 www.baidu.com

Domain name access mechanism of Internet DNS server

image-20210325164024982

Device introduction

1 router

A router is a hardware device that connects two or more networks. It acts as a gateway between networks. It is a dedicated intelligent network device that reads the address in each data packet and then decides how to transmit it. It can understand different protocols, such as the Ethernet protocol used by a local area network, and the TCP/IP protocol used by the Internet. In this way, the router can analyze the destination addresses of data packets from various types of networks, and convert the addresses of non-TCP/IP networks into TCP/IP addresses, or vice versa; The best route is sent to the designated location. So routers can connect non-TCP/IP networks to the Internet.

2 switches

Switch (Switch) means “switch” is a network device used for electrical (optical) signal forwarding. It can provide an exclusive electrical signal path for any two network nodes connected to the switch. The most common switches are Ethernet switches. Other common ones are telephone voice switches, fiber optic switches, etc.

3 Modems

A modem (English name Modem), commonly known as “cat”, is a kind of computer hardware. It can translate the digital signal of the computer into pulse signals that can be transmitted along ordinary telephone lines, and these pulse signals can be transmitted by another computer at the other end of the line. The modem receives it and translates it into a language the computer can understand.

The information in the computer is a digital signal composed of “0” and “1”, but what is transmitted on the telephone line can only be an analog electrical signal. Therefore, when two computers want to transmit data through the telephone line, a device is required to be responsible for the digital-to-analog conversion.

4 virtual machines

A virtual machine (Virtual Machine) refers to a complete computer system that is simulated by software and has complete hardware system functions and runs in a completely isolated environment. Everything that can be done on a physical computer can be done on a virtual machine. When creating a virtual machine on a computer, part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine. Each virtual machine has an independent CMOS, hard disk and operating system, and the virtual machine can be operated like a physical machine.

Virtual machine network connection method

After installing the virtual machine, two virtual network cards as shown below are installed by default–VMnet1 and VMnet8, among which VMnet1 is the host network card, which is used to connect to the network in host mode; VMnet8 is a NAT network card, which is used to connect to the network in NAT mode, and they The IP address is randomly generated.

VMware provides three working modes, namely bridged (bridge mode), NAT (network address translation mode) and host-only (host-only mode).

The settings of the host where VMware is located, see the figure below

image-20210325164145969

bridged (bridge mode)

In this mode, using the VMnet0 virtual switch, the virtual operating system is like an independent host in the local area network. Like the host computer, it can access any machine in the network. In bridge mode, you can manually configure its TCP/IP configuration information (IP, subnet mask, etc., and it must be in the same network segment as the host machine) to access the Internet through a LAN gateway or router. IP address and DNS are set to “obtain automatically”. If you want to use VMWare to create a new server in the LAN to provide Web or network services for LAN users, you should choose the bridge mode.

In the bridging mode, use the VMnet0 virtual switch. At this time, the virtual machine is equivalent to an independent computer on the network and has an independent IP address like the host.

image-20210325164241392

NAT (Network Address Translation Mode)

Using NAT mode is to allow the virtual machine to use the NAT (Network Address Translation) function to access the public network through the network where the host machine is located. In other words, using NAT mode can realize accessing the Internet in the virtual system. The TCP/IP configuration information of the virtual machine in NAT mode is provided by the DHCP server of the VMnet8 virtual network, so the IP and DNS are generally set to “automatically obtain”, so the virtual system cannot communicate with other real hosts in the local area network. communication. The biggest advantage of using the NAT mode is that it is very simple for the virtual system to access the Internet. You do not need to perform any other configurations, and you only need the host machine to be able to access the Internet. If you want to use VMWare to install a new virtual system, you can directly access the Internet without any manual configuration in the virtual system, it is recommended that you use NAT mode.

In the NAT mode, the Vmnet8 virtual switch is used. At this time, the virtual machine can “one-way access” other hosts on the network through the host, and other hosts cannot access the virtual machine.

Note: 192.168.62.1 at the host refers to the address of the host connected to the V8 switch, which must be the same address as the gateway at the virtual switch

image-20210325164310426

host-only (host mode)

The Host-Only mode is actually the NAT mode that removes the virtual NAT device, and then uses the VMware Network Adapter VMnet1 virtual network card to connect to the VMnet1 virtual switch to communicate with the virtual machine. The Host-Only mode separates the virtual machine from the external network, making the virtual machine a An independent system that only communicates with the host computer. Its network structure is shown in the figure below:

If we want to enable the virtual machine to be networked, we can share the host network card with the VMware Network Adapter VMnet1 network card, so as to achieve the purpose of virtual machine networking.

image-20210325164337269