1.临时配置网络(ip,网关,dns)+永久配置
设置ip
#ifconfig en016777736 192.168.2.3
设置dns
#vim /etc/resolv.conf
nameserver 202.106.0.20
设置网关
#route add
default
gw 192.168.2.35
永久配置
#cat /etc/sysconfig/network-scripts/ifcfg-eno16777736
HWADDR="00:0C:29:EF:92:5D"
TYPE="Ethernet"
BOOTPROTO="dhcp"=====》把dhcp改成static
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
UUID="545e7024-c143-4ece-8586-cb56cef34026"
ONBOOT="yes"
# cat /etc/resolv.conf
nameserver 192.168.22.254
2.为集群内的机器设定主机名,利用/etc/hosts文件来解析自己的集群中所有的主机名,相应的,集群的配置应该改成使用主机名的方式
修改主机名:
hostname python_web1
cat /etc/hostname
python_web1
修改host文件:
[[email protected]_web1 ~]# cat /etc/hosts
192.168.2.3 python_web1
[[email protected]_web1 ~]# ping python_web1
3.ssh登录,scp上传、下载,ssh秘钥登录,修改ssh server端的端口为8888然后进行登录和scp测
修改ssh的服务端口
[[email protected]_web1 ~]# cat /etc/ssh/sshd_config |grep Port
Port 52000
[[email protected]_web1 ~]# systemctl restart sshd.service
ssh登录
[[email protected]_web1 ~]# ssh -p 52000 192.168.2.3
scp上传
[[email protected]_web1 wen]# scp -P52000 yan.txt [email protected]:/root
scp下载
[[email protected]_web1 wen]# scp -P52000 [email protected]:/root/yan.txt ./
ssh秘钥登录
[[email protected]_web1 ~]# ssh-keygen
[[email protected]_web1 ~]# ssh-copy-id -i ./.ssh/id_rsa.pub 192.168.2.2 -p 52000
[[email protected]_web1 ~]# ssh -p 52000 192.168.2.3
4.整理bash命令类型,验证寻找一个命令的优先级
命令分为:
==> alias(别名)
==> Compound Commands()
==> function
==> build_in
==> hash
==> $PATH
==> error: command not found