Vm配置安装CentOS-7-Minimal

来源:互联网 发布:淘宝如何免费推广 编辑:程序博客网 时间:2024/06/06 00:04

1、配置防火墙

关闭防火墙systemctl stop firewalld.service关闭开机启动防火墙systemctl disable firewalld.service
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

2、配置网络

cd /etc/sysconfig/network-scripts/vi ifcfg-eno16777736
  • 1
  • 2
  • 1
  • 2
#要修改的数据BOOTPROTO=static            ### 手动设置IP#UUID=...                   ### 注释掉UUID方便后面clone虚拟机IPADDR=192.168.2.100        ### 本机IP 为 192.168.2.100NETMASK=255.255.255.0       ### 子网掩码GATEWAY=192.168.2.2         ### 默认网关 对应我们NAT设置里查看的网关IPDNS1=8.8.8.8                ### DNS 设置为Google的ONBOOT=yes                  ### 开机启动
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

重启网络

/etc/init.d/network restart
  • 1
  • 1

查看IP

14

发现我们的IP已经变为192.168.2.100了

测试网络

ping www.baidu.com # 虚拟机里测试能否上网ping 192.168.2.1   # 虚拟机到宿主机 记得关闭宿主机防火墙ping 192.168.2.100 # 宿主机到虚拟机 记得关闭虚拟机防火墙
原创粉丝点击