镜像地址

阿里镜像

https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11No9VDh
下载地址: https://mirrors.aliyun.com/centos/
图片.png

centos中文站

https://www.centoschina.cn/downloads

设置静态ip

设置虚拟机采用NAT模式
图片.png

查看虚拟机分配的ip地址和子网掩码, /Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf(VMware Fusion 文件名中间有空格符号)

  1. $cat /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf
  2. allow unknown-clients;
  3. default-lease-time 1800; # default is 30 minutes
  4. max-lease-time 7200; # default is 2 hours
  5. subnet 192.168.145.0 netmask 255.255.255.0 {
  6. range 192.168.145.128 192.168.145.254;
  7. option broadcast-address 192.168.145.255;
  8. option domain-name-servers 192.168.145.2;
  9. option domain-name localdomain;
  10. default-lease-time 1800; # default is 30 minutes
  11. max-lease-time 7200; # default is 2 hours
  12. option netbios-name-servers 192.168.145.2;
  13. option routers 192.168.145.2;
  14. }
  15. host vmnet8 {
  16. hardware ethernet 00:50:56:C0:00:08;
  17. fixed-address 192.168.145.1;
  18. option domain-name-servers 0.0.0.0;
  19. option domain-name "";
  20. option routers 0.0.0.0;
  21. }

其中 range 192.168.145.128 192.168.145.254; 这个是虚拟机允许选择的静态ip地址范围,自定义的静态ip地址必须要在这个范围内。
option routers 192.168.145.2; 是网关地址

修改centOS7中的网络配置

vi /etc/sysconfig/network-scripts/ifcfg-ens33

  • BOOTPROTO=static(ip地址设置为静态的)
  • IPADDR=上面mac中找到的ip范围中设置一个(在192.168.145.128 192.168.145.254之间)
  • NETMASK=255.255.255.0(也是从上面得到)
  • GATEWAY=设置上面mac中看到的gatway地址,即router路由地址(192.168.145.2)
  • ONBOOT=yes
  • DNS1=x.x.x.x

阿里云的公共DNS:https://www.alidns.com/

图片.png

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=4f54be13-ef5b-4252-b39c-ddb19c632b0a
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.145.130
NETMASK=255.255.255.0
GATEWAY=192.168.145.2
DNS1=223.5.5.5
DNS2=8.8.8.8

重启网络

systemctl restart network.service

[

](https://www.oschina.net/sharing-plan/apply)

参考

https://www.cnblogs.com/zhiweiXiaomu/p/14301885.html