本地虚拟机配置静态IP地址:
(1)需要查看本地虚拟机的网关ip地址:
(2)查看网路设备名称:ip addr 或者 ifconfig
然后再cd /etc/sysconfig/network-scripts/
vi或者vim打开ifcfg-网路设备名称这个文件。
(3)在文件中加入:
(3)重启网路:service network restart或者是systemctl restart network。
附:
1、centos6的网卡重启方法:service network restart
centos7的网卡重启方法:systemctl restart network
2、DNS配置文件:cat /etc/resolv.conf
设置主机和IP绑定信息:cat /etc/hosts
设置主机名:cat /etc/hostname
3、可以使用nmtui文本框方式修改IP
4、关闭防火墙并设置开机不启动
查看防火墙状态:systemctl status firewalld.service
关闭:systemctl stop firewalld
开启:systemctl start firewalld
开机自动关闭:systemctl disable firewalld
开机自动启动:systemctl enable firewalld
查看开机是否启动:chkconfig --list|grep network(RHLE6)