I. Network management
- Temporarily Modify network configuration
- Modify IP Address
- Ifconfig NIC name IP address
- Modify DNS
- vim/etc/resolv.conf: Modify nameserver DNS Address
- Configure the Gateway
- Route Add (DEL) default GW gateway address netmask Subnet Mask: temporary set (delete) gateway address
- Route-n Viewing settings
- Resolving DNS Locally
- /etc/hosts/: Locally resolved domain name, in the format: IP address host name
- Hostname: Querying host names
- HOSTNAMECTL set-hostname hostname: Set host name
- Configuration file Modify Network configuration
- cd/etc/sysconfig/network-scripts/find the native NIC configuration file (e.g. Ens33), Vim Ifcfg-ens33
- Change the Bootproto to static
- The following parameters are added below
- Ipaddr= Local IP
- netmask= Subnet Mask
- gateway= Gateway
- Dns1=dns Address
- Note that onboot must be yes, or the system will not load this parameter
- Systemctl Reload Network Reload NIC
Two. SSH Service
- View ports
- The Netstat-an:netstat command is used to print the status information of network system in Linux, which can let you know the network situation of the whole Linux system;
- -A or--all: Displays all sockets in the connection;
- -N or--numeric: Use the IP address directly, not through the domain name server
- Network copy
- SCP local file path destination IP: Destination path: remote Copy File
- SCP Destination IP: Destination file path Local path: remote download file
- SSH key
- Ssh-keygen: Making a remote access authorization key
- /root/.ssh/: Id_rsa is the key in the current home directory
- Ssh-copy-id-i Destination IP: Pass the key to the target host Id_rsa.pub
- SSH configuration file
- /ETC/SSH/SSHD_CONFIG:SSH configuration file
Three. Shell
- What is a shell?
- command interpreter, such as bash
- Shell Script
- Command priority
- ==> Alias: Alias
- ==> Compound Commands:if while for
- ==> function: Functions
- ==> build_in: Built-in
- ==> Hash: View Hash table
- -R Empty Hash table
- Set: View defined variables and functions
- unset function Name: Delete the definition of the function
- Alias: Defining aliases
- Unalias: Deleting aliases
- ==> $PATH
- ==> Error:command not found
- Read-p ' Print content ' variable (name): Print prompt to print content, wait for input, and store input in Relpay, i.e. name = input
- read–p "string" var1 var2...varn Note a space between "string" and var1
- Echo & Variables
Four. Meta-characters
- Special characters in Bash, and special characters that can be knocked out on the keyboard, have a special meaning, emphasizing one thing: metacharacters are interpreted by the shell
- ': ': The colon is always true
Day07_ network management, SSH, Shell, and meta-characters