1.確定網卡 可通過ip addr 確定網卡
2.Vi進入網絡配置文件 目錄: /etc/sysconfig/network-scripts /ifcfg文件
修改bootproto=static 和onboot=yes
再設置IP、子網掩碼、網關、首選dns、備用dns 如下圖;設置完成後保存。(剛進入可用a進入編輯模式,編輯完成後esc退出編輯, :到底部,再wq保存)
3.重啓網絡服務,網絡便配置好啦。
Systemctl restart network
4.如果需要系統互相ssh直接切換,可修改/etc/hosts文件,插入需要互通的IP和hostname格式如下。
172.168.121.13 zhangsan
172.168.121.14 lisi
172.168.121.15 wangwu
Hostname 修改命令
如:需要將hostname改成 zhangsan
Hostnamectl set-hostname zhangsan
Root密碼修改命令
Passwd