MAC VMware fusion10 Centos7 network configuration

1 Virtual machine selects NAT mode

Write a picture description here

2 Get the gateway address of vmnet8 in mac machine

Open the mac terminal and enter the following command

cat /Library/Preferences/VMware Fusion/vmnet8/nat.conf

      
      
  • 1

Find the line # NAT gateway address, the ip below is the gateway address
Write a picture description here

3 Modify the ifcfg-xxx file in Centos7

Enter the directory: / etc / sysconfig / network-scripts

Find ifcfg-ens33 file
Write a picture description here

Edit this file to add or modify BOOTPROTO, IPADDR, NETMASK, DNS1, DNS2, GATEWAY, ONBOOT configuration. IPADDR is the static ip value that needs to be set; NETMASK is NETMASK for mac; DNS1 and DNS2 are also the dns configuration in mac; GATEWAY is the ip value under gateway addr found in step

mac-> System Preferences-> Network click on the advanced as shown below
Write a picture description here
Write a picture description here

The value of ifcfg-ens33 after configuration is as shown below, remember to turn off dns automatic acquisition
Write a picture description here Write a picture description here

4 reboot centos can successfully connect to the network

Write a picture description here

Follow up

I recently installed a solid state drive on macpro, copied all the files to the solid state drive, and used this solid state drive as the startup disk. When starting the virtual machine here, only one of the three virtual machines can be started. Run ifconfig to view Cannot reach the set IP address; executing systemctl status network.service reports an error: Failed to start LSB: Bring up / down networking. Found a lot of solutions on the Internet keyword "centos7 can not start the network card" Most of them are to modify the /etc/.../ifcfg-ens33 file name and modify the DEVICE value inside, or add the MAC address, etc. Useless. After searching for a long time, I finally know the cause of the problem. The reasons are as follows:
This problem is related to the management software NetworkManager that comes with the system. You can solve it by shutting down the software and restarting the network card. The specific commands are as follows
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl start network.service

The above method can ensure that centos7 can access the external network, but other machines except the host computer can not access it. The following is the way to configure the local network to be able to access, and to be able to access the external network.

1 Turn off the virtual machine
2 Click on the virtual machine settings-> click on add device
Insert picture description here
3 Click on the WIFI in the bridge mode network connection, click on the "Generate" button on the right side of the advanced options
Insert picture description here
4. Turn off the original network adapter
Insert picture description here
5 Start the virtual machine:-) This When you can access the external network normally, you can also be accessed by the internal network. Remember to set the virtual machine ip to the same LAN segment ip

Solve the problem that CentOS7 virtual machine can't go online and set CentOS7 virtual machine to use static IP to go online
CentOS7Failed to start LSB: Bring up / down solution

发布了17 篇原创文章 · 获赞 0 · 访问量 214

1 虚拟机选择NAT模式

Write a picture description here

2 获取mac机器中vmnet8的gateway地址

打开mac终端,输入如下命令

cat /Library/Preferences/VMware Fusion/vmnet8/nat.conf

  
  
  • 1

找到 # NAT gateway address这一行,下面的ip就是gateway地址
Write a picture description here

3 修改Centos7中ifcfg-xxx文件

进入目录:/etc/sysconfig/network-scripts

找到ifcfg-ens33文件
Write a picture description here

编辑此文件,增加或修改BOOTPROTO,IPADDR,NETMASK,DNS1,DNS2,GATEWAY,ONBOOT配置。其中IPADDR为需要设定的静态ip值;NETMASK为mac的NETMASK;DNS1,DNS2也是mac中的dns配置;GATEWAY就是第2步中找到的gateway addr下的ip值

mac ->系统偏好设置->网络 点击高级后 如下图
Write a picture description here
Write a picture description here

ifcfg-ens33配置后的值如下图,记住一定要关闭dns自动获取
Write a picture description here Write a picture description here

4 reboot centos 就能成功连接网络了

Write a picture description here

后续

I recently installed a solid state drive on macpro, copied all the files to the solid state drive, and used this solid state drive as the startup disk. When starting the virtual machine here, only one of the three virtual machines can be started. Run ifconfig to view Cannot reach the set IP address; executing systemctl status network.service reports an error: Failed to start LSB: Bring up / down networking. Found a lot of solutions on the Internet keyword "centos7 can not start the network card" Most of them are to modify the /etc/.../ifcfg-ens33 file name and modify the DEVICE value inside, or add the MAC address, etc. Useless. After searching for a long time, I finally know the cause of the problem. The reasons are as follows:
This problem is related to the management software NetworkManager that comes with the system. You can solve it by shutting down the software and restarting the network card. The specific commands are as follows
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl start network.service

The above method can ensure that centos7 can access the external network, but other machines except the host computer can not access it. The following is the way to configure the local network to be able to access, and to be able to access the external network.

1 Turn off the virtual machine
2 Click on the virtual machine settings-> click on add device
Insert picture description here
3 Click on the WIFI in the bridge mode network connection, click on the "Generate" button on the right side of the advanced options
Insert picture description here
4. Turn off the original network adapter
Insert picture description here
5 Start the virtual machine:-) This When you can access the external network normally, you can also be accessed by the internal network. Remember to set the virtual machine ip to the same LAN segment ip

Solve the problem that CentOS7 virtual machine can't go online and set CentOS7 virtual machine to use static IP to go online
CentOS7Failed to start LSB: Bring up / down solution

Guess you like

Origin blog.csdn.net/neheqi/article/details/105438327