Linux network configuration and SSH and Shell basics
First, the Linux network configuration
The ifconfig command is used to configure and display network parameters for network interfaces in the Linux kernel. The NIC information configured with the Ifconfig command does not exist after the machine restarts after the network card restarts. In order to keep the above configuration information in the computer forever, it is necessary to modify the network card configuration file.
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/00/wKiom1jRANCR_xc8AABbTqsdXQI835.png "style=" float : none; "title=" 1-1 View information about the current host network. png "alt=" Wkiom1jrancr_xc8aabbtqsdxqi835.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8E/FD/wKioL1jRANCh2RVAAABk1X_ON6U268.png "style=" float : none; "title=" 1-2 modify the IP address. png "alt=" Wkiol1jranch2rvaaabk1x_on6u268.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8F/00/wKiom1jRANGgOmkBAAC7ERG4BCQ396.png "style=" float : none; "title=" 1-3 Gateway temporary configuration. png "alt=" Wkiom1jranggomkbaac7erg4bcq396.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8F/00/wKiom1jRANHDpMw3AAA0Ei9VWmE153.png "style=" float : none; "title=" 1-4 modify the DNS configuration. png "alt=" Wkiom1jranhdpmw3aaa0ei9vwme153.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8E/FD/wKioL1jRANLyYh7-AACp7-1lkLY219.png "style=" float : none; "title=" 1-5 permanently configures network parameters. png "alt=" Wkiol1jranlyyh7-aacp7-1lkly219.png "/>
Second, the role of the Hosts file and modify host name
Hosts:the static table lookup for host name (host-Name query-still tables)
Linux /etc/hosts is a file that configures the IP address and its corresponding hostname, where you can log the IP of the machine or other host and its corresponding host name. Different versions of Linux, this configuration file may also be different. For example CentOS7 the corresponding file is/etc/hostname.
In CentOS, there are three definitions of host names: static, transient (transient), and flexible (pretty). The "Static" hostname, also known as the kernel hostname, is the host name that the system automatically initializes from/etc/hostname at startup. A "transient" hostname is a host name that is temporarily assigned when the system is running, for example, through DHCP or MDNs server assignment. The static hostname and transient host name comply with the same character restriction rules as the Internet domain name.
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8F/00/wKiom1jRGWagTdiTAAAxHHJKA4U706.png-wh_500x0-wm_ 3-wmp_4-s_1533567263.png "style=" Float:none; "title=" 2-1-1 Modify the Hosts file of the Load Balancer server. png "alt=" Wkiom1jrgwagtditaaaxhhjka4u706.png-wh_50 "/>
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8F/00/wKiom1jRGWeQGZHiAACa1aqrPZU964.png-wh_500x0-wm_ 3-wmp_4-s_2407424703.png "style=" Float:none; "title=" 2-1 Modify the Nginx configuration file of the Load Balancer server to use the hostname to access other servers. png "alt=" Wkiom1jrgweqgzhiaaca1aqrpzu964.png-wh_50 "/>
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8E/FE/wKioL1jRGWfywqw1AAAWtiIQhlc080.png-wh_500x0-wm_ 3-wmp_4-s_2275630674.png "style=" Float:none; "title=" 2-2 modify the hostname of the web1 and modify the Hosts file. png "alt=" Wkiol1jrgwfywqw1aaawtiiqhlc080.png-wh_50 "/>
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8E/FE/wKioL1jRGWjStZVKAAARaP1Wscw708.png-wh_500x0-wm_ 3-wmp_4-s_4271096063.png "style=" Float:none; "title=" 2-3 modify the hostname of the WEB2 and the hosts file. png "alt=" Wkiol1jrgwjstzvkaaarap1wscw708.png-wh_50 "/>
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8F/00/wKiom1jRGWjhwOSrAAAcutqRrn8261.png-wh_500x0-wm_ 3-wmp_4-s_1455682081.png "style=" Float:none; "title=" 2-4 modify the hostname of the WEB3 and the Hosts file and test page. png "alt=" Wkiom1jrgwjhwosraaacutqrrn8261.png-wh_50 "/>
Third, the configuration of SSH
SSH is a secure transport protocol based on the transport layer and application layer. SSH is now more reliable, and is designed for remote logins and other network-provided security protocols.
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8F/00/wKiom1jRAsjBghBDAABK8QIHv84908.png-wh_500x0-wm_ 3-wmp_4-s_3919029153.png "style=" Float:none; "title=" 3-1ssh Log on to other hosts. png "alt=" Wkiom1jrasjbghbdaabk8qihv84908.png-wh_50 "/>
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8E/FD/wKioL1jRAsiCEblrAAAUD3MmAJU528.png-wh_500x0-wm_ 3-wmp_4-s_2306718833.png "style=" Float:none; "title=" 3-1 the first SSH login failed. png "alt=" WKIOL1JRASICEBLRAAAUD3MMAJU528.PNG-WH _50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/8E/FD/wKioL1jRAsmhZBLwAABSb-DrDqg286.png-wh_500x0-wm_ 3-wmp_4-s_3668246695.png "style=" Float:none; "title=" 3-2SCP command Copy file to other server test succeeded. png "alt=" Wkiol1jrasmhzblwaabsb-drdqg286.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8F/00/wKiom1jRAsmThohkAAAhiwvbvPw784.png-wh_500x0-wm_ 3-wmp_4-s_1268284553.png "style=" Float:none; "title=" 3-3 download the server's files to the local. png "alt=" Wkiom1jrasmthohkaaahiwvbvpw784.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8E/FD/wKioL1jRAsmBZjvmAABFgsR-bVo032.png-wh_500x0-wm_ 3-wmp_4-s_3460697072.png "style=" Float:none; "title=" 3-4ssh generate locks and keys. png "alt=" WKIOL1JRASMBZJVMAABFGSR-BVO032.PNG-WH _50 "/>
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8F/00/wKiom1jRAsqjxSN0AAA5m2CY3KQ141.png-wh_500x0-wm_ 3-wmp_4-s_1645651545.png "style=" Float:none; "title=" 3-5 sends the lock to 70.136.png "alt=" Wkiom1jrasqjxsn0aaa5m2cy3kq141.png-wh_50 "/>
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8E/FD/wKioL1jRAsrxRYnrAABFNr-ovJk053.png-wh_500x0-wm_ 3-wmp_4-s_3028433758.png "style=" Float:none; "title=" 3-6 view WEB3 sent over the lock file. png "alt=" Wkiol1jrasrxrynraabfnr-ovjk053.png-wh_50 "/>
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/8F/00/wKiom1jRAsrBP6x0AAAOB_qG1Dg499.png-wh_500x0-wm_ 3-wmp_4-s_1588044597.png "style=" Float:none; "title=" 3-7 verify that you are not required to enter a password to log on to the remote server. png "alt=" wkiom1jrasrbp6x0aaaob_ Qg1dg499.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/8E/FD/wKioL1jRAsvxi4CMAADYZblUtFY861.png-wh_500x0-wm_ 3-wmp_4-s_998371126.png "style=" Float:none; "title=" 3-8 Change the server-side SSH port to 8888 and restart the service. png "alt=" Wkiol1jrasvxi4cmaadyzblutfy861.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8F/00/wKiom1jRAsyyHG1CAADYgNY5t4g545.png-wh_500x0-wm_ 3-wmp_4-s_4179516193.png "style=" Float:none; "title=" 3-8 Change the default port for sshd on the server to 8888.png "alt=" Wkiom1jrasyyhg1caadygny5t4g545.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8F/00/wKiom1jRAsyRRT6iAAAcGI8EAEE644.png-wh_500x0-wm_ 3-wmp_4-s_1479747038.png "style=" Float:none; "title=" 3-9 login Modify the default port after the Server.png "alt=" Wkiom1jrasyrrt6iaaacgi8eaee644.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8E/FD/wKioL1jRAsyii5-tAAAqJWzQ6Xo502.png-wh_500x0-wm_ 3-wmp_4-s_2416152304.png "style=" Float:none; "title=" 3-10 Verify that the SCP command is using normal. png "alt=" Wkiol1jrasyii5-taaaqjwzq6xo502.png-wh_50 "/>
Note: SSH default port 22 can be normally logged in without SELinux, but if you change the default port number to 8888, you must turn off SELinux and clean up the iptables rules, otherwise the connection will be error!
Four, Bash command collation
Command execution Priority:
Alias "command" function built-in command "hash path cache" $PATH "command not Found
The following is a reprint of the Bash Command collation Daquan:
https://my.oschina.net/sanpeterguo/blog/207335
Command Tools
Alias Create/Display aliases
Type position command: Displays the path name or alias of the command
Unalias Deleting aliases
Whence location command: Displays the path name or alias of the command
Which location command: Displays the path name or alias of the command
Compare files
CMP Comparison of two files
Comm Comparison of two ordered files, showing the difference
Diff compares two files, showing the difference
Sdiff compare two files, show difference
Directory
CD Change Working directory
chmod changing file permissions for a file or directory
Dirs Show/clear content in the directory stack
Du displays the amount of disk space used by the file
Types of file parsing files
LS displays various types of information for the file
mkdir Creating a Directory
MV Move or rename files or directories
POPD changing the working directory to eject the name from the directory stack
PUSHD changing the working directory, pressing the name into the directory stack
PWD Displays the path name of the working directory
RM Delete a file or directory
RmDir Delete Empty Directory
Tree displays a chart of the directory Trees
Show data
Cat combo file, copy standard input to standard output
Echo writes parameters to standard output
Head selects rows from the beginning of the data
Hexdump displaying binary (non-text) files
Less pager: Display data one screen at a time
More Distribution program: Display data one screen at a time
OD displays binary (non-text) files
Print writes parameters to standard output
Tail select rows at the end of the data
Document Information
Apropos display command names based on keyboard search
Info displays files from the Info reference system
Man Displays the UNIX online reference manual page
Whatis displays a single row of summary information for the specified command
Xman GUI-based page showing the online reference manual
Edit
Sed non-interactive text editing
VI VI text Editor
View launches VI text Editor in read-only mode
Vim Vim Text Editor
File
chmod changing file permissions for a file or directory
CP copy file; copy directory
Du displays the amount of disk space used by the file
Find searches the directory tree for files, processing the results
LN creates a new link to the file
Locate searching for files
LS displays various types of information for the file
Mkfifo Creating Named Pipes
MV Move or rename files or directories
RM Delete a file or directory
Shred Safely Delete files
Stat Display I-node information
Access/modification time of the touch update file;
Umask Setting the file mode mask during file creation
Whence location command: Displays the path name or alias of the command
Whereis viewing files associated with a command
...
...
...
Linux network configuration and SSH and Shell basics