1

I understand this is a kind of dumb question.

EDIT: I mean, if you run NETSTAT in a OS which HOSTS a VM, will the command return the guest VM's connections?

The logic says that all connections should be reflected in the "real" machine's CMD, but I just want to make sure this is right, and also provide some visibility in order for other people to get a clear answer. EDIT: It would be running a Type 2 Hypervisor

7
  • What type of hypervisor you using, is it 1 or 2 ?
    – Alex
    Commented Aug 21, 2018 at 19:22
  • @Alex see edited question Commented Aug 21, 2018 at 19:29
  • 1
    how would you be going about checking this? it really would depend I suppose. are your Vm's set up in such a way that they are on an internal virtualized switch or are they using the management network? I would assume that if they are on an internal switch they are being supported by a virtualized network off of the host nic card but i'm not sure if that would be a "reflection" of an incoming/active connection, that would be a hosted connection right? so I suppose the question could be reworded as would a hosted network show up on the host using net stat command? Commented Aug 21, 2018 at 19:32
  • netstat in VM will "see" only its own connections, guest can't see host's connections, that's the whole point of isolation of guest from host.
    – Alex
    Commented Aug 21, 2018 at 19:49
  • 1
    @AlejandroBertinelli no need to apologize! You just need more info otherwise its open to interpretation so people may get confused. Can you confirm which hypervisor technology you are using & version (Hyper-V 2008, VMWare ESXi5, etc.)? Doesn't hurt to clarify network setup too (one NIC shared with host & guest VM) since that can get complex as well with VLAN's & such
    – gregg
    Commented Aug 21, 2018 at 21:40

2 Answers 2

1

In my experience with VirtualBox, the network connections of the vm guests do show up in the output of the NETSTAT command. As previously noted, it does depend upon how the network connections are configured in the guests. With my Windows pc's, the guests VM's show up in the network neighborhood as well. Shared folders are accessible. Just like on a wired network.

0

NETSTAT shows connections if the OS is one of the endpoints.

For VirtualBox this is only the case in "NAT" mode, as it emulates guest connections by restarting them from the host.

However, in full routed or bridged modes the host OS won't be involved in them beyond IP layer, so NETSTAT will not show them either. (HyperV virtual switch is a bridge.)

iptables NAT (e.g. used by qemu or Docker) is full routing, not emulation – unlike VirtualBox's – so it won't show up in NETSTAT either. (But the connections may show up in conntrack instead, which if enabled tracks all connections "passing through" as well.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .