为什么我可以使用 VirtualBox 在主机和客户机之间来回 ping,但我无法从主机访问安装在客户机上的 Web 服务器。我使用的是仅主机网络。
Host Ubuntu 10.10
vboxnet0 - 192.168.56.1
ping to self, works
ping to guest, works
access to web server in guest, FAILS
Guest Fedora 13
eth1 - 192.168.56.101
ping to self, works
ping to host, works
access to web server in host, works
答案1
检查防火墙设置以及客户机上的 httpd 配置中可能的访问限制。
答案2
您是否偶然在浏览器中配置了网络代理?
我也想尝试一下 - 虚拟服务器可以自行访问本地 Web 服务器吗?是否有 Linux 防火墙阻止非本地主机访问端口 80?
答案3
我发现解决这个问题的方法是确保 Windows VirtualHost-Only 适配器设置为 ip 范围的 .1 地址,因此我的虚拟盒主机适配器是 192.168.58.20,但 Windows 适配器的 ip 是 192.168.58.1
答案4
我检查了客户机上的防火墙守护程序,发现它正在运行,于是我停止了它,现在我可以访问主机上已安装的 EBS (Oracle Enterprise Business Suite)。见下文:
[root@ebs]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-08-04 23:56:01 EDT; 20h ago
Docs: man:firewalld(1)
Main PID: 929 (firewalld)
Tasks: 2
CGroup: /system.slice/firewalld.service
└─929 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
Aug 04 23:56:00 ebs.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Aug 04 23:56:01 ebs.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Aug 04 23:56:02 ebs.localdomain firewalld[929]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option...it now.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ebs]# systemctl stop firewalld
[root@ebs]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2020-08-05 20:14:31 EDT; 6s ago
Docs: man:firewalld(1)
Process: 929 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 929 (code=exited, status=0/SUCCESS)
Aug 04 23:56:00 ebs.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Aug 04 23:56:01 ebs.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Aug 04 23:56:02 ebs.localdomain firewalld[929]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option...it now.
Aug 05 20:14:30 ebs.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Aug 05 20:14:31 ebs.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.