网络相关配置

1、临时配置网络(ip,网关,dns)+永久配置

临时配置:

永久配置:

vim /etc/sysconfig/network-scripts/ifcfg-ens33

(dhcp必须改成static,但是我不想改~)

关防火墙     systemctl stop firewarlld  

                systemctl disable firewalld

关闭SELINUX   vim /etc/sysconfig/selinux

重启网卡 service network restart

查看 ifconfig

2、为集群内的机器设定主机名,利用/etc/hosts文件来解析自己的集群中所有的主机名,相应的,集群的配置应该改成使用主机名的方式

 hostnamectl set-hostname web1

 hostnamectl set-hostname web2

 vim /etc/hosts

 vim /etc/hosts

3、ssh登陆,scp上传、下载,ssh秘钥登陆,修改ssh server端的端口为8888然后进行登陆和scp测试

ssh登陆:

 

scp上传、下载:

ssh秘钥登陆:

ssh-keygen

ssh-copy-id -i web2

修改ssh:

vim /etc/ssh/sshd_config

systemctl restart sshd

原文地址:https://www.cnblogs.com/wuyongqiang/p/6597607.html