You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Homestead 5.2私有网络突发无法访问 求排查方案

Troubleshooting Homestead 5.2 Private Network Access Failure

Hey there, let's tackle this frustrating network issue with your Homestead setup. From what you've shared, we know:

  • You've used Homestead 5.2 for 6 months, but suddenly can't reach 192.168.10.10 from your Mac
  • Virtual Box starts normally, Nginx is listening, but Mac can't ping the VM IP and doesn't see it in ifconfig
  • Changing the IP to 192.168.10.20 didn't help, port forwarding works, and new CentOS VMs with private networks also can't be accessed

First, let's confirm the existing configs you provided:

Vagrant Up Output

==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
homestead-7: Adapter 3: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 8000 (host) (adapter 1)
homestead-7: 443 (guest) => 44300 (host) (adapter 1)
homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
homestead-7: 8025 (guest) => 8025 (host) (adapter 1)
homestead-7: 6001 (guest) => 60010 (host) (adapter 1)
homestead-7: 8080 (guest) => 8080 (host) (adapter 1)
homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
homestead-7: 22 (guest) => 2222 (host) (adapter 1)

Mac ifconfig Output

vboxnet0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00
vboxnet1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:01
inet 192.168.10.1 netmask 0xffffff00 broadcast 192.168.10.255
vboxnet2: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:02

Homestead ifconfig Output

eth1 Link encap:Ethernet HWaddr 08:00:27:b2:79:ef
inet addr:192.168.10.10 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:feb2:79ef/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1226 (1.2 KB)

What Additional Info We Need

  • Your Homestead.yaml file's networks section: Let's see how you've defined the private networks (this explains why there are two hostonly adapters)
  • Result of pinging 192.168.10.1 from inside the Homestead VM: Does the VM can reach your Mac's host-only IP?
  • Mac firewall status: Is it enabled, and do you have any rules blocking vboxnet interfaces?
  • Output of netstat -rn | grep 192.168.10 on your Mac: This shows if there's a valid route to the 192.168.10.0/24 subnet
  • VirtualBox Host Network Manager config: Check if vboxnet1 has DHCP enabled, and if the IP range includes 192.168.10.10

Next Troubleshooting Steps

1. Reset VirtualBox Host-Only Network Interface

This often fixes corrupted network configs:

  • Open VirtualBox → Preferences → Network → Host Network Manager
  • Select vboxnet1, click the remove button (🗑️), then create a new host-only network
  • Set the new network's IP to 192.168.10.1, subnet mask 255.255.255.0
  • Restart Homestead with provisioning: vagrant reload --provision

2. Validate Homestead Network Configuration

  • Open your Homestead.yaml and check the networks block. It should look something like this (adjust if you have multiple networks):
    networks:
      - type: private_network
        ip: 192.168.10.10
    
  • If there are two private networks defined, confirm they're using non-overlapping subnets (e.g., 192.168.10.x and 192.168.11.x) to avoid conflicts

3. Check Firewall & Traffic Blocking

  • Temporarily disable your Mac's system firewall (System Settings → Network → Firewall) and try pinging 192.168.10.10 again
  • Inside the Homestead VM, run iptables -L to check if any inbound rules are blocking traffic from your Mac

4. Fix Missing Route Entry

  • On your Mac, run netstat -rn | grep 192.168.10. If you don't see a route pointing to vboxnet1, add it manually:
    sudo route add -net 192.168.10.0/24 -interface vboxnet1
    
  • Test the ping again after adding the route

5. Verify VirtualBox Kernel Extensions

  • Run kextstat | grep -v com.apple | grep VirtualBox on your Mac. This should show loaded VirtualBox kernel extensions.
  • If no results appear, restart your Mac and try again. If still missing, reinstall VirtualBox (you won't lose your VMs)

内容的提问来源于stack exchange,提问作者Gavin Kwok

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 09:28:43