Temporary Configuration network (IP, gateway, DNS) + permanent configuration
Dns:vim/etc/resolv.conf
Gateway: Route add default GW 192.168.157.254 netmask255.255.255.0
Route-n
Ip:ifconfig Ens33 192.168.157.130/24
Permanent configuration: cd/etc/sysconfig/network-scripts/
Vim Ifcfg-ens33
Change bootproto= "DHCP" to static
ipaddr=192.168.157.130
netmask=255.255.255.0
gatewy=192.168.157.254
dns1=192.168.157.254
Wq Save, exit
Restart Web service: Systemctl Restart Network
Job Three: Set the host name for the machine in the cluster, use the/etc/hosts file to parse all the host names in the cluster, and the configuration of the cluster should be changed to the way of using the host name.
Enter vim/etc/hosts
On Gaoyuan this machine 192.168.157.131 gaoyuan1 Wq Save exit
Ping Gaoyuan1
On gaoyuan1 this machine 192.168.157.130 Gaoyuan Wq Save exit
Ping Gaoyuan
Modify host Name: Host Gaoyuan
Hostname
Hostnamectl Set-hostname Gaoyuan
Exit, log in, please.
Auxiliary machine Gaoyuan1 is the same
Job Four: SSH login, scp upload, download, ssh key login, modify the SSH server port to 8888 and then sign in and SCP test
SSH Login: Two must be on one port, current port: 22
Currently in Gaoyuan
SSH 192.168.157.131 login, connected to the Gaoyuan1
and vice versa.
SCP Download: SCP 192.168.157.131:/root/123.txt.
SCP 192.168.157.130:/root/122.txt/tmp
Uploaded: Scp/etc/hosts 192.168.157.131:/tmp
Scp/etc/hosts 192.168.157.130:/tmp
SSH key: currently in Gaoyuan
Ssh-keygen
ls/root/.ssh/
Ssh-copy-id-i Gaoyuan1
Instead of sending it to the same place, change it to the name.
Modify the Ssh,server port to 8888:
Vim/etc/ssh/sshd_config
Find Port 22 modified to: 8888 Wq Save exit
Restart effective Systemctl Restart sshd
Login test: SSH 192.168.157.130-p 8888
SSH 192.168.157.131-p 8888
Ssh-copy-id-i gaoyuan1-p 8888
Ssh-copy-id-i gaoyuan-p 8888
Job Five: Organize the bash command type to verify the priority of finding a command
Command interpreter: BASH
The commands are divided into:
Alias---------------aliases
Compound Commands-----If for while
function-----------Functions
Build_in------------built-in commands
Hash
$PATH---------------environment variable path
Error:command not found-----to find it, error
Get a command to search from top to bottom according to the above command, first find the alias command of the same name, and then find the compound command until the command is found to execute
Alias: Alias command is to simplify the integration of the output to a long parameter command, alias definition method aliases la= ' Ls-al ' Alias Unalias la
Internal command: Bash comes with a simple command function,
External command: is a small program exists in/bin//sbin//usr/bin and other places
Cd/etc
Cd/root
Alias money= ' Money-i '
Function age () {
Hostneamctl Set-hostname Hello
Hostname
}
Job SIX: Wildcard experiment
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
A wildcard is a command that adds ""
"Command in exchange for the execution of the order.
# annotation, #后面的语句一律不执行
$ () takes the execution result of the command, but it compensates for the "nesting flaw
[] Take only one value inside the brackets
LS [abcd].txt
A.txt
! Take the non. An effect of the opposite;
Touch {A-d}.txt
Touch {1-3}.txt
LS [!a-d].txt
LS [^a-d].txt
% take Rest division operation take remainder
& Symbols
&& logic and, see false then False
| Pipeline
|| Logical OR, see true if True
() represents the execution of a child process
\ escape Character
A = 1
echo "$a" output 1;
echo "\ $a" output $a;
{} denotes the scope of the curly brace
; Split, Split command
pwd;age;test;12345
: Execution results are always true
Linux---Network Foundation configuration and Shell wildcard characters