MacOS > Virtualbox > Centos 7.7 如何设置ip/obtain IP

MacOS > Virtualbox > Centos 7.7 how to set ip/obtain IP

我在 mac 下工作,目前正在将 Centos 7.7 设置为 运行 apache/mysql 配置以进行演示测试。我已将网络设置为 "Bridge Adapter",但我无法访问 CentOs 7.7(VirtualMachine)上设置的 mysql 或其他设置(如 info.php)。我进一步查看,发现我需要编辑“/etc/sysconfig/network-scripts/ifcfg-enp0s3”并更改以下详细信息:

"BOOTPROTO="   to a static address, but I am having hard time on setting the
"IPADDR="      (tried setting like 198.51.100.5 - random IP)
"PREFIX="      (probably 24 not sure)
"GATEWAY="     (set 198.51.100.1 also random)

最有可能出现问题的地方。我还不得不评论

"NETMASK="     since from what I was able to see over the net it is replaced by 'GATEWAY'.

CentoS 7.7 上有网络,但我希望从 mac 连接到 IP 上的 centos(本地)以执行测试设置,任何配置方面的帮助都会有所帮助。

此外,我已经使用 firewall-cmd --permanent --add-port= 命令添加了端口

解决:

在这种情况下,要解决我的问题:

  1. 已停止虚拟机。

  2. 打开 VirtualBox > 文件 > 主机管理器,我从那里添加了一个仅主机适配器;

  3. 更改了 CentoS 7.7 映像的设置 > 网络 > 添加了第二个仅主机模式的适配器

然后我启动了机器,我可以访问IP/info。php和其他人。