Linux--网络配置
通过网络名访问虚拟机:
centos:
vi /etc/hosts 文件添加:ip地址 域名
example:192.168.1.128 qf.com
配置网络服务:
修改host文件:vi /etc/hosts
先停止网络服务:service NetWork Manager stop
重新启动:/etc/init.d/network restart
限制开启启动:chkconfig NetWorkManager off
vi /etc/resolv.conf 文件添加: nameserver 网关ip
重启网卡:service network restart (备注:centos6 和 centos7命令不同)
关闭防火墙并设置开机不启动:
查看当前状态:systemctl status firewalld.service
关闭:systemctl stop firewalld
开启:systemctl start firewalld
开机自动关闭:systemctl disable firewalld
开机自动启动:systemctl enable firewalld