centos7 static network configuration

 

Important: useless virtual machines for a long time, the network does not. Try to suspend and restart.

 

 

1、vi /etc/sysconfig/network-scripts/ifcfg-eth0/ens33

#这里设置的静态ip前三段必须与vmware中编辑的网络编辑器中的NAT模式ip一致
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.111
NETMASK=255.255.255.0
GATEWAY=192.168.1.2
DNS1=8.8.8.8
DNS2=8.8.4.4

2 、 vi /etc/resolv.conf

nameserver  8.8.8.8
nameserver  8.8.4.4

Restart the network card: service network restart

 3. Permanently turn off the firewall

 查看防火墙状态:  systemctl status firewalld.service
停止防火墙工作:  systemctl stop firewalld.service
永久关闭防火墙: systemctl disable firewalld.service

4> Confirm that SELinux is off

​
vim /etc/sysconfig/selinux

   SELINUX=disabled

​

5> Modify the host name

 hostnamectl set-hostname bigdata1

6> Problems encountered

1>虚拟机突然没网络了:
   经查看:resolv.conf 中配置的nameservice没有了,恢复了原始状态。
   service network  restart -->Faild
2>重新配置完resolv.conf,由于虚拟机是挂起的状态,重启后
 ip a 有ip了,并且第三软件可以连接了。

 

Published 15 original articles · praised 7 · 10,000+ views

Guess you like

Origin blog.csdn.net/qq_40938267/article/details/89786168