我在 VirtualBox Windows 10 主机中运行 gentoo linux,直到最近它才恢复运行。
基本上,无论我尝试使用哪种协议,我都会发现网络无法访问,对于任何公共网络来说,除了 DNS 查找和 ping 工作之外。Windows 防火墙已完全禁用。我如何才能使“互联网访问”等正常运行?
我的网络上有 5 个 Vlan,因此我设置了应该使用哪一个:
VBoxManage modifyvm "Gentoo" --natbindip1 10.XXX.XXX.XXX
这似乎已经起到了作用,否则什么也不会起作用。
另外我必须这样做VBoxManage modifyvm "Gentoo" --natdnshostresolver1 on
,否则 DNS 解析将不起作用,即使我设置了正确的 DNS 服务器。
如果我更改VBoxManage modifyvm "Gentoo" --natdnshostresolver1 off
,DNS查找将不起作用,但我仍然可以ping通,但wget(作为示例)仍然会Network is unreachable.
我尝试访问任何类型的网络资源时遇到的错误是:
连接到 www.mirrorservice.org|212.219.56.184|:80...失败:网络无法访问。
DNS / dhcp 似乎工作正常,因为它自行设置:
tim@vbox ~ $ cat /etc/resolv.conf
# Generated by dhcpcd from enp0s3.dhcp
# /etc/resolv.conf.head can replace this line
nameserver 10.0.2.3
# /etc/resolv.conf.tail can replace this line
tim@vbox ~ $ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.2.2 0.0.0.0 UG 2 0 0 enp0s3
10.0.2.0 0.0.0.0 255.255.255.0 U 2 0 0 enp0s3
编辑:
更奇怪的是,如果我改为绑定到使用代理服务器的其他 vlan,并在 VM 中设置代理服务器 - 那么这将完全连接到互联网,正如预期的那样。这几乎就像在绑定到某些 vlan 时,并非所有流量都通过该 vlan 传递。
我无法使用网络桥接,因为没有设置默认 VLAN,并且由于办公室政治,我不想尝试在另一个 VLAN 上进行设置;)
c:\Program Files\Oracle\VirtualBox>VBoxManage showvminfo "Gentoo" --details
Name: Gentoo
Groups: /
Guest OS: Gentoo (64-bit)
UUID: 991fc173-6689-4a7f-b1e3-2873acb119a9
Config file: C:\Users\XXX\VirtualBox VMs\Gentoo\Gentoo.vbox
Snapshot folder: C:\Users\XXX\VirtualBox VMs\Gentoo\Snapshots
Log folder: C:\Users\XXX\VirtualBox VMs\Gentoo\Logs
Hardware UUID: 991fc173-6689-4a7f-b1e3-2873acb119a9
Memory size: 4096MB
Page Fusion: off
VRAM size: 16MB
CPU exec cap: 100%
HPET: off
Chipset: piix3
Firmware: BIOS
Number of CPUs: 1
PAE: off
Long Mode: on
Triple Fault Reset: off
APIC: on
X2APIC: on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode: message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI: on
IOAPIC: on
BIOS APIC mode: APIC
Time offset: 0ms
RTC: UTC
Hardw. virt.ext: on
Nested Paging: on
Large Pages: on
VT-x VPID: on
VT-x unr. exec.: on
Paravirt. Provider: Default
Effective Paravirt. Provider: KVM
State: powered off (since 2018-01-02T11:34:10.174000000)
Monitor count: 1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration:
Autostart Enabled: off
Autostart Delay: 0
Default Frontend:
Storage Controller Name (0): IDE
Storage Controller Type (0): PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 2
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
Storage Controller Name (1): SATA
Storage Controller Type (1): IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1): 30
Storage Controller Port Count (1): 1
Storage Controller Bootable (1): on
IDE (1, 0): Empty
SATA (0, 0): C:\Users\XXX\VirtualBox VMs\Gentoo\Gentoo.vdi (UUID: c702659a-4ca0-4941-9fcd-32c78be9c0f5)
NIC 1: MAC: 0800279E528E, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0): name = SSH, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = 10.0.2.15, guest port = 22
NIC 2: disabled
NIC 3: disabled
NIC 4: disabled
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1: disabled
UART 2: disabled
UART 3: disabled
UART 4: disabled
LPT 1: disabled
LPT 2: disabled
Audio: enabled (Driver: DSOUND, Controller: AC97, Codec: AD1980)
Audio playback: enabled
Audio capture: enabled
Clipboard Mode: Bidirectional
Drag and drop Mode: Bidirectional
VRDE: disabled
USB: enabled
EHCI: disabled
XHCI: disabled
USB Device Filters:
<none>
Bandwidth groups: <none>
Shared folders: <none>
Capturing: not active
Capture audio: not active
Capture screens: 0
Capture file: C:\Users\XXX\VirtualBox VMs\Gentoo\Gentoo.webm
Capture dimensions: 1024x768
Capture rate: 512 kbps
Capture FPS: 25
Capture options: ac_enabled=false
Guest:
Configured memory balloon size: 0 MB
答案1
听起来像是有什么东西在途中丢掉了 VLAN 标签。可能是你的虚拟交换机。可能是你主机中的 NIC。可能是主机连接到的交换机。首先检查你的 NIC 是否能够传递 VLAN 标签并配置为允许它。(许多英特尔 NIC 默认会剥离 VLAN 标签)
如果在主机所连接的端口上设置了 VLAN 标记,那么该 VLAN 就是该端口上所有流量的 VLAN。除非交换机配置为传递由端点分配的任意 VLAN 标记,否则您无法神奇地加入不同的 VLAN。您必须与网络管理员合作,让一切按您期望的方式进行。目前,您唯一能做的就是网络管理员允许的事情。您必须使用交换机端口上可用的 VLAN、子网和网关。也许并非所有 VLAN 都有通往互联网的路由?也许这些 VLAN 之间没有路由?也许防火墙或 IPS 设备有关于流量来自/去往何处的附加规则?也许出站流量需要代理?可能性实在太多了。
最好的办法是与主机建立连接,并使用相同的路径到达您想去的地方。已知的良好路线。一旦您知道可以出去,您就可以挖隧道或做任何您需要做的事情。