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文件来解析自己的集群中所有的主机名,相应的,集群的配置应该改成使用主机名的方式
修改主机名:
cat /etc/hostname
python_web1
修改host文件:
192.168.2.3 python_web1
[root@python_web1 ~]# ping python_web1
3.ssh登录,scp上传、下载,ssh秘钥登录,修改ssh server端的端口为8888然后进行登录和scp测
修改ssh的服务端口
[root@python_web1 ~]# cat /etc/ssh/sshd_config |grep Port
Port 52000
[root@python_web1 ~]# systemctl restart sshd.service
[root@python_web1 wen]# scp -P52000 yan.txt root@192.168.2.3:/root
[root@python_web1 wen]# scp -P52000 root@192.168.2.2:/root/yan.txt ./
[root@python_web1 ~]# ssh-keygen
[root@python_web1 ~]# ssh-copy-id -i ./.ssh/id_rsa.pub 192.168.2.2 -p 52000
[root@python_web1 ~]# ssh -p 52000 192.168.2.3
命令分为:
==> alias(别名)
==> Compound Commands()
==> function
==> build_in
==> hash
==> $PATH
==> error: command not found